com.ibm.aglet
Interface MessageManager


public interface MessageManager

The MessageManager controls concurrency of incomming message. Each kind of message can have a priority and will be placed in the message queue in accordance with its priority.

Version:
1.30 $Date: 2001/07/28 06:33:58 $
Author:
Mitsuru Oshima
See Also:
FutureReply, ReplySet

Field Summary
static int ACTIVATE_AGLET
          Used as a logical OR in the priority.
static int MAX_PRIORITY
          The maximum priority that the message can have.
static int MIN_PRIORITY
          The minimal priority that the message can have.
static int NORM_PRIORITY
          The default priority that is assigned to a message.
static int NOT_QUEUED
          Used as a argugment to the setPriority.
 
Method Summary
 void destroy()
          Destorys the manager.
 void exitMonitor()
          Exits the current monitor.
 void notifyAllMessages()
          Notifies all of waiting threads.
 void notifyMessage()
          Notifies a single waiting thread.
 void setPriority(java.lang.String kind, int priority)
          Sets the message's priority.
 void waitMessage()
          Waits until it is notified.
 void waitMessage(long timeout)
          Waits until it is notified or the timeout expires.
 

Field Detail

NOT_QUEUED

public static final int NOT_QUEUED
Used as a argugment to the setPriority. It indicates that messages which have the same kind will not be queued in the message queue and processed immediately.
See Also:
setPriority(java.lang.String, int)

ACTIVATE_AGLET

public static final int ACTIVATE_AGLET
Used as a logical OR in the priority. It indicates that receiving this kind of messages will automatically activate the aglet if it had been deactivated.
 getMessageManager().setPriority("wakeMeUp",
 NORM_PRIORITY | ACTIVATE_AGLET);
 
See Also:
setPriority(java.lang.String, int)

MIN_PRIORITY

public static final int MIN_PRIORITY
The minimal priority that the message can have.
See Also:
setPriority(java.lang.String, int)

NORM_PRIORITY

public static final int NORM_PRIORITY
The default priority that is assigned to a message.
See Also:
setPriority(java.lang.String, int)

MAX_PRIORITY

public static final int MAX_PRIORITY
The maximum priority that the message can have.
See Also:
setPriority(java.lang.String, int)
Method Detail

destroy

public void destroy()
Destorys the manager. After this calling, the message manager is no longer valid and all queued and incoming message will be denied.

exitMonitor

public void exitMonitor()
Exits the current monitor.
See Also:
Aglet.exitMonitor(), waitMessage, notifyMessage, notifyAllMessages

notifyAllMessages

public void notifyAllMessages()
Notifies all of waiting threads.
Throws:
IllegalMonitorStateException - If the current thread is not the owner of the monitor.
See Also:
Aglet.notifyAllMessages(), waitMessage, notifyMessage

notifyMessage

public void notifyMessage()
Notifies a single waiting thread.
Throws:
IllegalMonitorStateException - If the current thread is not the owner of the monitor.
See Also:
Aglet.notifyMessage(), waitMessage, notifyAllMessages

setPriority

public void setPriority(java.lang.String kind,
                        int priority)
Sets the message's priority.
Parameters:
kind - the kind to set a priority
priority - the priority

waitMessage

public void waitMessage()
Waits until it is notified.
Throws:
IllegalMonitorStateException - If the current thread is not the owner of the monitor.
See Also:
notifyMessage, notifyAllMessages

waitMessage

public void waitMessage(long timeout)
Waits until it is notified or the timeout expires.
Parameters:
timeout - the maximum time to wait in milliseconds.
Throws:
IllegalMonitorStateException - If the current thread is not the owner of the monitor.
See Also:
Aglet.waitMessage(), notifyMessage, notifyAllMessages