@Test public void testRegisterOutboundRequestRejectsMultipleRegistrationOfSameRequest() { Exchange exchange = newOutboundRequest(); store.registerOutboundRequest(exchange); try { store.registerOutboundRequest(exchange); fail("should have thrown IllegalArgumentException"); } catch (IllegalArgumentException e) { } }
@Override public boolean registerOutboundRequest(final Exchange exchange) { if (exchange == null) { throw new NullPointerException("exchange must not be null"); } else if (exchange.getCurrentRequest() == null) { throw new IllegalArgumentException("exchange does not contain a request"); } else { Request currentRequest = exchange.getCurrentRequest(); KeyMID key = registerWithMessageId(exchange, currentRequest); if (key != null) { registerWithToken(exchange); if (exchange.getCurrentRequest() != currentRequest) { throw new ConcurrentModificationException("Current request modified!"); } return true; } else { return false; } } }
InMemoryMessageExchangeStore implements MessageExchangeStore { @Override public boolean registerOutboundRequest(final Exchange exchange) { if (exchange == null) { throw new NullPointerException("exchange must not be null"); } else if (exchange.getCurrentRequest() == null) { throw new IllegalArgumentException("exchange does not contain a request"); } else { Request currentRequest = exchange.getCurrentRequest(); KeyMID key = registerWithMessageId(exchange, currentRequest); if (key != null) { registerWithToken(exchange); if (exchange.getCurrentRequest() != currentRequest) { throw new ConcurrentModificationException("Current request modified!"); } return true; } else { return false; } } } }
InMemoryMessageExchangeStore implements MessageExchangeStore { @Override public boolean registerOutboundRequest(final Exchange exchange) { if (exchange == null) { throw new NullPointerException("exchange must not be null"); } else if (exchange.getCurrentRequest() == null) { throw new IllegalArgumentException("exchange does not contain a request"); } else { Request currentRequest = exchange.getCurrentRequest(); KeyMID key = registerWithMessageId(exchange, currentRequest); if (key != null) { registerWithToken(exchange); if (exchange.getCurrentRequest() != currentRequest) { throw new ConcurrentModificationException("Current request modified!"); } return true; } else { return false; } } } InMemoryMessageExchangeStore(NetworkConfig config);  InMemoryMessageExchangeStore(NetworkConfig config, TokenGenerator tokenProvider,
			EndpointIdentityResolver endpointResolver);  InMemoryMessageExchangeStore(String tag, NetworkConfig config, TokenGenerator tokenProvider,
			EndpointIdentityResolver endpointResolver); }
InMemoryMessageExchangeStore implements MessageExchangeStore { @Override public boolean registerOutboundRequest(final Exchange exchange) { if (exchange == null) { throw new NullPointerException("exchange must not be null"); } else if (exchange.getCurrentRequest() == null) { throw new IllegalArgumentException("exchange does not contain a request"); } else { Request currentRequest = exchange.getCurrentRequest(); KeyMID key = registerWithMessageId(exchange, currentRequest); if (key != null) { registerWithToken(exchange); if (exchange.getCurrentRequest() != currentRequest) { throw new ConcurrentModificationException("Current request modified!"); } return true; } else { return false; } } } InMemoryMessageExchangeStore(NetworkConfig config);  InMemoryMessageExchangeStore(NetworkConfig config, TokenGenerator tokenProvider,
			EndpointIdentityResolver endpointResolver);  InMemoryMessageExchangeStore(String tag, NetworkConfig config, TokenGenerator tokenProvider,
			EndpointIdentityResolver endpointResolver); synchronized void setDeduplicator(final Deduplicator deduplicator); synchronized void setMessageIdProvider(final MessageIdProvider provider); @Override synchronized void setExecutor(ScheduledExecutorService executor); @Override boolean isEmpty(); @Override String toString(); @Override int assignMessageId(final Message message); @Override boolean registerOutboundRequest(final Exchange exchange); @Override boolean registerOutboundRequestWithTokenOnly(final Exchange exchange); @Override void remove(final KeyToken token, final Exchange exchange); @Override Exchange remove(final KeyMID messageId, final Exchange exchange); @Override Exchange get(final KeyToken keyToken); @Override Exchange get(final KeyMID messageId); @Override boolean registerOutboundResponse(final Exchange exchange); @Override synchronized void start(); @Override synchronized void stop(); void dump(int logMaxExchanges); @Override Exchange findPrevious(final KeyMID messageId, final Exchange exchange); @Override boolean replacePrevious(KeyMID key, Exchange previous, Exchange exchange); @Override Exchange find(final KeyMID messageId); @Override List<Exchange> findByToken(Token token); }
InMemoryMessageExchangeStore implements MessageExchangeStore { @Override public boolean registerOutboundRequest(final Exchange exchange) { if (exchange == null) { throw new NullPointerException("exchange must not be null"); } else if (exchange.getCurrentRequest() == null) { throw new IllegalArgumentException("exchange does not contain a request"); } else { Request currentRequest = exchange.getCurrentRequest(); KeyMID key = registerWithMessageId(exchange, currentRequest); if (key != null) { registerWithToken(exchange); if (exchange.getCurrentRequest() != currentRequest) { throw new ConcurrentModificationException("Current request modified!"); } return true; } else { return false; } } } InMemoryMessageExchangeStore(NetworkConfig config);  InMemoryMessageExchangeStore(NetworkConfig config, TokenGenerator tokenProvider,
			EndpointIdentityResolver endpointResolver);  InMemoryMessageExchangeStore(String tag, NetworkConfig config, TokenGenerator tokenProvider,
			EndpointIdentityResolver endpointResolver); synchronized void setDeduplicator(final Deduplicator deduplicator); synchronized void setMessageIdProvider(final MessageIdProvider provider); @Override synchronized void setExecutor(ScheduledExecutorService executor); @Override boolean isEmpty(); @Override String toString(); @Override int assignMessageId(final Message message); @Override boolean registerOutboundRequest(final Exchange exchange); @Override boolean registerOutboundRequestWithTokenOnly(final Exchange exchange); @Override void remove(final KeyToken token, final Exchange exchange); @Override Exchange remove(final KeyMID messageId, final Exchange exchange); @Override Exchange get(final KeyToken keyToken); @Override Exchange get(final KeyMID messageId); @Override boolean registerOutboundResponse(final Exchange exchange); @Override synchronized void start(); @Override synchronized void stop(); void dump(int logMaxExchanges); @Override Exchange findPrevious(final KeyMID messageId, final Exchange exchange); @Override boolean replacePrevious(KeyMID key, Exchange previous, Exchange exchange); @Override Exchange find(final KeyMID messageId); @Override List<Exchange> findByToken(Token token);  }