use of com.cosylab.acs.maci.manager.recovery.ClientCommandDeallocate in project ACS by ACS-Community.
the class ManagerImpl method clientLogout.
/**
* Client specific logout method
* @param id handle of the client.
* @param pingFailed flag indicating that ping has failed (i.e. is the reason of this logout).
*/
private void clientLogout(int id, boolean pingFailed) {
TimerTaskClientInfo clientInfo = null;
int[] componentsArray = null;
synchronized (clients) {
int handle = id & HANDLE_MASK;
// already logged out
if (!clients.isAllocated(handle))
return;
clientInfo = (TimerTaskClientInfo) clients.get(handle);
// !!! ACID - RemoveClientCommand
executeCommand(new ClientCommandDeallocate(handle, id, pingFailed ? WhyUnloadedReason.DISAPPEARED : WhyUnloadedReason.REMOVED));
// remove
//clients.deallocate(handle);
componentsArray = clientInfo.getComponents().toArray();
}
// deregister client from the heartbeat manager
clientInfo.getTask().cancel();
// spawn another task which will release all clientInfo.getComponents()
threadPool.execute(new ReleaseComponentTask(clientInfo.getHandle(), componentsArray));
//internalReleaseComponents(components to be released, owners IntArray)
//internalReleaseComponents(clientInfo.getComponents(), clientInfo.getComponents())
/// TODO !!!!!!!!!!!!!! no more handle -> componentInfo data
// notify administrators about the logout
notifyClientLogout(clientInfo, System.currentTimeMillis());
Client client = clientInfo.getClient();
if (client != null)
client.release();
logger.log(Level.INFO, "Client '" + clientInfo.getName() + "' logged out.");
}
Aggregations