Jniexec

Java Native Interface exec (fork) implementation
Download

Jniexec Ranking & Summary

Advertisement

  • Rating:
  • License:
  • LGPL
  • Price:
  • FREE
  • Publisher Name:
  • Harald Kirsch
  • Publisher web site:
  • http://wsd.iitb.fhg.de/~geg/clighome/

Jniexec Tags


Jniexec Description

Java Native Interface exec (fork) implementation Jniexec (Java's Runtime.exec()) is a sad state of affairs as compared to the management facilities for sub processes provided by any POSIX shell or the underlying C library and system calls on a UNIX/Linux system. There are several related feature requests in SUN's Java bug database. Since it is hard to devise a solution that is portable to all systems, we may have to wait for an official fix another few decades.Developer commentsSince my work and interest mainly includes Linux (Unix) machines, I decided to shorten the time of wait and provide a result that works at least on these architectures. Jniexec provides a Java Native Interface wrapper around the fork and execlp pair of functions. It comes accompanied with two easy to use Java wrapper classes. In particular the following features are provided. Here are some key features of "Jniexec": · True sub process fork/exec of a command defined by a String[]. There is no need for an intervening shell command. · Native I/O redirection. The I/O file descriptors of the subprocess can be redirected to anything with a FileDescriptor. The Java parent process does not need to shuffle the data itself. · Redirection of every file descriptor, not just standard input, output and error. · Native pipelines. Several sub processes can be run in a pipeline connecting standard output of one sub process to the standard input of the next by I/O redirection. The Java parent process does not need to shuffle the data between the sub processes. · Still, the Java parent process can arrange to write to the pipeline's standard input, read its standard output, any of the standard error streams or any other pipe connected to the sub processes. · Blocking or non-blocking waits on all or individual processes of the pipeline. · Retrieval of exit codes of all sub processes of the pipeline as well as a summary ok/failure status. Requirements: · Java 2 Standard Edition Runtime Environment What's New in This Release: · getStatus() was changed to not throw when several threads want to wait for a child and the later ones thereby wait for a child that does not exist anymore. · kill() and suggestTermination() were changed to not throw when they send a signal to a child that no longer exists. This can happen due to a race condition with setting the child's status to terminated.


Jniexec Related Software