com.ibm.agletx.patterns
Class Notifier
java.lang.Object
|
+--com.ibm.aglet.Aglet
|
+--com.ibm.agletx.patterns.Notifier
- public abstract class Notifier
- extends Aglet
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.
- See Also:
- Serialized Form
|
Method Summary |
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. |
boolean |
handleMessage(Message msg)
Handles the message form outside. |
void |
onCreation(java.lang.Object object)
Initializes the notifier. |
| Methods inherited from class com.ibm.aglet.Aglet |
addCloneListener,
addMobilityListener,
addPersistencyListener,
clone,
deactivate,
dispatch,
dispatch,
dispatchEvent,
dispose,
exitMonitor,
getAgletContext,
getAgletID,
getAgletInfo,
getAudioData,
getCodeBase,
getImage,
getImage,
getMessageManager,
getProtections,
getProxy,
getText,
notifyAllMessages,
notifyMessage,
onDisposing,
removeCloneListener,
removeMobilityListener,
removePersistencyListener,
run,
setProtections,
setStub,
setText,
snapshot,
subscribeMessage,
suspend,
unsubscribeAllMessages,
unsubscribeMessage,
waitMessage,
waitMessage |
| Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
NOTIFICATION
public static final int NOTIFICATION
EXPIRY
public static final int EXPIRY
EXCEPTION
public static final int EXCEPTION
Notifier
public Notifier()
create
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
- Creates a notifier.
- Parameters:
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 argument
object.- Returns:
- an aglet proxy for the notifier.
- Throws:
- AgletException - if the creation fails.
onCreation
public void onCreation(java.lang.Object object)
- Initializes the notifier. Called only the first time this
notifier is created. The initialization argument includes
the needed parameters for the checks as defined
in
create
.
- Overrides:
- onCreation in class Aglet
- Parameters:
obj - the initialization argument.- Throws:
- AgletException - if the initialization fails.
handleMessage
public boolean handleMessage(Message msg)
- Description copied from class: Aglet
- Handles the message form outside.
- Overrides:
- handleMessage in class Aglet
- Tags copied from class: Aglet
- Parameters:
msg - the message sent to the aglet- Returns:
- true if the message was handled. Returns false if the message
was not handled. If false is returned, the MessageNotHandled exception
is thrown in the FutureReply.getReply and AgletProxy.sendMessage
methods.
- See Also:
FutureReply.getReply(),
Message.sendReply(java.lang.Object),
AgletProxy.sendMessage(com.ibm.aglet.Message)