Cumulus4j API
(1.2.0)

org.cumulus4j.store.crypto.keymanager.messagebroker.inmemory
Class MessageBrokerInMemory

java.lang.Object
  extended by org.cumulus4j.store.crypto.keymanager.messagebroker.AbstractMessageBroker
      extended by org.cumulus4j.store.crypto.keymanager.messagebroker.inmemory.MessageBrokerInMemory
All Implemented Interfaces:
MessageBroker

public class MessageBrokerInMemory
extends AbstractMessageBroker

Implementation of MessageBroker which works only in a single JVM. It manages all messages in-memory.

Important: This implementation can usually not be used in a cluster! It is only cluster-able, if you use transparent JVM-clustering, e.g. with Terracotta!

Author:
Marco หงุ่ยตระกูล-Schulze - marco at nightlabs dot de

Field Summary
 
Fields inherited from interface org.cumulus4j.store.crypto.keymanager.messagebroker.MessageBroker
SYSTEM_PROPERTY_POLL_REQUEST_TIMEOUT, SYSTEM_PROPERTY_QUERY_TIMEOUT
 
Constructor Summary
MessageBrokerInMemory()
           
 
Method Summary
protected  Request _pollRequest(String cryptoSessionIDPrefix)
          Delegate of the AbstractMessageBroker.pollRequest(String) method.
protected  Request _pollRequest(String cryptoSessionIDPrefix, long pollRequestTimeout)
           
protected  void _pushResponse(Response response)
          Delegate of the AbstractMessageBroker.pushResponse(Response) method.
protected  Response _query(Class<? extends Response> responseClass, Request request)
          Delegate of the AbstractMessageBroker.query(Class, Request) method.
protected  Response _query(Class<? extends Response> responseClass, Request request, long queryTimeout)
           
 
Methods inherited from class org.cumulus4j.store.crypto.keymanager.messagebroker.AbstractMessageBroker
getPollRequestTimeout, getQueryTimeout, pollRequest, pushResponse, query
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageBrokerInMemory

public MessageBrokerInMemory()
Method Detail

_query

protected Response _query(Class<? extends Response> responseClass,
                          Request request)
                   throws TimeoutException,
                          ErrorResponseException
Description copied from class: AbstractMessageBroker
Delegate of the AbstractMessageBroker.query(Class, Request) method. Subclasses should implement this method instead of query(...).

Specified by:
_query in class AbstractMessageBroker
Parameters:
responseClass - the type of the expected response; can be null, if you expect to receive null (i.e. you pass a "void" request).
request - the request to be sent to the key-manager.
Returns:
the response from the key-manager. Will be null, if the key-manager replied with a NullResponse.
Throws:
TimeoutException - if the request was not replied within the query-timeout.
ErrorResponseException - if the key-manager (either running embedded on the remote client or in a separate key-server) sent an ErrorResponse.

_query

protected Response _query(Class<? extends Response> responseClass,
                          Request request,
                          long queryTimeout)
                   throws TimeoutException,
                          ErrorResponseException
Throws:
TimeoutException
ErrorResponseException

_pollRequest

protected Request _pollRequest(String cryptoSessionIDPrefix)
Description copied from class: AbstractMessageBroker
Delegate of the AbstractMessageBroker.pollRequest(String) method. Subclasses should implement this method instead of pollRequest(...).

Specified by:
_pollRequest in class AbstractMessageBroker
Parameters:
cryptoSessionIDPrefix - usually, every key-manager uses the same prefix for all crypto-sessions. Thus, this prefix is used to efficiently route requests to the right key-manager.
Returns:
the next request waiting for processing and fitting to the given cryptoSessionIDPrefix or null, if no such request pops up in the to-do-queue within the timeout.

_pollRequest

protected Request _pollRequest(String cryptoSessionIDPrefix,
                               long pollRequestTimeout)

_pushResponse

protected void _pushResponse(Response response)
Description copied from class: AbstractMessageBroker
Delegate of the AbstractMessageBroker.pushResponse(Response) method. Subclasses should implement this method instead of pushResponse(...).

Specified by:
_pushResponse in class AbstractMessageBroker
Parameters:
response - the response answering a previous Request enqueued by AbstractMessageBroker.query(Class, Request).

Cumulus4j API
(1.2.0)

Copyright © 2013 NightLabs Consulting GmbH. All Rights Reserved.