SRJRCFrames
v0.1.296

de.schwarzrot.app.support
Class ServiceLauncher<C extends ServiceConfig>

java.lang.Object
  extended by de.schwarzrot.app.support.AbstractApplicationLauncher<C>
      extended by de.schwarzrot.app.support.ServiceLauncher<C>
Type Parameters:
C - - config type for service configuration

public class ServiceLauncher<C extends ServiceConfig>
extends AbstractApplicationLauncher<C>

a helper class to start background/system services. This class provides property parsing, logfile setup and instantiation of the real service instance.

Author:
Reinhard Mantey

Field Summary
static String KEY_CLASSPATH
           
static String KEY_JAR_FILENAME
           
static String KEY_PID_FILE
           
static String KEY_SLEEP_TIME
           
static String SERVICE_START_TOKEN
           
 
Fields inherited from class de.schwarzrot.app.support.AbstractApplicationLauncher
APPLICATION_TYPE, starter, sysInfo
 
Constructor Summary
ServiceLauncher(Service<C> service, String[] appContextFiles, List<String> appArgs)
           
 
Method Summary
protected  void daemonize()
          detach the service, so it can run in the background
protected  Service<C> getService()
           
protected  Thread getServiceManagerThread()
          accessor to the main thread of the service
protected  AbstractApplicationContext init(String[] appContextFiles)
           
static boolean isDebug()
           
 boolean isShutdownRequested()
          a shutdown request for a service may occure from inside (the service) or from outside (the operating system).
static void setDebug(boolean debug)
           
protected  void setupConfig()
          process common service parameters from jvms system properties
protected  void shutdown()
          initiate the shutdown procedure.
 void start()
          the mainloop of all services.
 
Methods inherited from class de.schwarzrot.app.support.AbstractApplicationLauncher
checkDBAccess, doUsage, dumpCharsets, getLogger, getStarter, getSysInfo, loadExtensions, parseAppArgs, printAppInfo, setSysInfo, sysDump
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVICE_START_TOKEN

public static final String SERVICE_START_TOKEN
See Also:
Constant Field Values

KEY_CLASSPATH

public static final String KEY_CLASSPATH
See Also:
Constant Field Values

KEY_JAR_FILENAME

public static final String KEY_JAR_FILENAME
See Also:
Constant Field Values

KEY_PID_FILE

public static final String KEY_PID_FILE
See Also:
Constant Field Values

KEY_SLEEP_TIME

public static final String KEY_SLEEP_TIME
See Also:
Constant Field Values
Constructor Detail

ServiceLauncher

public ServiceLauncher(Service<C> service,
                       String[] appContextFiles,
                       List<String> appArgs)
Method Detail

isShutdownRequested

public boolean isShutdownRequested()
a shutdown request for a service may occure from inside (the service) or from outside (the operating system). This class cares about the outside view of the service.

Returns:
whether the service should stop

start

public void start()
the mainloop of all services. The service itself should not loop itself to be able to shutdown gracefully.

Overrides:
start in class AbstractApplicationLauncher<C extends ServiceConfig>

daemonize

protected void daemonize()
detach the service, so it can run in the background


getService

protected final Service<C> getService()

getServiceManagerThread

protected Thread getServiceManagerThread()
accessor to the main thread of the service

Returns:
the services main thread

init

protected AbstractApplicationContext init(String[] appContextFiles)
Overrides:
init in class AbstractApplicationLauncher<C extends ServiceConfig>

setupConfig

protected void setupConfig()
process common service parameters from jvms system properties


shutdown

protected void shutdown()
initiate the shutdown procedure.


isDebug

public static final boolean isDebug()

setDebug

public static final void setDebug(boolean debug)

SRJRCFrames
v0.1.296

hosted at
Find SRJRCFrames at SourceForge.net. Fast, secure and free:
           Open Source Software download
Submit a bug or request a feature

SRJRCFrames is published according to the GNU General Public License
Copyright 2005-2012 Reinhard Mantey - some rights reserved.