|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.metamatrix.platform.service.controller.AbstractService
public abstract class AbstractService
Base class for all services.
Field Summary |
---|
Fields inherited from interface com.metamatrix.platform.service.api.ServiceInterface |
---|
WAIT_TO_DIE_TIME |
Constructor Summary | |
---|---|
AbstractService()
Default constructor. |
Method Summary | |
---|---|
void |
checkState()
If service is not open an exception is thrown. |
protected abstract void |
closeService()
Close the service to new work if applicable. |
void |
die()
This method will gracefully shutdown the service. |
void |
dieNow()
This method will shutdown the service immediately. |
java.util.Collection<ConnectionPoolStats> |
getConnectionPoolStats()
Returns a list of ConnectionPoolStat objects for the specific ConnectorBinding service If there are no ConnectionPoolStats, null is returned. |
int |
getCurrentState()
Return current state of of the service. |
java.lang.String |
getHostname()
Return name of the host service is running on. |
ServiceID |
getID()
Return id of this service. |
java.lang.Throwable |
getInitException()
|
java.lang.String |
getInstanceName()
Return instance name of this service. |
java.lang.String |
getProcessName()
Get process name on which this service is running on |
java.util.Properties |
getProperties()
Return the properties that were used to init this service. |
java.util.Collection |
getQueueStatistics()
Returns a list of QueueStats objects that represent the queues in this service. |
WorkerPoolStats |
getQueueStatistics(java.lang.String name)
Returns a QueueStats object that represent the queue in this service. |
protected java.lang.String |
getResourceName()
This method should be overridden when the extending class when it will use a resource name other than the ComponentTypeName for looking up its resource connection properties. |
ServiceData |
getServiceData()
|
protected java.lang.String |
getServiceName()
Return name of service (instance name) |
java.lang.String |
getServiceType()
Return the type of service (QueryService, SubscriptionService, etc...) |
java.util.Date |
getStartTime()
Return time service was initializes. |
java.util.Date |
getStateChangeTime()
Return the time the current state was entered. |
void |
init(ServiceID id,
DeployedComponentID deployedComponentID,
java.util.Properties props,
ClientServiceRegistry listenerRegistry,
ClassLoaderManager clManager)
Initialize a service using the properties specified. |
protected abstract void |
initService(java.util.Properties props)
Perform initialization and commence processing. |
boolean |
isAlive()
Method used to determine if service is still alive. |
boolean |
isClosed()
Return true if service is closed. |
boolean |
isInitialized()
Return true if service has been initialized. |
boolean |
isOpen()
Return true if service is open |
protected abstract void |
killService()
Terminate all processing and reclaim resources. |
void |
processEvent(java.util.EventObject obj)
This method is called when a ServiceEvent that service has registered for is received via the MessageBus. |
protected void |
registerForEvents()
Register for events. |
void |
setInitException(java.lang.Throwable error)
Set the initializaton exception |
protected void |
unregisterForEvents()
UnRegister for events. |
void |
updateState(int newState)
Update state and stateChangedTime with new state; If newState == state then do nothing. |
protected abstract void |
waitForServiceToClear()
Wait until the service has completed all outstanding work. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractService()
Method Detail |
---|
public void init(ServiceID id, DeployedComponentID deployedComponentID, java.util.Properties props, ClientServiceRegistry listenerRegistry, ClassLoaderManager clManager)
init
in interface ServiceInterface
id
- The ServiceID this service was registered withdeployedComponentID
- Unique identifier of this deployed component.props
- the properties which define the service configurationcontroller
- ServiceBusInterface which supplies resources such as event processingpublic final java.lang.String getServiceType()
getServiceType
in interface ServiceInterface
public final int getCurrentState()
getCurrentState
in interface ServiceInterface
public final java.util.Date getStateChangeTime()
getStateChangeTime
in interface ServiceInterface
public final ServiceID getID()
getID
in interface ServiceInterface
public final void die()
die
in interface ServiceInterface
public final void dieNow()
dieNow
in interface ServiceInterface
public final java.util.Properties getProperties()
getProperties
in interface ServiceInterface
public final java.util.Date getStartTime()
getStartTime
in interface ServiceInterface
public final java.lang.String getHostname()
getHostname
in interface ServiceInterface
public final java.lang.String getProcessName()
ServiceInterface
getProcessName
in interface ServiceInterface
ServiceInterface.getProcessName()
public final java.lang.String getInstanceName()
public final boolean isAlive()
isAlive
in interface ServiceInterface
public void checkState() throws ServiceStateException
checkState
in interface ServiceInterface
ServiceNotInitialized
- if service has not yet been initialized.
ServiceClosedException
- if service has been closed.
ServiceSuspendedException
- if service is currently suspended.
ServiceStateException
public final boolean isInitialized()
public final boolean isOpen()
public final boolean isClosed()
protected abstract void initService(java.util.Properties props) throws java.lang.Exception
java.lang.Exception
protected abstract void closeService() throws java.lang.Exception
java.lang.Exception
protected abstract void waitForServiceToClear() throws java.lang.Exception
java.lang.Exception
protected abstract void killService()
protected java.lang.String getResourceName()
public void processEvent(java.util.EventObject obj)
processEvent
in interface EventObjectListener
protected void registerForEvents() throws java.lang.Exception
java.lang.Exception
protected void unregisterForEvents() throws java.lang.Exception
java.lang.Exception
public java.util.Collection getQueueStatistics()
getQueueStatistics
in interface ServiceInterface
public WorkerPoolStats getQueueStatistics(java.lang.String name)
getQueueStatistics
in interface ServiceInterface
public void updateState(int newState)
updateState
in interface ServiceInterface
int
- new state of servicepublic void setInitException(java.lang.Throwable error)
setInitException
in interface ServiceInterface
Throwable
- public java.lang.Throwable getInitException()
getInitException
in interface ServiceInterface
protected java.lang.String getServiceName()
public ServiceData getServiceData()
getServiceData
in interface ServiceInterface
public java.util.Collection<ConnectionPoolStats> getConnectionPoolStats()
ServiceInterface
getConnectionPoolStats
in interface ServiceInterface
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |