|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sapia.ubik.mcast.EventChannel
public class EventChannel
An instance of this class represents a node in a given logical event channel. Instances of this class are logically grouped on a per-domain basis. Remote events are sent/dispatched to other instances of this class through the network.
A given EventChannel instance will only send/received events to/from other instances
of the same domain.
DomainName,
RemoteEvent| Nested Class Summary | |
|---|---|
static class |
EventChannel.ChannelEventListener
|
| Constructor Summary | |
|---|---|
EventChannel(java.lang.String domain,
java.lang.String mcastHost,
int mcastPort)
Constructor for EventChannel. |
|
EventChannel(java.lang.String domain,
java.lang.String mcastHost,
int mcastPort,
int unicastPort)
Constructor for EventChannel. |
|
| Method Summary | |
|---|---|
void |
addDiscoveryListener(DiscoveryListener listener)
Adds the given discovery listener to this instance. |
void |
close()
Closes this instance. |
boolean |
containsAsyncListener(AsyncEventListener listener)
|
boolean |
containsSyncListener(SyncEventListener listener)
|
void |
dispatch(boolean alldomains,
java.lang.String type,
java.lang.Object data)
|
void |
dispatch(ServerAddress addr,
java.lang.String type,
java.lang.Object data)
|
void |
dispatch(java.lang.String type,
java.lang.Object data)
Dispatches the given data to all nodes in this instance's domain. |
DomainName |
getDomainName()
Returns this instance's domain name. |
java.lang.String |
getMulticastHost()
Returns this instance's multicast address. |
int |
getMulticastPort()
Returns this instance's multicast port. |
java.lang.String |
getNode()
|
View |
getView()
Returns this instance's "view". |
boolean |
isClosed()
|
boolean |
isStarted()
|
void |
registerAsyncListener(java.lang.String type,
AsyncEventListener listener)
Registers a listener of asynchronous remote events of the given type. |
void |
registerSyncListener(java.lang.String type,
SyncEventListener listener)
Registers a listener of synchronous remote events of the given type. |
Response |
send(ServerAddress addr,
java.lang.String type,
java.lang.Object data)
Synchronously sends a remote event to the node corresponding to the given ServerAddress,
and returns the corresponding response. |
RespList |
send(java.lang.String type,
java.lang.Object data)
Synchronously sends a remote event to all the nodes corresponding to the given ServerAddress,
and returns the corresponding responses. |
void |
setBufsize(int size)
|
void |
start()
Starts this instances. |
void |
unregisterListener(AsyncEventListener listener)
Unregisters the given listener from this instance. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public EventChannel(java.lang.String domain,
java.lang.String mcastHost,
int mcastPort)
throws java.io.IOException
domain - the domain name of this instance.mcastHost - the multicast address that this instance will use to broadcast remote events.mcastPort - the multicast port that this instance will use to broadcast remote events.
java.io.IOExceptionDomainName
public EventChannel(java.lang.String domain,
java.lang.String mcastHost,
int mcastPort,
int unicastPort)
throws java.io.IOException
domain - the domain name of this instance.mcastHost - the multicast address that this instance will use to broadcast remote events.mcastPort - the multicast port that this instance will use to broadcast remote events.unicastPort - the port of the UDP server that this instance encapsulates, and that is
used for point-to-point communication.
java.io.IOExceptionDomainName| Method Detail |
|---|
public DomainName getDomainName()
DomainName.public java.lang.String getMulticastHost()
public int getMulticastPort()
public void start()
throws java.io.IOException
java.io.IOException - if an IO problem occurs starting this instance.public boolean isStarted()
true if the start() method was called on this instance.start()public void close()
public boolean isClosed()
true if the close() method was called on this instance.close()
public void dispatch(boolean alldomains,
java.lang.String type,
java.lang.Object data)
throws java.io.IOException
java.io.IOExceptionBroadcastDispatcher.dispatch(boolean, String, Object)
public void dispatch(ServerAddress addr,
java.lang.String type,
java.lang.Object data)
throws java.io.IOException
java.io.IOExceptionUnicastDispatcher.dispatch(ServerAddress, String, Object)
public void dispatch(java.lang.String type,
java.lang.Object data)
throws java.io.IOException
java.io.IOExceptionBroadcastDispatcher.dispatch(String, String, Object)public void addDiscoveryListener(DiscoveryListener listener)
listener - a DiscoveryListener.
public Response send(ServerAddress addr,
java.lang.String type,
java.lang.Object data)
throws java.io.IOException,
TimeoutException
ServerAddress,
and returns the corresponding response.
addr - the ServerAddress of the node to which to send the remote event.type - the "logical type" of the remote event.data - the data to encapsulate in the remote event.
Response corresponding to this call.
java.io.IOException
TimeoutExceptionRemoteEvent
public RespList send(java.lang.String type,
java.lang.Object data)
throws java.io.IOException
ServerAddress,
and returns the corresponding responses.
type - the "logical type" of the remote event.data - the data to encapsulate in the remote event.
java.io.IOExceptionRemoteEvent
public void registerAsyncListener(java.lang.String type,
AsyncEventListener listener)
type - the logical type of the remotee events to listen for.listener - an AsyncEventListener.
public void registerSyncListener(java.lang.String type,
SyncEventListener listener)
throws ListenerAlreadyRegisteredException
type - the logical type of the remotee events to listen for.listener - a SyncEventListener.
ListenerAlreadyRegisteredException - if a listener has already been
registered for the given event type.public void unregisterListener(AsyncEventListener listener)
listener - a ASyncEventListener.public View getView()
View.public boolean containsAsyncListener(AsyncEventListener listener)
EventConsumer.containsAsyncListener(AsyncEventListener)public boolean containsSyncListener(SyncEventListener listener)
EventConsumer.containsSyncListener(SyncEventListener)public void setBufsize(int size)
BroadcastDispatcher.setBufsize(int),
UnicastDispatcher.setBufsize(int)public java.lang.String getNode()
BroadcastDispatcher.getNode()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||