|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.ibm.aglet.Aglet
com.ibm.agletx.patterns.Notifier
Create a notifier by calling the static method create. The notifier will get dispatched automatically. The notifier performs successive checks (at its destination) within a specified time duration. Upon every successfull check (one the encounters a change in a local state), it notifies its master. The notifier can be defined (see
create) to complete its job after the first successive check (although its time duration has not been reached yet). If a notifier cannot be dispatched or it encounters an error during a check, it notifies its master and disposed itself.
| Field Summary | |
private java.lang.String |
_destination
|
private double |
_duration
|
private double |
_interval
|
private AgletID |
_master
|
private long |
_startingTime
|
private boolean |
_stay
|
protected java.lang.Object |
ARGUMENT
The protected variable that carries any arguments for the checks that this notifier performs. |
static int |
EXCEPTION
|
static int |
EXPIRY
|
protected java.lang.Object |
MESSAGE
The protected variable that carries any messages that should go along with the notification back to the subscriber. |
private static double |
MIN_TIME_OF_DEACTIVATION
|
static int |
NOTIFICATION
|
private java.lang.String |
origin
|
| Fields inherited from class com.ibm.aglet.Aglet |
ACTIVE, INACTIVE, MAJOR_VERSION, MINOR_VERSION |
| Constructor Summary | |
Notifier()
|
|
| Method Summary | |
private boolean |
checkTimeout()
|
static AgletProxy |
create(java.net.URL url,
java.lang.String source,
AgletContext context,
Aglet master,
java.net.URL destination,
double interval,
double duration,
boolean stay,
java.lang.Object argument)
Creates a notifier. |
protected abstract boolean |
doCheck()
This method should be overridden to specify the check method for this notifier. |
private void |
gotoSleep(double hours)
|
boolean |
handleMessage(Message msg)
Handles the message form outside. |
protected abstract void |
initializeCheck()
This method should be overridden to specify any intialization before the checks performed by this notifier. |
private java.lang.String |
makeExceptionMessage(java.lang.String phase,
java.lang.Throwable ex)
|
private void |
observeInit()
|
private void |
observeRun()
|
void |
onCreation(java.lang.Object object)
Initializes the notifier. |
private void |
sendRemoteMessage(int type,
java.lang.Object data)
|
private void |
start()
|
private void |
startTimer()
|
private void |
waitInHours(double h)
|
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int NOTIFICATION
public static final int EXPIRY
public static final int EXCEPTION
private static final double MIN_TIME_OF_DEACTIVATION
private java.lang.String origin
private AgletID _master
private java.lang.String _destination
private double _interval
private double _duration
private long _startingTime
private boolean _stay
protected java.lang.Object MESSAGE
protected java.lang.Object ARGUMENT
| Constructor Detail |
public Notifier()
| Method Detail |
private boolean checkTimeout()
public static AgletProxy create(java.net.URL url,
java.lang.String source,
AgletContext context,
Aglet master,
java.net.URL destination,
double interval,
double duration,
boolean stay,
java.lang.Object argument)
throws java.io.IOException,
AgletException
url - the URL of the aglet class.source - the name of the aglet class.context - the aglet context in which the notifier should be created.master - the master aglet.destination - the URL of the destination.interval - the time in hours between to checks.duration - the life time of the notifier.stay - whether the notifier should remain after a notification.argument - the argumentobject.
AgletException - if the creation fails.
java.io.IOException
protected abstract boolean doCheck()
throws java.lang.Exception
AgletException - if fails to complete.
java.lang.Exception
private void gotoSleep(double hours)
throws AgletException
AgletExceptionpublic boolean handleMessage(Message msg)
Aglet
handleMessage in class AgletFutureReply.getReply(),
Message.sendReply(),
AgletProxy.sendMessage(com.ibm.aglet.Message)
protected abstract void initializeCheck()
throws java.lang.Exception
AgletException - if fails to complete.
java.lang.Exception
private java.lang.String makeExceptionMessage(java.lang.String phase,
java.lang.Throwable ex)
private void observeInit()
throws java.lang.Exception
java.lang.Exception
private void observeRun()
throws java.lang.Exception
java.lang.Exceptionpublic void onCreation(java.lang.Object object)
create.
onCreation in class Agletobject - the argument with which the aglet is initialized.
AgletException - if the initialization fails.AgletContext.createAglet(java.net.URL, java.lang.String, java.lang.Object)
private void sendRemoteMessage(int type,
java.lang.Object data)
throws java.io.IOException,
AgletException
java.io.IOException
AgletExceptionprivate void start()
private void startTimer()
private void waitInHours(double h)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||