org.javagroups.protocols
Class PARTITIONER
java.lang.Object
|
+--org.javagroups.stack.Protocol
|
+--org.javagroups.protocols.PARTITIONER
- public class PARTITIONER
- extends Protocol
This layer can be put on top of the bottommost layer and is useful to simulate partitions.
It simply adds a header with its partition number and discards Messages with other partition numbers.
If it receives an Event of type Event.SET_PARTITIONS it sends a Header of type COMMAND with the Hashtable
contained in the Event argument to set the partitions of ALL processes (not just processes of the current view but
every process with the same group address that receives the message.
Inner Class Summary |
static class |
PARTITIONER.PartitionerHeader
The Partitioner header normally (type = NORMAL) contains just the partition number that is checked to discard messages
received from other partitions. |
Fields inherited from class org.javagroups.stack.Protocol |
down_handler, down_prot, down_queue, down_thread, observer, props, stack, up_handler, up_prot, up_queue, up_thread |
Method Summary |
void |
down(Event evt)
Adds to Messages a Header with the local partitin number and if receives a SET_PARTITIONS Event sends
a new Message with a PartitionerHeader set to COMMAND that carries the Hashtable |
java.lang.String |
getName()
All protocol names have to be unique ! |
void |
reset()
Just remove if you don't need to reset any state |
boolean |
setProperties(java.util.Properties props)
Configures the protocol initially. |
void |
up(Event evt)
Discards Messages with the wrong partition number and sets local partition number if
it receives a COMMAND Header |
Methods inherited from class org.javagroups.stack.Protocol |
getDownProtocol, getDownQueue, getProperties, getUpProtocol, getUpQueue, init, passDown, passUp, providedDownServices, providedUpServices, receiveDownEvent, receiveUpEvent, requiredDownServices, requiredUpServices, setDownProtocol, setObserver, setPropertiesInternal, setProtocolStack, setUpProtocol, startDownHandler, startUpHandler, stopInternal |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PARTITIONER
public PARTITIONER()
getName
public java.lang.String getName()
- All protocol names have to be unique !
- Overrides:
getName
in class Protocol
setProperties
public boolean setProperties(java.util.Properties props)
- Description copied from class:
Protocol
- Configures the protocol initially. A configuration string consists of name=value
items, separated by a ';' (semicolon), e.g.:
"loopback=false;unicast_inport=4444"
- Overrides:
setProperties
in class Protocol
reset
public void reset()
- Just remove if you don't need to reset any state
up
public void up(Event evt)
- Discards Messages with the wrong partition number and sets local partition number if
it receives a COMMAND Header
- Overrides:
up
in class Protocol
down
public void down(Event evt)
- Adds to Messages a Header with the local partitin number and if receives a SET_PARTITIONS Event sends
a new Message with a PartitionerHeader set to COMMAND that carries the Hashtable
- Overrides:
down
in class Protocol
Copyright © 2001,2002 www.javagroups.com . All Rights Reserved.