Save This Page
Home » openjdk-7 » net.hivecell » hive » agent » [javadoc | source]
net.hivecell.hive.agent
public class: EventSendingHelper [javadoc | source]
java.lang.Object
   net.hivecell.hive.agent.EventSendingHelper

All Implemented Interfaces:
    AsyncResultListener

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
Field Summary
protected  AgentImpl agent    Agent we're helping 
protected  Agent remoteAgent    The remote reference to the agent we are helping 
protected  Cell myCell    Cell we're on 
protected  AgentMessagingShadow agentMessagingShadow    The hook to the AgentMessagingShadow 
protected  Hashtable agentsToEventMaskWrappers     
Constructor:
 public EventSendingHelper(AgentImpl agentHelped,
    Cell server) 
    Construct a helper for an event sending agent to delegate to.
    Parameters:
    agentHelped - The agent to be helped.
    server - The Cell we're on.
Method from net.hivecell.hive.agent.EventSendingHelper Summary:
addListener,   addListener,   asyncFinished,   broadcastEvent,   broadcastEvent,   broadcastEvent,   broadcastEvent,   broadcastEventTo,   broadcastEventTo,   broadcastEventTo,   broadcastEventTo,   broadcastEventTo,   broadcastEventTo,   getEventCount,   getListeners,   getLocalListeners,   removeListener
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from net.hivecell.hive.agent.EventSendingHelper Detail:
 public  void addListener(EventReceivingAgent newListener) 
    Add a listener to the list. EventSendingAgents can delegate to this method to us.
 public  void addListener(EventReceivingAgent newListener,
    long eventMask) 
    Add a listener to ourselves, but only send them events that correspond to a certain event mask
 public  void asyncFinished(AsyncResult ar) 
    Used for async error listening
 public  void broadcastEvent(Object data) 
 public  void broadcastEvent(HiveEvent he) 
 public  void broadcastEvent(Object data,
    long eventMask) 
 public  void broadcastEvent(HiveEvent he,
    long eventMask) 
 public  void broadcastEventTo(Object data,
    EventReceivingAgent agent) 
 public  void broadcastEventTo(HiveEvent he,
    EventReceivingAgent agent) 
 public  void broadcastEventTo(Object data,
    EventReceivingAgent[] agents,
    EventMaskWrapper[] masks) 
 public  void broadcastEventTo(HiveEvent he,
    EventReceivingAgent[] agents,
    EventMaskWrapper[] masks) 
 public  void broadcastEventTo(Object data,
    long eventMask,
    EventReceivingAgent[] agents,
    EventMaskWrapper[] masks) 
 public  void broadcastEventTo(HiveEvent he,
    long eventMask,
    EventReceivingAgent[] agents,
    EventMaskWrapper[] masks) 
 public int getEventCount(Agent sender) 
    Get a count of how many events have fired. EventSendingAgents can delegate to this method to us. This is not guaranteed to be an exact count -- only that the count is increasing.
 public 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. i want this to eventually be an array!!!!
 public EventReceivingAgent[] getLocalListeners() 
    return a list of all the listeners which are local to this agent
 public  void removeListener(EventReceivingAgent sender) 
    Remove a listener from the event queue. EventSendingAgents can delegate to this method to us