|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.hivecell.hive.agent.EventSendingHelper
Helper class for EventSendingAgent interface; agent implementations
can delegate methods to this class.
This class maintains a list of listeners for events, as well as a
count of events it has sent. When broadcastEvent
is
called by the client, the EventSendingHelper delivers the message
to all current listeners. By default these messages are sent
asynchronously.
Please be careful if creating Hive objects to send by hand -- use
the getCount() method in this object to determine the value that
the count field in the HiveEvent constructor can use. This is not
the recommended way to send events -- it is preferred programmers
use the Object methods instead unless they need to send custom
HiveEvents
EventSendingAgent
,
AsyncSender
Field Summary | |
protected AgentImpl |
agent
Agent we're helping |
protected AgentMessagingShadow |
agentMessagingShadow
The hook to the AgentMessagingShadow |
protected java.util.Hashtable |
agentsToEventMaskWrappers
|
protected Cell |
myCell
Cell we're on |
protected Agent |
remoteAgent
The remote reference to the agent we are helping |
Constructor Summary | |
EventSendingHelper(AgentImpl agentHelped,
Cell server)
Construct a helper for an event sending agent to delegate to. |
Method Summary | |
void |
addListener(EventReceivingAgent newListener)
Add a listener to the list. |
void |
addListener(EventReceivingAgent newListener,
long eventMask)
Add a listener to ourselves, but only send them events that correspond to a certain event mask |
void |
asyncFinished(AsyncResult ar)
Used for async error listening |
void |
broadcastEvent(HiveEvent he)
|
void |
broadcastEvent(HiveEvent he,
long eventMask)
|
void |
broadcastEvent(java.lang.Object data)
|
void |
broadcastEvent(java.lang.Object data,
long eventMask)
|
void |
broadcastEventTo(HiveEvent he,
EventReceivingAgent agent)
|
void |
broadcastEventTo(HiveEvent he,
EventReceivingAgent[] agents,
EventMaskWrapper[] masks)
|
void |
broadcastEventTo(HiveEvent he,
long eventMask,
EventReceivingAgent[] agents,
EventMaskWrapper[] masks)
|
void |
broadcastEventTo(java.lang.Object data,
EventReceivingAgent agent)
|
void |
broadcastEventTo(java.lang.Object data,
EventReceivingAgent[] agents,
EventMaskWrapper[] masks)
|
void |
broadcastEventTo(java.lang.Object data,
long eventMask,
EventReceivingAgent[] agents,
EventMaskWrapper[] masks)
|
int |
getEventCount(Agent sender)
Get a count of how many events have fired. |
java.util.Vector |
getListeners()
return a list of the agents which are subscribed to us -- we just return a vector of agents that are the keys toe the agentToEventMaskWrappers. |
EventReceivingAgent[] |
getLocalListeners()
return a list of all the listeners which are local to this agent |
void |
removeListener(EventReceivingAgent sender)
Remove a listener from the event queue. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected AgentImpl agent
protected Agent remoteAgent
protected Cell myCell
protected AgentMessagingShadow agentMessagingShadow
protected java.util.Hashtable agentsToEventMaskWrappers
Constructor Detail |
public EventSendingHelper(AgentImpl agentHelped, Cell server)
agentHelped
- The agent to be helped.server
- The Cell we're on.Method Detail |
public java.util.Vector getListeners()
public EventReceivingAgent[] getLocalListeners()
public void addListener(EventReceivingAgent newListener)
newListener
- the listener that we want to be subscribed to uspublic void addListener(EventReceivingAgent newListener, long eventMask)
newListener
- the listener that we want subscribed to useventMask
- the event mask that we are subscribing this agent withpublic void removeListener(EventReceivingAgent sender)
sender
- the agent that we want removed from our subscriber listspublic int getEventCount(Agent sender)
agent
- the agent asking for this informationpublic void broadcastEvent(java.lang.Object data)
public void broadcastEvent(java.lang.Object data, long eventMask)
public void broadcastEvent(HiveEvent he)
public void broadcastEvent(HiveEvent he, long eventMask)
public void broadcastEventTo(java.lang.Object data, EventReceivingAgent agent)
public void broadcastEventTo(HiveEvent he, EventReceivingAgent agent)
public void broadcastEventTo(java.lang.Object data, EventReceivingAgent[] agents, EventMaskWrapper[] masks)
public void broadcastEventTo(java.lang.Object data, long eventMask, EventReceivingAgent[] agents, EventMaskWrapper[] masks)
public void broadcastEventTo(HiveEvent he, EventReceivingAgent[] agents, EventMaskWrapper[] masks)
public void broadcastEventTo(HiveEvent he, long eventMask, EventReceivingAgent[] agents, EventMaskWrapper[] masks)
public void asyncFinished(AsyncResult ar)
ar
- the async result that we get spit back to us after our async call has completed
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |