Search in sources :

Example 1 with AdministratorCommandDeallocate

use of com.cosylab.acs.maci.manager.recovery.AdministratorCommandDeallocate in project ACS by ACS-Community.

the class ManagerImpl method administratorLogout.

/**
	 * Administrator specific logout method
	 * @param	id	handle of the administrators.
	 * @param	pingFailed	flag indicating that ping has failed (i.e. is the reason of this logout).
	 */
private void administratorLogout(int id, boolean pingFailed) {
    TimerTaskClientInfo clientInfo = null;
    int[] componentsArray = null;
    synchronized (administrators) {
        int handle = id & HANDLE_MASK;
        // already logged out
        if (!administrators.isAllocated(handle))
            return;
        clientInfo = (TimerTaskClientInfo) administrators.get(handle);
        // !!! ACID - RemoveAdministratorCommand
        executeCommand(new AdministratorCommandDeallocate(handle, id, pingFailed ? WhyUnloadedReason.DISAPPEARED : WhyUnloadedReason.REMOVED));
        // remove
        //administrators.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));
    /// 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, "Administrator '" + clientInfo.getName() + "' logged out.");
}
Also used : Client(com.cosylab.acs.maci.Client) AdministratorCommandDeallocate(com.cosylab.acs.maci.manager.recovery.AdministratorCommandDeallocate)

Aggregations

Client (com.cosylab.acs.maci.Client)1 AdministratorCommandDeallocate (com.cosylab.acs.maci.manager.recovery.AdministratorCommandDeallocate)1