|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.abstracthorizon.danube.service.Service
public abstract class Service
This class represents a Service that can run independently under some framework.
Field Summary | |
---|---|
static int |
DESTROYED
|
static int |
INITIALIZED
|
protected Set<ServiceNotificationListener> |
listeners
Listeners |
protected org.slf4j.Logger |
logger
|
protected String |
name
Service name |
static int |
NOT_INITIALIZED
|
static int |
RUNNING
|
static String[] |
SERVICE_STATE_NAMES
|
static int |
STARTED
|
static int |
STOPPED
|
static int |
STOPPING
|
protected boolean |
stopService
Flag to signal to service that it needs to stop |
Constructor Summary | |
---|---|
Service()
Constructor |
Method Summary | |
---|---|
void |
addListener(ServiceNotificationListener listener)
Adds new listener |
protected void |
changeState(int newState)
This method changes state. |
void |
create()
This method is to be called for service to be set-up. |
void |
destroy()
This method is to be called when service is to be removed from the system. |
String |
getName()
Returns service name |
int |
getState()
Returns current state |
String |
getStateName()
Returns state as a string |
void |
removeListener(ServiceNotificationListener listener)
Removes a listener |
void |
setName(String name)
Sets service's name |
void |
start()
This method is to be called for service to be started. |
void |
stop()
This method is to be called for service to be stopped. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.lang.Runnable |
---|
run |
Field Detail |
---|
public static final int NOT_INITIALIZED
public static final int INITIALIZED
public static final int STARTED
public static final int RUNNING
public static final int STOPPING
public static final int STOPPED
public static final int DESTROYED
public static final String[] SERVICE_STATE_NAMES
protected final org.slf4j.Logger logger
protected boolean stopService
protected Set<ServiceNotificationListener> listeners
protected String name
Constructor Detail |
---|
public Service()
Method Detail |
---|
public void setName(String name)
name
- service's namepublic String getName()
protected void changeState(int newState)
newState
- new statepublic void addListener(ServiceNotificationListener listener)
listener
- listenerpublic void removeListener(ServiceNotificationListener listener)
listener
- listenerpublic int getState()
public String getStateName()
public void create() throws ServiceException
ServiceException
public void destroy() throws ServiceException
Exception
ServiceException
public void start() throws ServiceException
Exception
ServiceException
public void stop() throws ServiceException
stopService
flag is going to be set to true
Exception
ServiceException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |