|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjgroup.relacs.gmi.protocols.BasicDispatcher
jgroup.relacs.gmi.protocols.Leadercast
public class Leadercast
Leadercast represents a protocol that will always try to invoke the the group leader first. The group leader will pass the servers post-invocation state to the other members of the group, if the invocation resulted in a state change. If a client tries to invoke a non-leader (follower) replica, that replica will forward the invocation to the leader, and will also mediate the result back to the client. In such failover scenarios, the client will invoke the leader directly on the next interaction.
Constructor Summary | |
---|---|
Leadercast(GroupInvocationDispatcher dispatcher,
MulticastService mcast,
MembershipService pgms)
|
Method Summary | |
---|---|
java.lang.Object |
deliverObject(java.lang.Object msg,
MemberId sender,
int seqNo)
Upcall that is invoked by Jgroup to deliver a message msg ,
corresponding to a single serialized object. |
java.lang.Object |
deliverStream(java.io.InputStream msg,
MemberId sender,
int seqNo)
Upcall that is invoked by Jgroup to deliver a message msg ,
corresponding to an input stream from which the message may be read. |
InvocationResult |
dispatch(java.io.InputStream in)
Handle inbound request to the local endpoint with leadercast invocation semantics. |
java.lang.String |
getProtocolName()
Returns a string naming the protocol implemented by this multicast listener. |
void |
setServer(java.lang.Object server)
Set the server object for use by the Leadercast protocol. |
Methods inherited from class jgroup.relacs.gmi.protocols.BasicDispatcher |
---|
getIdentifier |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Leadercast(GroupInvocationDispatcher dispatcher, MulticastService mcast, MembershipService pgms)
Method Detail |
---|
public InvocationResult dispatch(java.io.InputStream in) throws java.io.IOException
dispatch
in interface ProtocolDispatcher
dispatch
in class BasicDispatcher
in
- the method to invoke, encoded in the provided InputStream
.
java.io.IOException
- Raised if the method invocation read from the
InputStream
could not be executed for some reason.ProtocolDispatcher.dispatch(java.io.InputStream)
public void setServer(java.lang.Object server)
Leadercast
protocol.
This allows the leadercast protocol to obtain access to the StateListener
interface of the server. This overrides the empty implementation in
BasicDispatcher
.
If the provided server does not implement a StateListener
interface,
the call is ignored. This allows the server to use the leadercast protocol without
having its state (if any) passed to the followers.
setServer
in interface ProtocolDispatcher
setServer
in class BasicDispatcher
java.lang.IllegalStateException
- If the server has already been set. The method should not be called multiple times.ProtocolDispatcher.setServer(java.lang.Object)
public java.lang.String getProtocolName()
MulticastListener
getProtocolName
in interface MulticastListener
public java.lang.Object deliverStream(java.io.InputStream msg, MemberId sender, int seqNo)
MulticastListener
msg
,
corresponding to an input stream from which the message may be read.
deliverStream
in interface MulticastListener
msg
- the input stream from which the message can be read.sender
- the sender of the multicast messageseqNo
- the sequence number of this multicast message
public java.lang.Object deliverObject(java.lang.Object msg, MemberId sender, int seqNo)
MulticastListener
msg
,
corresponding to a single serialized object.
deliverObject
in interface MulticastListener
msg
- the object that was multicasted.sender
- the sender of the multicast messageseqNo
- the sequence number of this multicast message
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |