Apache Commons Runtime

In today's world Java is used mainly to develop server based application. On the other hand Java doesn't offer API that can fully benefit from the features most modern operating systems provide.

Apache Commons Runtime tries to solve that gap by providing the JNI layer and Java API over that layer, allowing application to fully utilize operating system features that are missing from the main JDK implementation.

Supported operating systems are chosen on the deployment basis but any new operating system can be easily added by writing the appropriate wrappers.

Operating System Minimum Supported Version Notes
Linux 2.6.18 Kernel needs AIO support
Microsoft Windows XP Needs Vista+ for Kernel Transactions
Sun Solaris 10 Intel and Sparc
Mac OS X 10.5
Hewlett Packard HP-UX 11

Supported Java platform is Java 5 although we recommend Java 6 to be used.

Apache Commons Runtime supports the following extensions to the existing JDK classes:

  • Memory Management
    Used for managing the memory allocated directly from the operating system.
  • Mutex and Semaphore
    Mutex and Semaphore objects are used for cross process synchronization.
  • Shared Memory
    Full support for named and anonymous shared memory.
  • Memory Mapping
    File memory mapping.
  • Signaling
    Passing signals between processes.
  • Daemon
    Daemon support for running processes as daemons or services.
  • Process Management
    Advanced process creation and management.
  • Security
    Native operating system security management and auditing.
  • Asynchronous IO
    Asynchronous IO for Files, Pipes and Sockets.
  • Comprehensive OS Information and Statistics
    Getting info about operating system memory, files, sockets, CPU utilization and more.
  • OpenSSL
    Using OpenSSL for SSL and TLS networking.
  • Platform Specifics
    Platform specific classes like Windows Registry or SELinux.

History

Apache Commons Runtime originates from two projects; Apache Commons Daemon and Tomcat Native, and is meant to be a direct replacement for those two projects.

Commons Daemon lacks the features found in Tomcat Native and vice verse. The primary reason for merging those two projects was the need for allowing graceful restarts for Java server based applications without restart down time.

That kind of concept is well known inside Apache Httpd project where parent process creates the sockets that are passed to the child processes. When restart is needed the previous child generation is stopped after the new child is created, thus allowing zero down time.

Tomcat Native uses Apache Portable Runtime (APR) for its native layer, but since APR is generalization of the operating system it makes certain compromises to allow cross platform API.

Apache Commons Runtime uses APR code but without the APR memory pools since being embedded inside JVM we already have a full garbage collector and object life time management out of the box. APR pools in such environment make additional layer which introduces unwanted memory overhead and performance degradation, so unlike Tomcat Native, we use direct memory allocation for all APR objects.