/** * Get the SearchResponse, blocking until one is received. * It can be either a SearchResultEntry, a SearchResultReference * or a SearchResultDone, the last of all the SearchResponse. * * @return The SearchResponse */ public SearchResponse get() throws InterruptedException, ExecutionException { return super.get(); }
/** * {@inheritDoc} */ public String toString() { StringBuilder sb = new StringBuilder(); sb.append( "SearchFuture" ).append( super.toString() ); return sb.toString(); } }
/** * Handle the exception we got. * * @param session The session we got the exception on * @param cause The exception cause * @throws Exception If we have had another exception */ @Override public void exceptionCaught( IoSession session, Throwable cause ) throws Exception { if ( LOG.isWarnEnabled() ) { LOG.warn( cause.getMessage(), cause ); } session.setAttribute( EXCEPTION_KEY, cause ); if ( cause instanceof ProtocolEncoderException ) { Throwable realCause = ( ( ProtocolEncoderException ) cause ).getCause(); if ( realCause instanceof MessageEncoderException ) { int messageId = ( ( MessageEncoderException ) realCause ).getMessageId(); ResponseFuture<?> response = futureMap.get( messageId ); response.cancel( true ); response.setCause( realCause ); } } session.closeNow(); }
/** * Convert a IntermediateResponseCodec to a IntermediateResponse message based on the ResponseFuture's type */ private void setIResponse( IntermediateResponseCodec intermediateResponseCodec, ResponseFuture responseFuture ) throws Exception { IntermediateResponse intermediateResponse = null; if( responseFuture instanceof SearchFuture ) { intermediateResponse = new SearchIntermediateResponse(); } else if( responseFuture instanceof ExtendedFuture ) { intermediateResponse = new ExtendedIntermediateResponse(); } else { // currently we only support IR for search and extended operations throw new UnsupportedOperationException( "Unknown ResponseFuture type " + responseFuture.getClass().getName() ); } intermediateResponse.setResponseName( intermediateResponseCodec.getResponseName() ); intermediateResponse.setResponseValue( intermediateResponseCodec.getResponseValue() ); responseFuture.set( intermediateResponse ); }
/** * Handle the exception we got. * * @param session The session we got the exception on * @param cause The exception cause * @throws Exception If we have had another exception */ @Override public void exceptionCaught( IoSession session, Throwable cause ) throws Exception { if ( LOG.isWarnEnabled() ) { LOG.warn( cause.getMessage(), cause ); } session.setAttribute( EXCEPTION_KEY, cause ); if ( cause instanceof ProtocolEncoderException ) { Throwable realCause = ( ( ProtocolEncoderException ) cause ).getCause(); if ( realCause instanceof MessageEncoderException ) { int messageId = ( ( MessageEncoderException ) realCause ).getMessageId(); ResponseFuture<?> response = futureMap.get( messageId ); response.cancel( true ); response.setCause( realCause ); } } session.closeNow(); }
responseFuture.cancel();
/** * Handle the exception we got. * * @param session The session we got the exception on * @param cause The exception cause * @throws Exception If we have had another exception */ @Override public void exceptionCaught( IoSession session, Throwable cause ) throws Exception { if ( LOG.isWarnEnabled() ) { LOG.warn( cause.getMessage(), cause ); } session.setAttribute( EXCEPTION_KEY, cause ); if ( cause instanceof ProtocolEncoderException ) { Throwable realCause = ( ( ProtocolEncoderException ) cause ).getCause(); if ( realCause instanceof MessageEncoderException ) { int messageId = ( ( MessageEncoderException ) realCause ).getMessageId(); ResponseFuture<?> response = futureMap.get( messageId ); response.cancel( true ); response.setCause( realCause ); } } session.closeNow(); }
/** * Get the ExtendedResponse, blocking until one is received, or until the * given timeout is reached. * * @param timeout Number of TimeUnit to wait * @param unit The TimeUnit * @return The ExtendedResponse The ExtendedResponse found */ public ExtendedResponse get( long timeout, TimeUnit unit ) throws InterruptedException, ExecutionException, TimeoutException { return super.get( timeout, unit ); }
/** * {@inheritDoc} */ public String toString() { StringBuilder sb = new StringBuilder(); sb.append( "ModifyFuture" ).append( super.toString() ); return sb.toString(); } }
rf.cancel( true );
/** * Get the SearchResponse, blocking until one is received, or until the * given timeout is reached. * * @param timeout Number of TimeUnit to wait * @param unit The TimeUnit * @return The SearchResponse The SearchResponse found */ public SearchResponse get( long timeout, TimeUnit unit ) throws InterruptedException, ExecutionException, TimeoutException { return super.get( timeout, unit ); }
/** * {@inheritDoc} */ public String toString() { StringBuilder sb = new StringBuilder(); sb.append( "CompareFuture" ).append( super.toString() ); return sb.toString(); } }
responseFuture.cancel();
/** * Get the DeleteResponse, blocking until one is received, or until the * given timeout is reached. * * @param timeout Number of TimeUnit to wait * @param unit The TimeUnit * @return The DeleteResponse The DeleteResponse found */ public DeleteResponse get( long timeout, TimeUnit unit ) throws InterruptedException, ExecutionException, TimeoutException { return super.get( timeout, unit ); }
/** * {@inheritDoc} */ public String toString() { StringBuilder sb = new StringBuilder(); sb.append( "BindFuture" ).append( super.toString() ); return sb.toString(); } }
responseFuture.cancel();
/** * Get the AddResponse, blocking until one is received, or until the * given timeout is reached. * * @param timeout Number of TimeUnit to wait * @param unit The TimeUnit * @return The AddResponse The AddResponse found */ public AddResponse get( long timeout, TimeUnit unit ) throws InterruptedException, ExecutionException, TimeoutException { return super.get( timeout, unit ); }
/** * {@inheritDoc} */ public String toString() { StringBuilder sb = new StringBuilder(); sb.append( "ExtendedFuture" ).append( super.toString() ); return sb.toString(); } }