Methods Summary |
---|
protected void | cleanExistenceInCurrentHAPartition()
if (this.partition != null)
{
try
{
DistributedReplicantManager drm = partition.getDistributedReplicantManager();
drm.unregisterListener(this.replicantName, this);
drm.remove(this.replicantName);
}
catch (Exception e)
{
log.error("failed to clean existence in current ha partition", e);
}
}
|
public void | destroy()
try
{
this.cleanExistenceInCurrentHAPartition();
// maybe some threads are blocked: we let them go here:
//
setInvocationsAuthorization (HATarget.DISABLE_INVOCATIONS);
}
catch (Exception e)
{
log.error("failed to destroy", e);
}
|
public void | disable()
try
{
if (this.partition != null)
{
log.debug ("Disabled called on HATarget");
this.partition.getDistributedReplicantManager().remove (this.replicantName);
}
}
catch (Exception e)
{
log.error("failed to disable", e);
}
|
public org.jboss.ha.framework.interfaces.HAPartition | getAssociatedPartition()
return this.partition;
|
public long | getCurrentViewId()
return (long)clusterViewId;
|
public java.util.ArrayList | getReplicants()
return replicants;
|
public void | init()
this.log = org.jboss.logging.Logger.getLogger(this.getClass());
|
public boolean | invocationsAllowed()
if (this.allowInvocationsStatus == ENABLE_INVOCATIONS)
return true;
else if (this.allowInvocationsStatus == DISABLE_INVOCATIONS)
return false;
else if (this.allowInvocationsStatus == MAKE_INVOCATIONS_WAIT)
{
latch.acquire ();
// if we arrive here, it means that the status has been changed, so
// we check for the decision:
//
if (this.allowInvocationsStatus == ENABLE_INVOCATIONS)
return true;
else
return false;
}
else
return false;
|
protected void | releaseCurrentLatch()
latch.release ();
latch = null;
|
public void | replicantsChanged(java.lang.String key, java.util.List newReplicants, int newReplicantsViewId)
if (log.isDebugEnabled())
log.debug("replicantsChanged '" + replicantName +
"' to " + (newReplicants==null? "0 (null)" : Integer.toString (newReplicants.size() ) ) +
" (intra-view id: " + newReplicantsViewId + ")");
synchronized(replicants)
{
// client has reference to replicants so it will automatically get
// updated
replicants.clear();
if (newReplicants != null)
replicants.addAll(newReplicants);
this.clusterViewId = newReplicantsViewId;
}
|
public synchronized void | setInvocationsAuthorization(int status)
if (this.allowInvocationsStatus == status)
{
// we don't release and reget a latch if two identical calls are performed
//
log.debug ("Invocation authorization called with no-op");
}
else
{
// CRITICAL CODE! DONT CHANGE ORDER WITHOUT THINKING ABOUT RACE CONDITIONS
//
if (status == MAKE_INVOCATIONS_WAIT)
{
log.debug ("Invocation authorization called: MAKE_INVOCATIONS_WAIT");
latch = new Latch();
this.allowInvocationsStatus = status;
}
else
{
log.debug ("Invocation authorization called: " +
((status==ENABLE_INVOCATIONS)?"ENABLE_INVOCATIONS":"DISABLE_INVOCATIONS") );
this.allowInvocationsStatus = status;
if (latch != null)
latch.release();
}
}
|
public java.lang.String | toString()
StringBuffer buffer = new StringBuffer(super.toString());
buffer.append('{");
buffer.append("replicantName="+replicantName);
buffer.append("partition="+partition.getPartitionName());
buffer.append("clusterViewId="+clusterViewId);
buffer.append("allowInvocationsStatus="+allowInvocationsStatus);
buffer.append("replicants="+replicants);
buffer.append('}");
return buffer.toString();
|
public void | updateHAPartition(org.jboss.ha.framework.interfaces.HAPartition partition)
cleanExistenceInCurrentHAPartition();
this.partition = partition;
DistributedReplicantManager drm = partition.getDistributedReplicantManager();
drm.registerListener(this.replicantName, this);
drm.add(this.replicantName, this.target);
|