Package com.almende.util

Examples of com.almende.util.ObjectCache


        LOG.warning("Received ZMQ.HANDSHAKE_RESPONSE for unknown handshake..."
            + senderUrl + " : " + token);
      }
      return;
    } else {
      final ObjectCache sessionCache = ObjectCache.get("ZMQSessions");
      if (!sessionCache.containsKey(key) && doesAuthentication) {
        final SyncCallback<String> callback = new SyncCallback<String>(){};
        CALLBACKS.push(key, "", callback);
        sendAsync(ZMQ.HANDSHAKE, token.toString(), senderUrl, token
            .getTime().getBytes(), null);
       
        String retToken = null;
        try {
          retToken = callback.get();
        } catch (final Exception e) {
        }
        if (token.getToken().equals(retToken)) {
          sessionCache.put(key, true);
        } else {
          LOG.warning("Failed to complete handshake!");
          return;
        }
      }
View Full Code Here


        LOG.warning("Received ZMQ.HANDSHAKE_RESPONSE for unknown handshake..."
            + senderUrl + " : " + token);
      }
      return;
    } else {
      final ObjectCache sessionCache = ObjectCache.get("ZMQSessions");
      if (!sessionCache.containsKey(key)
          && host.getAgent(agentId).hasPrivate()) {
        final AsyncCallbackQueue<String> callbacks = host
            .getCallbackQueue("zmqHandshakes", String.class);
       
        SyncCallback<String> callback = new SyncCallback<String>();
        callbacks.push(key, "", callback);
        service.sendAsync(ZMQ.HANDSHAKE, token.toString(), zmqUrl,
            senderUrl, token.getTime(), null);
       
        String retToken = null;
        try {
          retToken = callback.get();
        } catch (Exception e) {
        }
        if (token.getToken().equals(retToken)) {
          sessionCache.put(key, true);
        } else {
          LOG.warning("Failed to complete handshake!");
          return;
        }
      }
View Full Code Here

TOP

Related Classes of com.almende.util.ObjectCache

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.