Methods Summary |
---|
public void | acquireLocks(java.lang.String nodeName, org.jboss.util.id.GUID globalTxId, java.util.List list)
log.trace("acquireLocks");
ArrayList locks = new ArrayList();
try
{
for (int i = 0; i < list.size(); i++)
{
GUID guid = (GUID)list.get(i);
DistributedState state = getState(guid);
state.acquireWriteLock();
locks.add(state);
}
Hashtable held = (Hashtable)heldLocks.get(nodeName);
if (held == null)
{
held = new Hashtable();
heldLocks.put(nodeName, held);
}
held.put(globalTxId, locks);
}
catch (Exception ex)
{
releaseHeldLocks(locks);
throw ex;
}
log.trace("end acquireLocks");
|
protected void | acquireRemoteLocks(org.jboss.util.id.GUID globalTxId, java.util.List guids)
try
{
Object[] args = {partition.getNodeName(), globalTxId, guids};
checkResponses(partition.callMethodOnCluster(domainName, "acquireLocks", args, true));
}
catch (Exception ex)
{
try
{
Object[] args = {partition.getNodeName()};
partition.callMethodOnCluster(domainName, "releaseHeldLocks", args, true);
}
catch (Exception ignored)
{
}
throw ex;
}
|
public void | addNewObjects(java.util.List newObjects)
// updates must be in table first
synchronized (tableLock)
{
for (int i = 0; i < newObjects.size(); i++)
{
DistributedState state = (DistributedState)newObjects.get(i);
// REVISIT synch
stateTable.put(state.getGUID(), state);
}
for (int i = 0; i < newObjects.size(); i++)
{
DistributedState state = (DistributedState)newObjects.get(i);
if (objectTable.containsKey(state.getGUID())) continue;
state.buildObject(this, versionManager);
}
}
|
protected void | checkResponses(java.util.List rsps)Checks whether any of the responses are exceptions. If yes, re-throws
them (as exceptions or runtime exceptions).
Object rsp;
if(rsps != null) {
for(Iterator it=rsps.iterator(); it.hasNext();) {
rsp=it.next();
if(rsp != null) {
if(rsp instanceof RuntimeException)
throw (RuntimeException)rsp;
if(rsp instanceof Exception)
throw (Exception)rsp;
}
}
}
|
public void | create()
//partition.subscribeToStateTransferEvents(domainName, this);
partition.registerRPCHandler(domainName, this);
|
public java.io.Serializable | getCurrentState()
if(log.isTraceEnabled() )
log.trace("getCurrentState called");
return stateTable;
|
public void | membershipChanged(java.util.Vector deadMembers, java.util.Vector newMembers, java.util.Vector allMembers)
for (int i = 0; i < deadMembers.size(); i++)
{
Hashtable held = (Hashtable)heldLocks.remove(deadMembers.get(i));
if (held != null)
{
Iterator it = held.values().iterator();
while (it.hasNext())
{
List list = (List)it.next();
releaseHeldLocks(list);
}
}
}
|
public void | noTxUpdate(DistributedUpdate update)
throw new RuntimeException("NOT IMPLEMENTED");
|
protected void | pullState()
Object[] args = {};
ArrayList rsp = partition.callMethodOnCluster(domainName, "getCurrentState", args, true);
if (rsp.size() > 0)
setCurrentState((Serializable)rsp.get(0));
|
public void | releaseHeldLocks(java.lang.String nodeName, org.jboss.util.id.GUID globalTxId)
Hashtable held = (Hashtable)heldLocks.get(nodeName);
if (held == null) return;
List locks = (List)held.remove(globalTxId);
if (locks != null) releaseHeldLocks(locks);
|
protected void | sendClusterUpdatesAndRelease(org.jboss.util.id.GUID globalTxId, java.util.List clusterUpdates)
try
{
Object[] args = {partition.getNodeName(), globalTxId, clusterUpdates};
checkResponses(partition.callMethodOnCluster(domainName, "updateObjects", args, true));
}
catch (Exception ex)
{
log.error("serious cache problems, data inconsistency is imminent", ex);
throw ex;
}
|
public void | sendNewObjects(java.util.List newObjects)
log.trace("sending new objects");
try
{
Object[] args = {newObjects};
checkResponses(partition.callMethodOnCluster(domainName, "addNewObjects", args, true));
}
catch (Exception ex)
{
log.error("serious cache problems, data inconsistency is imminent", ex);
throw ex;
}
|
public void | setCurrentState(java.io.Serializable newState)
if( log.isTraceEnabled() )
log.trace("setCurrentState called");
try
{
synchronized (tableLock)
{
this.stateTable = (Hashtable)newState;
log.trace("setCurrentState, size: " + stateTable.size());
Iterator it = stateTable.values().iterator();
while (it.hasNext())
{
DistributedState state = (DistributedState)it.next();
if (objectTable.containsKey(state.getGUID())) continue;
state.buildObject(this, versionManager);
}
}
}
catch (Exception ex)
{
log.error("failed to set state sent from cluster", ex);
}
|
public void | start()
pullState();
|
public void | updateObjects(java.lang.String nodeName, org.jboss.util.id.GUID globalTxId, java.util.ArrayList updates)
log.trace("updateObjects");
synchronized (tableLock)
{
for (int i = 0; i < updates.size(); i++)
{
DistributedUpdate update = (DistributedUpdate)updates.get(i);
// REVISIT: synch
DistributedState state = (DistributedState)stateTable.get(update.getGUID());
state.mergeState(update);
state.releaseWriteLock();
}
}
Hashtable table = (Hashtable)heldLocks.get(nodeName);
table.remove(globalTxId);
log.trace("end updateObjects");
|