return this.localTakeOwnership(appName, keyId);
}
public PackagedSession localTakeOwnership(String appName, Object keyId) throws java.rmi.RemoteException
{
PackagedSession session = this.getAppMap(appName).get(keyId);
// if the session is not yet available, we simply return null. The persistence manager
// will have to take an action accordingly
//
if (session == null)
{
return null;
}
Lock lock = session.getLock();
if (!lock.tryLock())
{
throw new java.rmi.RemoteException("Concurent calls on session object.");
}
try
{
if (!session.getOwner().equals(this.myNodeName))
{
Object[] args = { appName, keyId, this.myNodeName, new Long(session.getVersion()) };
ArrayList<?> answers = null;
try
{
answers = this.partition.callMethodOnCluster(this.sessionStateIdentifier, "_setOwnership", args, SET_OWNERSHIP_TYPES, true);
}
catch (Exception e)
{
this.log.error("operation failed", e);
}
if ((answers != null) && answers.contains(Boolean.FALSE))
{
throw new java.rmi.RemoteException("Concurent calls on session object.");
}
session.setOwner(this.myNodeName);
return session;
}
return session;
}