com.zfabrik.workers.home
Interface IWorkerProcess


public interface IWorkerProcess

A worker process is managed by the home process as explained in IHomeLayout.

Worker process component definitions have no resources beyond a property sheet. A worker process definition typically looks like this:

 com.zfabrik.component.type=com.zfabrik.worker
 # worker configuration
 #
 # target states
 #
 worker.states=environment/webWorkerUp
 
 #
 # max worker thread pool concurrency
 #
 worker.concurrency=15


 #
 # debug port
 #
 worker.debug.port=5001
 #
 # timeout (in ms) before the worker will be forcefully killed at worker stop
 #
 worker.process.timeouts.termination=20000
 #
 # vm options
 #
 worker.process.vmOptions=\
  -Xmx128m -Xms128m -XX:+HeapDumpOnOutOfMemoryError \
  -Duser.language=en \
  -Dcom.sun.management.jmxremote.port=7778
 

Properties in detail:

worker.process.vmOptions
General virtual machine parameters for the worker process. See for example http://blogs.sun.com/watt/resource/jvm-options-list.html for a general overview.
worker.states
Comma-separated list of target state (components) of the worker process (see also ISystemState. The worker process, when starting, will try to attain these target states and will try so again during each verification and synchronization.
worker.concurrency
Size of application thread pool (see ApplicationThreadPool). In general this thread pool is used for application type work (e.g. for web requests or parallel execution within the application). This property helps achieving a simple but effective concurrent load control
worker.process.timeouts.start
Timeout in milliseconds. This time out determines when the worker process implementation will forcibly kill the worker process if it has not reported startup completion until then.
worker.process.timeouts.termination
Timeout in milliseconds. This time out determines when the worker process implementation will forcibly kill the worker process if it has not terminated after this timeout has passed since it was asked to terminate.
worker.process.timeouts.communication
Timeout in milliseconds. This time out is the default timeout that determines the time passed after which the worker process implementation will forcibly kill a worker process if a message request has not returned.
worker.debug
Debugging for the worker process will be configured if this property is set to true and the home process has debugging enabled. Otherwise the worker process will not be configured for debugging.
worker.debug.port
The debug port to use for this worker process, if it is configured for debugging (see WORKER_DEBUG)


Field Summary
static String DEBUG_PORT
          The debug port to use for this worker process, if it is configured for debugging (see WORKER_DEBUG)
static String MSG_NODE
          msg header providing id of target node if one specific
static String MSG_TARGET
          msg header describing the target of a message
static String MSG_TARGET_ALL
           
static String MSG_TARGET_HOME
           
static String MSG_TARGET_NODE
           
static String MSG_TIMEOUT
          msg header providing the time out of the message operation (per node).
static short NOT_STARTED
           
static short STARTED
           
static short STARTING
           
static String STATES
          Target states of the worker process (see also ISystemState.
static short STOPPING
           
static String TO_MSG
          Timeout in milliseconds.
static String TO_MSG_DEF
           
static String TO_START
          Timeout in milliseconds.
static String TO_START_DEF
           
static String TO_TERM
          Timeout in milliseconds.
static String TO_TERM_DEF
           
static String VMOPTS
          General virtual machine parameters for the worker process.
static String WORKER_CONCURRENCY
          Size of application thread pool (see ApplicationThreadPool).
static String WORKER_DEBUG
          Debugging for the worker process will be configured if this property is set to true and the home process has debugging enabled.
 
Method Summary
 short getState()
          get the state of this worker
 Map<String,Serializable> sendMessage(Map<String,Serializable> args, long timeout)
          send a message to the process.
 Map<String,Serializable> sendMessage(Map<String,Serializable> args, long timeout, boolean killOnTimeOut)
          send a message to the process.
 void start()
          start this worker
 void stop()
          Stop this worker
 

Field Detail

VMOPTS

static final String VMOPTS
General virtual machine parameters for the worker process. See for example http://blogs.sun.com/watt/resource/jvm-options-list.html for a general overview.

See Also:
Constant Field Values

STATES

static final String STATES
Target states of the worker process (see also ISystemState. The worker process, when starting, will try to attain these target states and will try so again during each verification and synchronization.

See Also:
Constant Field Values

TO_START

static final String TO_START
Timeout in milliseconds. This time out determines when the worker process implementation will forcibly kill the worker process if it has not reported startup completion until then.

See Also:
Constant Field Values

TO_TERM

static final String TO_TERM
Timeout in milliseconds. This time out determines when the worker process implementation will forcibly kill the worker process if it has not terminated after this timeout has passed since it was asked to terminate.

See Also:
Constant Field Values

TO_MSG

static final String TO_MSG
Timeout in milliseconds. This time out is the default timeout that determines the time passed after which the worker process implementation will forcibly kill a worker process if a message request has not returned.

See Also:
Constant Field Values

WORKER_CONCURRENCY

static final String WORKER_CONCURRENCY
Size of application thread pool (see ApplicationThreadPool). In general this thread pool is used for application type work (e.g. for web requests or parallel execution within the application). This property helps achieving a simple but effective concurrent load control

See Also:
Constant Field Values

WORKER_DEBUG

static final String WORKER_DEBUG
Debugging for the worker process will be configured if this property is set to true and the home process has debugging enabled.

Otherwise the worker process will not be configured for debugging.

See Also:
Constant Field Values

DEBUG_PORT

static final String DEBUG_PORT
The debug port to use for this worker process, if it is configured for debugging (see WORKER_DEBUG)

See Also:
Constant Field Values

TO_START_DEF

static final String TO_START_DEF
See Also:
Constant Field Values

TO_TERM_DEF

static final String TO_TERM_DEF
See Also:
Constant Field Values

TO_MSG_DEF

static final String TO_MSG_DEF
See Also:
Constant Field Values

MSG_TARGET

static final String MSG_TARGET
msg header describing the target of a message

See Also:
Constant Field Values

MSG_TARGET_NODE

static final String MSG_TARGET_NODE
See Also:
Constant Field Values

MSG_TARGET_ALL

static final String MSG_TARGET_ALL
See Also:
Constant Field Values

MSG_TARGET_HOME

static final String MSG_TARGET_HOME
See Also:
Constant Field Values

MSG_NODE

static final String MSG_NODE
msg header providing id of target node if one specific

See Also:
Constant Field Values

MSG_TIMEOUT

static final String MSG_TIMEOUT
msg header providing the time out of the message operation (per node). Can be provided as long or as string

See Also:
Constant Field Values

NOT_STARTED

static final short NOT_STARTED
See Also:
Constant Field Values

STARTING

static final short STARTING
See Also:
Constant Field Values

STARTED

static final short STARTED
See Also:
Constant Field Values

STOPPING

static final short STOPPING
See Also:
Constant Field Values
Method Detail

sendMessage

Map<String,Serializable> sendMessage(Map<String,Serializable> args,
                                     long timeout)
                                     throws IOException
send a message to the process. Note: message sending happens completely synchronously. A message is just a name value map. All content must be serializable (preferrably string). Its return value is also just a map.

Parameters:
args - a map of name value pairs that will be serialized as strings to the slave
timeout - timeout for message answering in ms.
Returns:
a result map
Throws:
IOException

sendMessage

Map<String,Serializable> sendMessage(Map<String,Serializable> args,
                                     long timeout,
                                     boolean killOnTimeOut)
                                     throws IOException
send a message to the process. Note: message sending happens completely synchronously. A message is just a name value map. All content must be serializable (preferrably string). Its return value is also just a map.

Parameters:
args - a map of name value pairs that will be serialized as strings to the slave
timeout - timeout for message answering in ms.
killOnTimeOut - if true a timeout will lead to a process termination.
Returns:
a result map
Throws:
IOException

stop

void stop()
Stop this worker


start

void start()
start this worker


getState

short getState()
get the state of this worker