예제 #1
0
  @Override
  public String addItemListener(final ItemListener<E> listener, final boolean includeValue) {
    ClientMessage request = QueueAddListenerCodec.encodeRequest(name, includeValue);

    EventHandler<ClientMessage> eventHandler = new ItemEventHandler(includeValue, listener);
    ClientMessageDecoder responseDecoder =
        new ClientMessageDecoder() {
          @Override
          public <T> T decodeClientMessage(ClientMessage clientMessage) {
            return (T) MapAddEntryListenerWithPredicateCodec.decodeResponse(clientMessage).response;
          }
        };
    return listen(request, getPartitionKey(), eventHandler, responseDecoder);
  }
 @Override
 protected ClientMessage encodeResponse(Object response) {
   return QueueAddListenerCodec.encodeResponse((String) response);
 }
 @Override
 protected QueueAddListenerCodec.RequestParameters decodeClientMessage(
     ClientMessage clientMessage) {
   return QueueAddListenerCodec.decodeRequest(clientMessage);
 }