org.sapia.ubik.rmi.replication
Class ReplicatedCommand
java.lang.Object
org.sapia.ubik.rmi.server.command.Command
org.sapia.ubik.rmi.server.RMICommand
org.sapia.ubik.rmi.server.invocation.InvokeCommand
org.sapia.ubik.rmi.replication.ReplicatedCommand
- All Implemented Interfaces:
- java.io.Externalizable, java.io.Serializable, Executable
- Direct Known Subclasses:
- ReplicatedCommandEx
public abstract class ReplicatedCommand
- extends InvokeCommand
Wraps an InvokeCommand that is intented to be replicated to the different
servers in a domain or cluster.
- Author:
- Yanick Duchesne
- Copyright:
- Copyright © 2002-2004 Sapia Open Source Software. All Rights Reserved.
- License:
- Read the license.txt file of the jar or visit the
license page at the Sapia OSS web site
- See Also:
#getReplicationContext(),
Serialized Form
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ReplicatedCommand
public ReplicatedCommand()
- Do not call; used for externalization only.
ReplicatedCommand
public ReplicatedCommand(InvokeCommand cmd,
java.util.Set targets,
ReplicatedInvoker invoker,
boolean synchronous)
- Parameters:
cmd - the InvokeCommand to replicate.targets - the Set of ServerAddresses that are
targeted by the command. If null, then all siblings will be targeted.invoker - the ReplicatedInvoker implementation in charge of
performing replicated method invocations.
execute
public java.lang.Object execute()
throws java.lang.Throwable
- This method's implementation internally calls the
getReplicationContext()
method. The returned ReplicationContext is used as a hook to the server
in which this command is executed. Internally, the method selects the next server
to which this instance should be dispatched, and executes the command that this
instance wraps.
If the execution is successful, this instance is dispatched by means of the
ReplicationContext.
- Specified by:
execute in interface Executable- Overrides:
execute in class InvokeCommand
- Returns:
- any value returned by this method.
- Throws:
java.lang.Throwable - if an error occurs while executing this command- See Also:
#getReplicationContext(),
RMICommand.execute()
getReplicatedInvoker
public ReplicatedInvoker getReplicatedInvoker()
- Returns:
- the
ReplicatedInvoker that this instance holds.
disable
public void disable()
- Disables replication behavior (this command will execute as a normal
InvokeCommand).
readExternal
public void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
- Specified by:
readExternal in interface java.io.Externalizable- Overrides:
readExternal in class InvokeCommand
- Throws:
java.io.IOException
java.lang.ClassNotFoundException- See Also:
InvokeCommand.readExternal(java.io.ObjectInput)
writeExternal
public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
- Specified by:
writeExternal in interface java.io.Externalizable- Overrides:
writeExternal in class InvokeCommand
- Throws:
java.io.IOException- See Also:
InvokeCommand.writeExternal(java.io.ObjectOutput)
send
protected java.lang.Object send(ServerAddress next)
throws java.rmi.RemoteException
- This method synchronously or asynchronously sends this instance to the server
at the given address.
- Parameters:
next - the ServerAddress of the "next" server to which this
instance should be sent.
- Returns:
- the result of the invocation.
- Throws:
java.rmi.RemoteException - if a problem occurs sending this instance.
getVisitedAddresses
protected java.util.Set getVisitedAddresses()
getTargetAddresses
protected java.util.Set getTargetAddresses()
Copyright © 2010 Sapia OSS. All Rights Reserved.