|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.sun.jini.example.basic.ex1.activation.AbstractDeactivator
An abstract class which provides the framework for the behavior required of a concrete object that wishes to enable an activatable object to become inactive. When the required concrete extension to this class is implemented, that implementation must provide a definition of the criteria for deactivating the activatable object.
An activatable object that desires the ability to become inactive must instantiate this class' concrete sub-class in its constructor.
| Method Summary | |
protected boolean |
deactivateObject(java.rmi.activation.ActivationID activationID)
This method will attempt to change the state of the object from active to inactive. |
protected abstract void |
decreaseBusyMetric()
This method 'decrements' the measure of how 'busy' an activatable object is. |
protected abstract void |
handleException(java.lang.Exception e)
This method handles any Exception in a manner that is appropriate for the operational environment of the object that wishes to be deactivated. |
abstract void |
increaseBusyMetric()
This method 'increments' the measure of how 'busy' an activatable object is. |
protected abstract boolean |
objectIsBusy()
This method measures how 'busy' the activatable object is and returns true if it is too busy to be deactivated; otherwise it returns false indicating deactivation may be safely attempted. |
protected abstract boolean |
objectIsIdle()
This method returns an indication of whether or not the object that wishes to be deactivated has entered a state in which it is appropriate to begin deactivation attempts. |
protected void |
waitBeforeDeactivation()
This method will wait an amount of time before returning. |
protected void |
wakeDeactivatorThread()
This method will wake this class' DeactivatorThread from its wait state. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public abstract void increaseBusyMetric()
Although the definition of the measure of an object's 'busy-ness', as well as the method by which that measure is updated, are left to be defined by the concrete implementation of this method, invoking this method should always result in an increase in that measure in some manner that is meaningful for the activatable object.
Requirement: for any activatable object that employs this class to become inactive, every remote method of that object must invoke this method so as to increase the measure of how 'busy' the object is.
protected abstract void decreaseBusyMetric()
Although the definition of the measure of an object's 'busy-ness', as well as the method by which that measure is updated, are left for the concrete implementation of this method, invoking this method should always result in a decrease in that measure in some manner that is meaningful for the activatable object.
This method is only invoked by the DeactivatorThread inner class defined in this class.
protected abstract boolean objectIsIdle()
This method is used to avoid attempting deactivation before the Activation System has had a chance to complete its activation of the object. Deactivation cannot safely occur if a previously inactive object is in the process of being activated.
protected abstract boolean objectIsBusy()
This method is used to determine when to attempt deactivation. The concrete implementation must define a measure of busy-ness as well as a criteria for deactivation that is appropriate for the needs of the object wishing to be deactivated.
protected abstract void handleException(java.lang.Exception e)
This abstract method allows the concrete implementation of this class to define how an Exception should be handled. Since some objects will have access to a display screen, and some will not, it is important that this class make no assumptions about the mechanism an object will use to deal with such exceptions. Some implementations may decide to log the exception to a screen or to a file, some may ignore the exception, still others may handle the exception in manner that is unique to the application.
protected void waitBeforeDeactivation()
If it is desirable to change the delay mechanism employed by this class, or to perform any processing in addition to the delay, then this method should be overridden by the concrete implementation of this class.
protected void wakeDeactivatorThread()
Requirement: for every concrete implementation of this class, the implementation of the method increaseBusyMetric is required to invoke this method after the busy metric has been increased.
Requirement: if the concrete implementation of this class overrides this method, the overriding implementation is required to invoke super.wakeDeactivatorThread after any preprocessing is performed.
protected boolean deactivateObject(java.rmi.activation.ActivationID activationID)
throws java.rmi.RemoteException,
java.rmi.activation.ActivationException,
java.rmi.activation.UnknownObjectException
Requirement: if the concrete implementation of this class overrides this method, the overriding implementation is required to invoke super.deactivateObject after any preprocessing is performed.
activationID - id needed to deactivate the activatable object
java.rmi.RemoteException
java.rmi.activation.ActivationException
java.rmi.activation.UnknownObjectException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||