src/solaris/classes/java/lang/UNIXProcess.java

Print this page




 211                                    byte[] argBlock, int argc,
 212                                    byte[] envBlock, int envc,
 213                                    byte[] dir,
 214                                    int[] fds,
 215                                    boolean redirectErrorStream)
 216         throws IOException;
 217 
 218     /**
 219      * The thread pool of "process reaper" daemon threads.
 220      */
 221     private static final Executor processReaperExecutor =
 222         doPrivileged((PrivilegedAction<Executor>) () -> {
 223 
 224             ThreadGroup tg = Thread.currentThread().getThreadGroup();
 225             while (tg.getParent() != null) tg = tg.getParent();
 226             ThreadGroup systemThreadGroup = tg;
 227 
 228             ThreadFactory threadFactory = grimReaper -> {
 229                 // Our thread stack requirement is quite modest.
 230                 Thread t = new Thread(systemThreadGroup, grimReaper,
 231                                       "process reaper", 32768);
 232                 t.setDaemon(true);
 233                 // A small attempt (probably futile) to avoid priority inversion
 234                 t.setPriority(Thread.MAX_PRIORITY);
 235                 return t;
 236             };
 237 
 238             return Executors.newCachedThreadPool(threadFactory);
 239         });
 240 
 241     UNIXProcess(final byte[] prog,
 242                 final byte[] argBlock, final int argc,
 243                 final byte[] envBlock, final int envc,
 244                 final byte[] dir,
 245                 final int[] fds,
 246                 final boolean redirectErrorStream)
 247             throws IOException {
 248 
 249         pid = forkAndExec(launchMechanism.ordinal() + 1,
 250                           helperpath,
 251                           prog,




 211                                    byte[] argBlock, int argc,
 212                                    byte[] envBlock, int envc,
 213                                    byte[] dir,
 214                                    int[] fds,
 215                                    boolean redirectErrorStream)
 216         throws IOException;
 217 
 218     /**
 219      * The thread pool of "process reaper" daemon threads.
 220      */
 221     private static final Executor processReaperExecutor =
 222         doPrivileged((PrivilegedAction<Executor>) () -> {
 223 
 224             ThreadGroup tg = Thread.currentThread().getThreadGroup();
 225             while (tg.getParent() != null) tg = tg.getParent();
 226             ThreadGroup systemThreadGroup = tg;
 227 
 228             ThreadFactory threadFactory = grimReaper -> {
 229                 // Our thread stack requirement is quite modest.
 230                 Thread t = new Thread(systemThreadGroup, grimReaper,
 231                                       "process reaper", 65536);
 232                 t.setDaemon(true);
 233                 // A small attempt (probably futile) to avoid priority inversion
 234                 t.setPriority(Thread.MAX_PRIORITY);
 235                 return t;
 236             };
 237 
 238             return Executors.newCachedThreadPool(threadFactory);
 239         });
 240 
 241     UNIXProcess(final byte[] prog,
 242                 final byte[] argBlock, final int argc,
 243                 final byte[] envBlock, final int envc,
 244                 final byte[] dir,
 245                 final int[] fds,
 246                 final boolean redirectErrorStream)
 247             throws IOException {
 248 
 249         pid = forkAndExec(launchMechanism.ordinal() + 1,
 250                           helperpath,
 251                           prog,