public void run() {
        if (getSession() == null || getSession().isClosed()) {
            if (this.operation == Operation.removeDetached) {
                logger.debug("Asked to remove detached sessions for JID {}, but no such sessions exist.", address); // This is a rather likely scenario. Don't log an error for this (OF-3034).
            } else {
                logger.error("Unable to execute task for JID {}: {}", address, this, new IllegalStateException("Session not found for JID: " + address));
            }
            return;
        }
        super.run();

        ClientSession session = (ClientSession) getSession();
        if (session instanceof RemoteClientSession) {
            // The session is being hosted by other cluster node so log this unexpected case
            Cache<String, ClientRoute> usersCache = CacheFactory.createCache(RoutingTableImpl.C2S_CACHE_NAME);
            ClientRoute route = usersCache.get(address.toString());
            byte[] nodeIDByte = route != null ? route.getNodeID().toByteArray() : new byte[0];

            logger.warn("Found remote session instead of local session. JID: {} found in Node: {} and local node is: {}",
                address, nodeIDByte, XMPPServer.getInstance().getNodeID().toByteArray());
        }
        if (operation == Operation.isInitialized) {
            if (session instanceof RemoteClientSession) {
                // Something is wrong since the session should be local instead of remote
                // Assume some default value
                result = true;
            }
            else {
                result = session.isInitialized();
            }
        }
        if (operation == Operation.isAnonymous) {
            if (session instanceof RemoteClientSession) {
                // Something is wrong since the session should be local instead of remote
                // Assume some default value
                result = false;
            }
            else {
                result = session.isAnonymousUser();
            }
        }
        else if (operation == Operation.incrementConflictCount) {
            if (session instanceof RemoteClientSession) {
                // Something is wrong since the session should be local instead of remote
                // Assume some default value
                result = 2;
            }
            else {
                result = session.incrementConflictCount();
            }
        }
        else if (operation == Operation.hasRequestedBlocklist) {
            if (session instanceof RemoteClientSession) {
                // Something is wrong since the session should be local instead of remote
                // Assume some default value
                result = false;
            }
            else {
                result = session.hasRequestedBlocklist();
            }
        }
    }
Class that defines possible remote operations that could be performed
on remote client sessions.

@author Gaston Dombiak
xmppserver/src/main/java/org/jivesoftware/openfire/session/ClientSessionTask.java