JavaService, an ObjectWeb project

org.objectweb.javaservice.test
Class SampleService

java.lang.Object
  extended byorg.objectweb.javaservice.test.SampleService

public class SampleService
extends java.lang.Object

This class is provided as an example of how a Java application may be run as a Windows System Service (aka daemon, in Unix-speak) using the JavaService software utility.


Method Summary
static void main(java.lang.String[] args)
          Default entry point if class is run as a standard application.
static void outputHeapDetails()
          Convenience function to display details of the current heap size.
static void outputJvmDetails()
          Convenience function to display details of the JVM in use.
static void serviceStart(java.lang.String[] args)
          Entry point for class to be loaded and started as a service.
static void serviceStop(java.lang.String[] args)
          Entry point for class to be be stopped when running as a service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

main

public static void main(java.lang.String[] args)
Default entry point if class is run as a standard application. This outputs a brief informational message to track use of the function. If command-line parameter specified as 'start' or 'stop', then it calls the service start or stop function respectively.

Parameters:
args - command-line arguments, array may be zero-length or more

outputJvmDetails

public static void outputJvmDetails()
Convenience function to display details of the JVM in use.


outputHeapDetails

public static void outputHeapDetails()
Convenience function to display details of the current heap size.


serviceStart

public static void serviceStart(java.lang.String[] args)
Entry point for class to be loaded and started as a service. When run, this creates the singleton class instance and invokes the processing function within that - which continues in a loop (with delays) until signalled to end by the service stop function

Parameters:
args - command-line arguments, expect first element to be 'start'

serviceStop

public static void serviceStop(java.lang.String[] args)
Entry point for class to be be stopped when running as a service. Get singleton instance and signal that it is to terminate the processing loop (if that is even running at the time).

Parameters:
args - command-line arguments, expect first element to be 'stop'

Project page at javaservice.objectweb.org

Copyright © 2005 Multiplan Consultants Ltd.