|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.locomotive.server.ServiceRoutingTable.ServiceEntry
This little class is the companion to the ServiceRoutingTable. The
ServiceRoutingTable creates these, and keeps a bunch of these around.
To use this class, you'll want to override two methods:
initialize()
, and shutdown()
, which will
do whatever's appropriate to do at the beginning of and at the end of
your service's life. If your service requires a persistent object,
then create it in the intialize() method and store it in the service
field.
Field Summary | |
protected int |
availability
This ServiceEntry's service may not be available to serve requests at certain times. |
protected boolean |
cached
|
protected java.lang.String |
classname
|
protected java.lang.String |
config_path
|
protected long |
last_availability_event_timestamp
The date/timestamp of when the last availability reporting event occurred. |
java.lang.String |
pattern
|
protected java.util.Properties |
props
|
protected java.lang.Object |
service
|
protected java.lang.Class |
theclass
|
protected java.lang.String |
unavailability_reason
If the service is either temporarily or permanently unavailable, we should have a reason for the unavailability that we can show to the client. |
protected int |
unavailable_seconds
We'll keep track of any waiting periods so that we can tell users what to expect. |
Constructor Summary | |
protected |
ServiceRoutingTable.ServiceEntry(java.lang.String pat,
java.lang.String cname,
java.lang.String c_path)
Creates a new ServiceEntry. |
Method Summary | |
int |
getAvailability()
Returns the availability status of this ServiceEntry's service. |
long |
getLastAvailabilityEventTimestamp()
Gets the timestamp of the last availability event. |
java.lang.Object |
getService()
Regardless of what the service Object is, use this method to get a reference to it. |
java.lang.String |
getUnavailabilityReason()
Returns the reason for the unavailability. |
int |
getUnavailableSeconds()
Gets the number of seconds that this ServiceEntry's service is unavailable for. |
protected abstract void |
initialize()
This needs to be overridden to instantiate and create the service. |
protected void |
load(Log server_log)
This will load the config path and create the class object. |
void |
setAvailability(int availability)
Sets the availability code for this ServiceEntry's service. |
void |
setLastAvailabilityEventTimestamp(long last_availability_event_timestamp)
Sets the timestamp of the last availability event. |
void |
setUnavailabilityReason(java.lang.String reason)
Sets the reason for the unavailability. |
void |
setUnavailableSeconds(int unavailable_seconds)
Sets the number of seconds that this ServiceEntry's service is unavailable for. |
abstract boolean |
shutdown(Log server_log)
This should also be overridden to call whatever cleanup/shutdown methods you need. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected boolean cached
public java.lang.String pattern
protected java.lang.String classname
protected java.lang.Class theclass
protected java.lang.String config_path
protected java.util.Properties props
protected java.lang.Object service
protected int availability
ServletFactory
protected int unavailable_seconds
protected java.lang.String unavailability_reason
protected long last_availability_event_timestamp
Constructor Detail |
protected ServiceRoutingTable.ServiceEntry(java.lang.String pat, java.lang.String cname, java.lang.String c_path)
pat
- the pattern to map the service tocname
- the service's class namec_path
- the path to the service's properties fileMethod Detail |
protected void load(Log server_log) throws InitializationException
protected abstract void initialize() throws InitializationException
public abstract boolean shutdown(Log server_log)
public int getUnavailableSeconds()
public void setUnavailableSeconds(int unavailable_seconds)
unavailable_seconds
- the amount of time during which
this ServiceEntry's servlets are unavailable.public int getAvailability()
public void setAvailability(int availability)
availability
- The new availability state, should be one
of the following: ServiceEntry.AVAILABLE,
ServiceEntry.UNAVAILABLE_AND_WAITING,
ServiceEntry.PERMANENTLY_UNAVAILABLE.
public java.lang.String getUnavailabilityReason()
public void setUnavailabilityReason(java.lang.String reason)
reason
- the text reason to use.public long getLastAvailabilityEventTimestamp()
public void setLastAvailabilityEventTimestamp(long last_availability_event_timestamp)
last_availability_event_timestamp
- the date/timestamp
when the ServiceRoutingTable last received a report
about service availability.public java.lang.Object getService()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |