com.metamatrix.platform.vm.controller
Class ProcessController

java.lang.Object
  extended by com.metamatrix.platform.vm.controller.ProcessController
All Implemented Interfaces:
ProcessManagement
Direct Known Subclasses:
SocketVMController

public abstract class ProcessController
extends java.lang.Object
implements ProcessManagement

This class is used to start up a server process and start all services that are configured under this server


Field Summary
protected  ClientServiceRegistry clientServices
           
static int DEFAULT_STARTER_MAX_THREADS
           
static int DEFAULT_STARTER_TIMETOLIVE
           
protected  Host host
           
protected  java.lang.String processName
           
protected  ClusteredRegistryState registry
           
static java.lang.String SERVICE_MONITOR_INTERVAL
          Interval to check the state of services (ms)
static java.lang.String STARTER_MAX_THREADS
           
static java.lang.String STARTER_TIMETOLIVE
          Time-to-live for threads used to start services (ms)
 
Constructor Summary
ProcessController(Host host, java.lang.String processname, ClusteredRegistryState registry, ServerEvents serverEvents, MessageBus bus, HostManagement hostManagement)
          Create a new instance of VMController.
 
Method Summary
 void checkService(ServiceID serviceID)
          Check a service, and updates the state in some cases.
 void dumpThreads()
          Prints thread information to a log file.
 byte[] exportLogs()
          Export the server logs to a byte[].
 java.net.InetAddress getAddress()
          Get the address of the host this VM is running on.
 Host getConfigHost()
           
 java.lang.String getName()
          Get the name for this controller.
protected abstract  WorkerPoolStats getProcessPoolStats()
           
protected  java.util.Properties getProperties()
           
protected abstract  SocketListenerStats getSocketListenerStats()
           
 java.util.Date getStartTime()
          Get the time the VM was initialized.
 ProcessStatistics getVMStatistics()
          Return information about VM.
 boolean isShuttingDown()
          Returns true if system is being shutdown.
protected  boolean isStarted()
          Return TRUE if the system's services are started; i.e.
protected  void logMessage(java.lang.String s)
           
 void ping()
          Method called from registries to determine if VMController is alive.
 void setCurrentLogConfiguration(LogConfiguration logConfiguration)
          Set the current log configuration for this vm.
 void shutdown(boolean now)
          Shut down all services waiting for work to complete.
 void start()
          Starts the VM by invoking all the deployed services
 void startDeployedService(ServiceComponentDefnID id)
          Start the service identified by the ServiceComponentID If synch is true then wait for service to start before returning.
 void startService(ServiceID serviceID)
          Start a previously stopped service
 void stopService(ServiceID id, boolean now, boolean shutdown)
          Kill service once work is complete
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STARTER_MAX_THREADS

public static final java.lang.String STARTER_MAX_THREADS
See Also:
Constant Field Values

STARTER_TIMETOLIVE

public static final java.lang.String STARTER_TIMETOLIVE
Time-to-live for threads used to start services (ms)

See Also:
Constant Field Values

SERVICE_MONITOR_INTERVAL

public static final java.lang.String SERVICE_MONITOR_INTERVAL
Interval to check the state of services (ms)

See Also:
Constant Field Values

DEFAULT_STARTER_MAX_THREADS

public static final int DEFAULT_STARTER_MAX_THREADS
See Also:
Constant Field Values

DEFAULT_STARTER_TIMETOLIVE

public static final int DEFAULT_STARTER_TIMETOLIVE
See Also:
Constant Field Values

host

protected Host host

processName

protected java.lang.String processName

registry

protected ClusteredRegistryState registry

clientServices

protected ClientServiceRegistry clientServices
Constructor Detail

ProcessController

public ProcessController(Host host,
                         java.lang.String processname,
                         ClusteredRegistryState registry,
                         ServerEvents serverEvents,
                         MessageBus bus,
                         HostManagement hostManagement)
                  throws java.lang.Exception
Create a new instance of VMController.

Parameters:
processName - Name of Process
startDeployedServices - If true all services that are deployed to this vm are started.
standalone - If true indicates that VMController is running in its own vm.
Throws:
java.lang.Exception - if an error occurs initializing vmController
Method Detail

logMessage

protected void logMessage(java.lang.String s)

start

public void start()
Description copied from interface: ProcessManagement
Starts the VM by invoking all the deployed services

Specified by:
start in interface ProcessManagement

startService

public void startService(ServiceID serviceID)
Description copied from interface: ProcessManagement
Start a previously stopped service

Specified by:
startService in interface ProcessManagement

startDeployedService

public void startDeployedService(ServiceComponentDefnID id)
Description copied from interface: ProcessManagement
Start the service identified by the ServiceComponentID If synch is true then wait for service to start before returning. Any exceptions will then be thrown to the caller. If synch is false then start service asynchronously.

Specified by:
startDeployedService in interface ProcessManagement

shutdown

public void shutdown(boolean now)
Shut down all services waiting for work to complete. Essential services will also be shutdown.

Specified by:
shutdown in interface ProcessManagement

stopService

public void stopService(ServiceID id,
                        boolean now,
                        boolean shutdown)
Kill service once work is complete

Specified by:
stopService in interface ProcessManagement

setCurrentLogConfiguration

public void setCurrentLogConfiguration(LogConfiguration logConfiguration)
Set the current log configuration for this vm.

Specified by:
setCurrentLogConfiguration in interface ProcessManagement

getStartTime

public java.util.Date getStartTime()
Get the time the VM was initialized.

Specified by:
getStartTime in interface ProcessManagement

getConfigHost

public Host getConfigHost()

ping

public void ping()
Method called from registries to determine if VMController is alive.

Specified by:
ping in interface ProcessManagement

isShuttingDown

public boolean isShuttingDown()
Description copied from interface: ProcessManagement
Returns true if system is being shutdown.

Specified by:
isShuttingDown in interface ProcessManagement

getVMStatistics

public ProcessStatistics getVMStatistics()
Return information about VM. totalMemory, freeMemory, threadCount

Specified by:
getVMStatistics in interface ProcessManagement

dumpThreads

public void dumpThreads()
Prints thread information to a log file. Does not include the stacktrace - that is not available in 1.4.

Specified by:
dumpThreads in interface ProcessManagement

exportLogs

public byte[] exportLogs()
Description copied from interface: ProcessManagement
Export the server logs to a byte[]. The bytes contain the contents of a .zip file containing the logs. This will export all logs on the host that contains this VMController.

Specified by:
exportLogs in interface ProcessManagement
Returns:
the logs, as a byte[].
Since:
4.3
See Also:
ProcessManagement.exportLogs()

getSocketListenerStats

protected abstract SocketListenerStats getSocketListenerStats()

getProcessPoolStats

protected abstract WorkerPoolStats getProcessPoolStats()

checkService

public void checkService(ServiceID serviceID)
Check a service, and updates the state in some cases. Catches any ServiceExceptions, so that the caller doesn't have to deal with them.

Specified by:
checkService in interface ProcessManagement
Parameters:
serviceID - Identifies service to be stopped

getProperties

protected java.util.Properties getProperties()

isStarted

protected boolean isStarted()
Return TRUE if the system's services are started; i.e. at least one of every essential services in a product is running. Authorization, Configuration, Membership and Session services are considered to be essential.

Parameters:
callerSessionID - ID of the caller's current session.
Returns:
Boolean - TRUE if system is started, FALSE if not.
Throws:
MetaMatrixComponentException - if an error occurred in communicating with a component.

getAddress

public java.net.InetAddress getAddress()
Description copied from interface: ProcessManagement
Get the address of the host this VM is running on.

Specified by:
getAddress in interface ProcessManagement

getName

public java.lang.String getName()
Description copied from interface: ProcessManagement
Get the name for this controller.

Specified by:
getName in interface ProcessManagement


Copyright © 2009. All Rights Reserved.