org.apache.karaf.shell.wrapper
Class Main

java.lang.Object
  extended by java.lang.Thread
      extended by org.apache.karaf.shell.wrapper.Main
All Implemented Interfaces:
java.lang.Runnable, ShutdownCallback, org.tanukisoftware.wrapper.WrapperListener

public class Main
extends java.lang.Thread
implements org.tanukisoftware.wrapper.WrapperListener, ShutdownCallback

Java Service Wrapper Main class


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Method Summary
 void controlEvent(int event)
          Called whenever the native Wrapper code traps a system control signal against the Java process.
static void main(java.lang.String[] args)
           
 void run()
           
 java.lang.Integer start(java.lang.String[] args)
          The start method is called when the WrapperManager is signaled by the native Wrapper code that it can start its application.
 int stop(int exitCode)
          Called when the application is shutting down.
 void waitingForShutdown(int delay)
          Call-back method is called by the @{link org.apache.karaf.main.Main} for Signaling that the stopping process is in progress and the wrapper doesn't kill the JVM.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

start

public java.lang.Integer start(java.lang.String[] args)
The start method is called when the WrapperManager is signaled by the native Wrapper code that it can start its application. This method call is expected to return, so a new thread should be launched if necessary.

Specified by:
start in interface org.tanukisoftware.wrapper.WrapperListener
Parameters:
args - List of arguments used to initialize the application.
Returns:
Any error code if the application should exit on completion of the start method. If there were no problems then this method should return null.

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

stop

public int stop(int exitCode)
Called when the application is shutting down. The Wrapper assumes that this method will return fairly quickly. If the shutdown code code could potentially take a long time, then WrapperManager.signalStopping() should be called to extend the timeout period. If for some reason, the stop method can not return, then it must call WrapperManager.stopped() to avoid warning messages from the Wrapper.

Specified by:
stop in interface org.tanukisoftware.wrapper.WrapperListener
Parameters:
exitCode - The suggested exit code that will be returned to the OS when the JVM exits.
Returns:
The exit code to actually return to the OS. In most cases, this should just be the value of exitCode, however the user code has the option of changing the exit code if there are any problems during shutdown.

waitingForShutdown

public void waitingForShutdown(int delay)
Call-back method is called by the @{link org.apache.karaf.main.Main} for Signaling that the stopping process is in progress and the wrapper doesn't kill the JVM.

Specified by:
waitingForShutdown in interface ShutdownCallback

controlEvent

public void controlEvent(int event)
Called whenever the native Wrapper code traps a system control signal against the Java process. It is up to the callback to take any actions necessary. Possible values are: WrapperManager.WRAPPER_CTRL_C_EVENT, WRAPPER_CTRL_CLOSE_EVENT, WRAPPER_CTRL_LOGOFF_EVENT, or WRAPPER_CTRL_SHUTDOWN_EVENT

Specified by:
controlEvent in interface org.tanukisoftware.wrapper.WrapperListener
Parameters:
event - The system control signal.

main

public static void main(java.lang.String[] args)


Copyright © 2007-2011 Apache Software Foundation. All Rights Reserved.