The Artima Developer Community
Sponsored Link

Java Community News
Java Service Wrapper Releases Version 3.2.1

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Frank Sommers

Posts: 2642
Nickname: fsommers
Registered: Jan, 2002

Java Service Wrapper Releases Version 3.2.1 Posted: Jul 11, 2006 11:49 AM
Reply to this message Reply
Summary
The Java Service Wrapper is an open-source project that enables a Java program to run as a Windows service or a Unix daemon. Artima spoke with Service Wrapper project lead Leif Mortenson about how the Service Wrapper works, and what features are in the new release.
Advertisement

The Java Service Wrapper (JSW) project released version 3.2.1 of its open-source tool that can turn a Java program into a Windows service or a Unix daemon. Wrapper runs on both Windows and on a large variety of Unix platforms. Wrapper project lead Leif Mortenson, of Tanuki Software, spoke with Artima about how the Wrapper works, and about new features in the latest release.

"Wrapper was created out of a desire to run [a Java program] as a service, but also to come up with something that provides stability for Java applications that are not necessarily stable. [At the time the project started], I worked with a company that relied on a server application that was crashing due to bugs in the JVM, and Wrapper came from a need [to recover] that server very quickly."

Over time, the project grew, and is now used by both open-source and commercial projects with the need to run a Java application as a Windows service or a Unix daemon. According to Mortenson, Windows is the most popular platform for Wrapper, with Linux being second. Other OSs, such as HP UX, Mac OS X, and Solaris also supported. The JBoss application server, Tomcat, the James email server, and Apache Cocoon are among the many open-source projects routinely run under the Java Service Wrapper.

Mortenson explained that the Java Service Wrapper is a native application, written in C, and runs as an independent process. It is typically installed as a Windows service or a Unix daemon on the host server. This process then "loads a configuration [file] that allows you to set ... pretty much all the parameters you’d [otherwise] enter into a shell script to launch a Java application, such as the classpath. [Wrapper] launches Java as a child process. When the JVM starts up, the VM loads a custom component, the Wrapper Manager, and that opens a socket back to the Wrapper process. The two then communicate via that socket ... to allow the wrapper to monitor the state of the JVM, to make sure that it’s still alive. If the JVM ever crashes or exits, normally or abnormally, Wrapper has the ability to trap that [crash] and, depending on the configuration, restart the Java process."

New features in the latest release include the ability to pause and resume a Java-based service under Windows. "On Windows, the service management panel [allows you to] hit 'pause' on the service. That doesn't actually shut down the service, only sends a signal to the service, and the application [running as the service] has to be able to understand that [signal]. If it's a database [server], that [database] may stop taking connections, [or] the Apache Web server would stop processing requests. The Wrapper now has the ability to send a signal into the JVM, and if [the Java program running under the wrapper] registers the appropriate listeners, [that program] can take action. It's also possible that when you hit pause, the wrapper will keep running, but it will stop the JVM process." Wrapper also forwards some OS-level events to the Java process. On Unix, for instance, typing control-C on a console-enabled Wrapper instance will cause a TERM signal to be sent to the Java process managed by Wrapper.

Mortenson notes that while a Java program installed as service via the Wrapper does not have to recognize or listen to events arriving from the native Wrapper component, the ability to respond to such events can provide a tighter integration with the underlying OS. And listening to Wrapper-generated events was made easier by the last major Java Service Wrapper version, making it possible to listen to Wrapper events with minimal changes to the Java program. "The new Wrapper event model defines just a single event listener type, WrapperEventListener, and you can specify the types of events that you're expecting to receive. You can then register any class to be an event listener by calling WrapperManager's addEventListener()."

Other new Java Service Wrapper features include:

  • A Solaris-x86-64 makefile
  • Ability to use a default wrapper.conf file that is in the same directory as the wrapper binary.
  • Support for registering the WrapperManager MBean with the PlatformMBeanServer when run on a 1.5+ JVM.
  • Reworked the way timeout properties are handled
  • Support for debuggers
  • Athlon is now a supported architecture
  • New wrapper.ntservice.pausable wrapper.ntservice.pausable.stop_jvm properties to make it possible to pause and resume the Wrapper when installed as a Windows service
  • New Pause and Resume batch files as well as modified the command batch file to support pause and resume

Topic: Java Service Wrapper Releases Version 3.2.1 Previous Topic   Next Topic Topic: DataDirect Releases XQuery 2.0

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use