public class DVDRPDispatcher extends HierarchicalDispatcher implements Siena, java.lang.Runnable
HierarchicalDispatcher
). A DVDRPDispatcher
can serve as a Siena event service for local (same Java VM) clients as well
as remote clients. A DVDRPDispatcher
s can also be combined in a
distributed architecture with other dispatchers. Every dispatcher can be
connected to a neighbor dispatcher, thereby forming a generic
network topology. The network of dispatchers is assembled incrementally and
can be modified by issuing configuration requests to a dispatcher.
A DVDRPDispatcher
uses a PacketReceiver
to receive
notifications, subscriptions and unsubscriptions from external clients and
from its neighbor dispatcher. In order to receive and process
external requests, a DVDRPDispatcher
can either use a pool of
internal threads, or it can use users' threads. See
HierarchicalDispatcher.DefaultThreadCount
, setReceiver(PacketReceiver)
, and
setReceiver(PacketReceiver, int)
Siena
,
ThinClient
Modifier and Type | Field and Description |
---|---|
int |
chokePeriod |
static long |
DEFAULT_DVDISPATCH_PERIOD |
static int |
DEFAULT_MAX_COST |
static int |
DEFAULT_TTL_FOR_RECOVERY |
static int |
DEFAULT_TTL_FOR_UDV |
static int |
DEFAULT_WAIT_FOR_REROUTE |
protected DistanceVector |
distanceVector |
long |
dvDispatchPeriod |
protected DistanceVector |
fwTable |
protected DVHeartbeat |
heartbeat |
protected PredicatesTable |
predFwTable |
protected PredicatesTable |
predicates |
java.lang.Object |
predicatesFWDLock |
java.lang.Object |
predicatesUpdateLock |
protected java.util.Timer |
timer |
protected DistanceVector |
updatedDV |
protected PredicatesTable |
updatedPredicates |
cleanup_max_r, cleanup_max_t, cleanup_rounds, cleanup_time, contacts, DefaultThreadCount, ifmanager, listener, master, master_interface, matchers, MaxFailedConnectionsDuration, MaxFailedConnectionsNumber, my_identity, sff, sffTable, sndbuf, spkt, storeFileName, subscriptions, subscriptionsMap
Constructor and Description |
---|
DVDRPDispatcher() |
DVDRPDispatcher(java.lang.String id) |
Modifier and Type | Method and Description |
---|---|
void |
cleanUpDVEntry(byte[] destId) |
protected void |
configure(siena.SENPPacket req) |
void |
doDiscovery() |
protected void |
handleDRP(siena.SENPPacket req)
This method is invoked each time a DRP request is received.
|
protected void |
handlePAD(siena.SENPPacket req) |
protected void |
handleUDV(siena.SENPPacket req) |
protected void |
partitionRecipients(siena.SENPPacket req)
Partitions the list of recipients of a DRP package and forwards the
package accordingly.
|
protected void |
partitionRecipientsAnyCast(siena.SENPPacket req)
Partitions the list of recipients of a DRP package and forwards the
package accordingly.
|
protected void |
processRequest(siena.SENPPacket req) |
protected void |
publish(siena.SENPPacket req) |
void |
queueDistanceVector(byte[] destination,
int priority)
Adds a package addressed to a subscriber containing the whole local
distance vector to the queue of outgoing DV packages consumed by
DispatcherThread . |
void |
recomputeLocalPredicates() |
void |
rerouteDRPPacket(siena.SENPPacket req) |
void |
setChoke(int chokePeriod) |
void |
setHeartbeat(long heartbeat) |
void |
setReceiver(PacketReceiver r)
sets the packet receiver for this server.
|
void |
setReceiver(PacketReceiver r,
int threads)
sets the packet receiver for this server.
|
void |
shutdown()
Stops the server instance
|
void |
startHeartbeat() |
protected void |
subscribe(Filter f,
siena.Subscriber s,
siena.SENPPacket req) |
protected void |
subscribe(siena.SENPPacket req) |
protected void |
unsubscribe(Filter f,
siena.Subscriber s,
siena.SENPPacket req) |
protected void |
updateDistanceVector(DistanceVector update)
This method is invoked by a single thread 'DVHeartbeat.chocke' seconds
after an update to the network topology
|
protected void |
updatePredicates(PredicatesTable update)
This method is invoked by a single thread 'DVHeartbeat.choke' seconds
after an update to the predicates in the network (including local)
|
advertise, clearSubscriptions, getIdentity, getMaster, getReceiver, initStore, loadSubscriptions, map_subscriber, map, processOneRequest, publish, resume, resume, resumeMaster, run, saveSubscriptions, setDefaultPacketSenderFactory, setMaster, setPacketSenderFactory, setStoreRefreshCounter, setStoreRefreshTimeout, subscribe, subscribe, suspend, suspend, suspendMaster, unadvertise, unadvertise, unsubscribe, unsubscribe, unsubscribe, unsubscribe, updateFWTable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
advertise, publish, resume, subscribe, subscribe, suspend, unadvertise, unadvertise, unsubscribe, unsubscribe, unsubscribe
public static int DEFAULT_WAIT_FOR_REROUTE
public static int DEFAULT_TTL_FOR_UDV
public static int DEFAULT_TTL_FOR_RECOVERY
public static int DEFAULT_MAX_COST
public static long DEFAULT_DVDISPATCH_PERIOD
public long dvDispatchPeriod
public int chokePeriod
protected DistanceVector distanceVector
protected DistanceVector updatedDV
protected PredicatesTable predicates
protected PredicatesTable updatedPredicates
protected DistanceVector fwTable
protected PredicatesTable predFwTable
protected java.util.Timer timer
public java.lang.Object predicatesUpdateLock
public java.lang.Object predicatesFWDLock
protected DVHeartbeat heartbeat
public DVDRPDispatcher()
public DVDRPDispatcher(java.lang.String id)
public void startHeartbeat()
startHeartbeat
in class HierarchicalDispatcher
public void doDiscovery()
protected void processRequest(siena.SENPPacket req)
processRequest
in class HierarchicalDispatcher
protected void handleUDV(siena.SENPPacket req)
req
- protected void updateDistanceVector(DistanceVector update)
protected void updatePredicates(PredicatesTable update)
protected void handlePAD(siena.SENPPacket req)
public void shutdown()
shutdown
in interface Siena
shutdown
in class HierarchicalDispatcher
HierarchicalDispatcher.setReceiver(PacketReceiver)
,
HierarchicalDispatcher.setMaster(String)
public void queueDistanceVector(byte[] destination, int priority)
DispatcherThread
.destination
- the Subscriber to which the DV will be sentpriority
- the priority of the message in the queue (1 high, 2 low)DispatcherThread
public void rerouteDRPPacket(siena.SENPPacket req)
protected void publish(siena.SENPPacket req)
publish
in class HierarchicalDispatcher
protected void handleDRP(siena.SENPPacket req)
req
- the DRP request *SENPPacket
protected void partitionRecipients(siena.SENPPacket req)
req
- the DRP package whose recipients have to be partitionedSENPPacket
protected void partitionRecipientsAnyCast(siena.SENPPacket req)
req
- the DRP package whose recipients have to be partitionedSENPPacket
protected void configure(siena.SENPPacket req)
configure
in class HierarchicalDispatcher
protected void unsubscribe(Filter f, siena.Subscriber s, siena.SENPPacket req)
unsubscribe
in class HierarchicalDispatcher
public void recomputeLocalPredicates()
protected void subscribe(Filter f, siena.Subscriber s, siena.SENPPacket req) throws SienaException
subscribe
in class HierarchicalDispatcher
SienaException
public void cleanUpDVEntry(byte[] destId)
public void setHeartbeat(long heartbeat)
public void setChoke(int chokePeriod)
setChoke
in class HierarchicalDispatcher
public void setReceiver(PacketReceiver r, int threads)
HierarchicalDispatcher
setReceiver
will shut down any previously activated receiver for this dispatcher.
This method does not guarantee a transactional switch to a new receiver.
This means that some requests might get lost while the server has closed
the old port and before it reopens the new port.setReceiver
in class HierarchicalDispatcher
r
- the packet receiverthreads
- is the number of threads associated with the receiver, and
therefore to the whole server. A positive value causes this
dispatcher to create threads. A value of 0 causes the
dispatcher not to create any thread, In this case, the
application must explicitly call HierarchicalDispatcher.processOneRequest()
.HierarchicalDispatcher.shutdown()
,
HierarchicalDispatcher.setMaster(String)
public void setReceiver(PacketReceiver r)
HierarchicalDispatcher
setReceiver
will shut down any previously activated receiver for this dispatcher.
This method does not guarantee a transactional switch to a new receiver.
This means that some requests might get lost while the server has closed
the old port and before it reopens the new port.
This method simply calls HierarchicalDispatcher.setReceiver(PacketReceiver, int)
using
HierarchicalDispatcher.DefaultThreadCount
as a default value.
setReceiver
in class HierarchicalDispatcher
r
- is the receiverHierarchicalDispatcher.shutdown()
,
HierarchicalDispatcher.setReceiver(PacketReceiver, int)
protected void subscribe(siena.SENPPacket req) throws InvalidSenderException, SienaException
subscribe
in class HierarchicalDispatcher
InvalidSenderException
SienaException
Copyright © 2005-2011 Antonio Carzaniga.
This documentation is maintained by Antonio Carzaniga