|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.javagroups.blocks.DistributedQueue
Provides the abstraction of a java.util.LinkedList that is replicated at several locations. Any change to the list (reset, add, remove etc) will transparently be propagated to all replicas in the group. All read-only methods will always access the local replica.
Both keys and values added to the list must be serializable, the reason being that they will be sent across the network to all replicas of the group. An instance of this class will contact an existing member of the group to fetch its initial state. Beware to use a total protocol on initialization or elements would not be in same order on all replicas.
Nested Class Summary | |
static interface |
DistributedQueue.Notification
|
Constructor Summary | |
DistributedQueue(JChannel channel)
|
|
DistributedQueue(java.lang.String groupname,
ChannelFactory factory,
java.lang.String properties,
long state_timeout)
Creates a DistributedQueue |
Method Summary | |
void |
_add(java.lang.Object value)
|
void |
_addAll(java.util.Collection c)
|
void |
_addAtHead(java.lang.Object value)
|
protected void |
_private_reset()
|
java.lang.Object |
_remove()
|
void |
_reset()
|
void |
add(java.lang.Object value)
Add the speficied element at the bottom of the queue |
void |
addAll(java.util.Collection values)
Add the speficied collection to the top of the queue. |
void |
addAtHead(java.lang.Object value)
Add the speficied element at the top of the queue |
void |
addNotifier(DistributedQueue.Notification n)
|
void |
block()
Block sending and receiving of messages until ViewAccepted is called |
protected void |
checkResult(RspList rsp,
java.lang.Object retval)
|
Channel |
getChannel()
|
java.util.Vector |
getContents()
|
Address |
getLocalAddress()
|
byte[] |
getState()
|
protected void |
init()
|
static void |
main(java.lang.String[] args)
|
java.lang.Object |
peek()
returns the first object on the queue, without removing it. |
void |
receive(Message msg)
|
java.lang.Object |
remove()
|
java.lang.Object |
remove(long timeout)
|
void |
reset()
|
void |
setState(byte[] new_state)
|
int |
size()
|
void |
start(long state_timeout)
|
void |
stop()
|
void |
suspect(Address suspected_mbr)
Called when a member is suspected |
java.lang.String |
toString()
|
void |
viewAccepted(View new_view)
Called by JavaGroups to notify the target object of a change of membership. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public DistributedQueue(java.lang.String groupname, ChannelFactory factory, java.lang.String properties, long state_timeout)
groupname
- The name of the group to joinfactory
- The ChannelFactory which will be used to create a channelproperties
- The property string to be used to define the channelstate_timeout
- The time to wait until state is retrieved in milliseconds. A value of 0 means wait forever.public DistributedQueue(JChannel channel) throws ChannelNotConnectedException, ChannelClosedException
Method Detail |
protected void init() throws ChannelClosedException, ChannelNotConnectedException
ChannelClosedException
ChannelNotConnectedException
public void start(long state_timeout) throws ChannelClosedException, ChannelNotConnectedException
ChannelClosedException
ChannelNotConnectedException
public Address getLocalAddress()
public Channel getChannel()
public void addNotifier(DistributedQueue.Notification n)
public void stop()
public void add(java.lang.Object value)
value
- public void addAtHead(java.lang.Object value)
value
- public void addAll(java.util.Collection values)
values
- public java.util.Vector getContents()
public int size()
public java.lang.Object peek()
public void reset()
protected void checkResult(RspList rsp, java.lang.Object retval)
public java.lang.Object remove()
public java.lang.Object remove(long timeout)
public java.lang.String toString()
public void _add(java.lang.Object value)
public void _addAtHead(java.lang.Object value)
public void _reset()
protected void _private_reset()
public java.lang.Object _remove()
public void _addAll(java.util.Collection c)
public void receive(Message msg)
receive
in interface MessageListener
public byte[] getState()
getState
in interface MessageListener
public void setState(byte[] new_state)
setState
in interface MessageListener
public void viewAccepted(View new_view)
MembershipListener
../Tests/QuoteServer.java
).
viewAccepted
in interface MembershipListener
public void suspect(Address suspected_mbr)
suspect
in interface MembershipListener
public void block()
block
in interface MembershipListener
public static void main(java.lang.String[] args)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |