|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.ha.framework.server.HATarget
public class HATarget
Control point representing a clustered service. Works with the
DistributedReplicantManager
to makes available a
list of replicants
(objects used to identify remote
service endpoints around the cluster) for the service. Guards access to the
service via the invocationsAllowed()
and
setInvocationsAuthorization(int)
methods.
Revisions:
2002/01/13: Bill Burke
Field Summary | |
---|---|
protected int |
allowInvocationsStatus
|
protected int |
clusterViewId
|
static int |
DISABLE_INVOCATIONS
Argument to setInvocationsAuthorization(int) that indicates
invocationsAllowed() should return false . |
static int |
ENABLE_INVOCATIONS
Argument to setInvocationsAuthorization(int) that indicates
invocationsAllowed() should return true . |
protected CountDownLatch |
latch
|
protected org.jboss.logging.Logger |
log
|
static int |
MAKE_INVOCATIONS_WAIT
Argument to setInvocationsAuthorization(int) that indicates
calls to invocationsAllowed() should block until a different
value is passed to setInvocationsAuthorization(int) . |
protected HAPartition |
partition
|
protected String |
replicantName
|
protected ArrayList |
replicants
|
protected Serializable |
target
|
Constructor Summary | |
---|---|
HATarget(HAPartition partition,
String replicantName,
Serializable target,
int allowInvocations)
Creates a new HATarget. |
Method Summary | |
---|---|
protected void |
cleanExistenceInCurrentHAPartition()
Unregister's with the partition's DistributedReplicantManager . |
void |
destroy()
Removes the local node from the distributed registry of nodes providing the service and causes invocationsAllowed() to return
false . |
void |
disable()
Removes the local node from the distributed registry of nodes providing the service. |
HAPartition |
getAssociatedPartition()
|
long |
getCurrentViewId()
Gets the current view id
for the clustered service. |
ArrayList |
getReplicants()
Gets the replicants for the clustered service. |
protected void |
init()
Deprecated. this will be removed in the next major release |
boolean |
invocationsAllowed()
Returns whether invocations on the target service are currently allowed on this node. |
protected void |
releaseCurrentLatch()
Releases any latch blocking threads in invocationsAllowed() . |
void |
replicantsChanged(String key,
List newReplicants,
int newReplicantsViewId,
boolean merge)
Callback called when the content/list of replicant for a given replicant key has changed |
void |
setInvocationsAuthorization(int status)
Sets the behavior expected from invocationsAllowed() . |
String |
toString()
|
protected void |
updateHAPartition(HAPartition partition)
Associates this target with the given partition, registering with the partition's DistributedReplicantManager . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int DISABLE_INVOCATIONS
setInvocationsAuthorization(int)
that indicates
invocationsAllowed()
should return false
.
public static final int MAKE_INVOCATIONS_WAIT
setInvocationsAuthorization(int)
that indicates
calls to invocationsAllowed()
should block until a different
value is passed to setInvocationsAuthorization(int)
.
public static final int ENABLE_INVOCATIONS
setInvocationsAuthorization(int)
that indicates
invocationsAllowed()
should return true
.
protected String replicantName
protected ArrayList replicants
protected HAPartition partition
protected org.jboss.logging.Logger log
protected int clusterViewId
protected Serializable target
protected int allowInvocationsStatus
protected CountDownLatch latch
Constructor Detail |
---|
public HATarget(HAPartition partition, String replicantName, Serializable target, int allowInvocations) throws Exception
partition
- the HAPartition
for the service's clusterreplicantName
- the name of the servicetarget
- the service's replicant
allowInvocations
- true
if invocationsAllowed()
should return true
immediately;
false
if not
Exception
Method Detail |
---|
public String toString()
toString
in class Object
public long getCurrentViewId()
view id
for the clustered service.
public void destroy()
invocationsAllowed()
to return
false
.
public void disable()
NOTE: Calling this method does not cause
invocationsAllowed()
to return false
. Use
destroy()
unless your application needs to separately control
the two aspects of shutting down a clustered service.
public ArrayList getReplicants()
replicant
is a service-specific object, typically something that represents a
remote service endpoint for the service on a particular cluster node.
Examples include an RMI stub, a JBoss Remoting InvokerLocator
or an HTTP URL.
public void setInvocationsAuthorization(int status)
invocationsAllowed()
.
status
- ENABLE_INVOCATIONS
, DISABLE_INVOCATIONS
or MAKE_INVOCATIONS_WAIT
public boolean invocationsAllowed() throws InterruptedException
setInvocationsAuthorization(int)
has
been set to MAKE_INVOCATIONS_WAIT
.
true
e if it is valid to make invocations on the
service, false
otherwise
InterruptedException
- if the current thread is interrupted while
blocking waiting for MAKE_INVOCATIONS_WAIT
public HAPartition getAssociatedPartition()
public void replicantsChanged(String key, List newReplicants, int newReplicantsViewId, boolean merge)
DistributedReplicantManager.ReplicantListener
replicantsChanged
in interface DistributedReplicantManager.ReplicantListener
key
- The name of the key of the replicant that has changednewReplicants
- The list of new replicants for the give replicant key.
This list will be in a consistent order on all
cluster nodes on which the current viewId is
in effectnewReplicantsViewId
- The new replicant view id corresponding to this changemerge
- Is the change due to a merge (i.e. the healing of a
cluster split)?@Deprecated protected void init() throws Exception
Exception
protected void updateHAPartition(HAPartition partition) throws Exception
DistributedReplicantManager
.
partition
- the partition
Exception
protected void cleanExistenceInCurrentHAPartition()
DistributedReplicantManager
.
protected void releaseCurrentLatch()
invocationsAllowed()
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |