Search in sources :

Example 1 with ContainerCommandDeallocate

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

the class ManagerImpl method containerLogout.

/**
	 * Container specific logout method
	 * @param	id	handle of the container.
	 * @param	pingFailed	flag indicating that ping has failed (i.e. is the reason of this logout).
	 */
private void containerLogout(int id, boolean pingFailed) {
    TimerTaskContainerInfo containerInfo = null;
    synchronized (containers) {
        int handle = id & HANDLE_MASK;
        // already logged out
        if (!containers.isAllocated(handle))
            return;
        containerInfo = (TimerTaskContainerInfo) containers.get(handle);
        // cancel all "old" container async request
        AcsJCannotGetComponentEx acgcex = new AcsJCannotGetComponentEx();
        acgcex.setReason("Request canceled due to container logout.");
        cancelPendingContainerAsyncRequestWithException(containerInfo.getName(), acgcex);
        // !!! ACID - RemoveContainerCommand
        executeCommand(new ContainerCommandDeallocate(handle, id, pingFailed ? WhyUnloadedReason.DISAPPEARED : WhyUnloadedReason.REMOVED));
    // remove
    //containers.deallocate(handle);
    }
    // deregister container from the heartbeat manager
    containerInfo.getTask().cancel();
    // make all container components unavailable
    markContainersComponentsUnavailable(containerInfo);
    /// TODO !!!!!!!!!!!!!! no more handle -> componentInfo data
    // notify administrators about the logout
    notifyContainerLogout(containerInfo, System.currentTimeMillis());
    Container container = containerInfo.getContainer();
    if (container != null)
        container.release();
    logger.log(Level.INFO, "Container '" + containerInfo.getName() + "' logged out.");
}
Also used : Container(com.cosylab.acs.maci.Container) ContainerCommandDeallocate(com.cosylab.acs.maci.manager.recovery.ContainerCommandDeallocate) AcsJCannotGetComponentEx(alma.maciErrType.wrappers.AcsJCannotGetComponentEx)

Aggregations

AcsJCannotGetComponentEx (alma.maciErrType.wrappers.AcsJCannotGetComponentEx)1 Container (com.cosylab.acs.maci.Container)1 ContainerCommandDeallocate (com.cosylab.acs.maci.manager.recovery.ContainerCommandDeallocate)1