@Test public void onFailure() { final AtomicReference<Object> result = new AtomicReference<>(); final Connection connection = createConnection(); final RequestEntry entry = connection.newRequest( ValueUtil.randomString(), false ); final Request request = new Request( connection, entry ); assertNull( request.getEntry().getCompletionAction() ); assertFalse( request.getEntry().hasCompleted() ); request.onFailure( () -> result.set( true ) ); assertEquals( result.get(), true ); assertTrue( request.getEntry().hasCompleted() ); assertFalse( request.getEntry().isNormalCompletion() ); assertFalse( request.getEntry().isExpectingResults() ); }
public void onFailure( @Nonnull final SafeProcedure onError ) { if ( Replicant.shouldCheckApiInvariants() ) { apiInvariant( () -> !_entry.hasCompleted(), () -> "Replicant-0074: Request.onFailure invoked on completed request " + _entry + "." ); } _entry.setNormalCompletion( false ); _entry.setExpectingResults( false ); _connection.completeRequest( _entry, Objects.requireNonNull( onError ) ); }
Request { public void onFailure( @Nonnull final SafeProcedure onError ) { if ( Replicant.shouldCheckApiInvariants() ) { apiInvariant( () -> !_entry.hasCompleted(), () -> "Replicant-0074: Request.onFailure invoked on completed request " + _entry + "." ); } _entry.setNormalCompletion( false ); _entry.setExpectingResults( false ); _connection.completeRequest( _entry, Objects.requireNonNull( onError ) ); } }
Request { public void onFailure( @Nonnull final SafeProcedure onError ) { if ( Replicant.shouldCheckApiInvariants() ) { apiInvariant( () -> !_entry.hasCompleted(), () -> "Replicant-0074: Request.onFailure invoked on completed request " + _entry + "." ); } _entry.setNormalCompletion( false ); _entry.setExpectingResults( false ); _connection.completeRequest( _entry, Objects.requireNonNull( onError ) ); } Request( @Nonnull final Connection connection, @Nonnull final RequestEntry entry ); }
Request { public void onFailure( @Nonnull final SafeProcedure onError ) { if ( Replicant.shouldCheckApiInvariants() ) { apiInvariant( () -> !_entry.hasCompleted(), () -> "Replicant-0074: Request.onFailure invoked on completed request " + _entry + "." ); } _entry.setNormalCompletion( false ); _entry.setExpectingResults( false ); _connection.completeRequest( _entry, Objects.requireNonNull( onError ) ); } Request( @Nonnull final Connection connection, @Nonnull final RequestEntry entry ); @Nonnull String getConnectionId(); int getRequestId(); final void onSuccess( final boolean messageComplete, @Nonnull final SafeProcedure onSuccess ); void onFailure( @Nonnull final SafeProcedure onError ); }
Request { public void onFailure( @Nonnull final SafeProcedure onError ) { if ( Replicant.shouldCheckApiInvariants() ) { apiInvariant( () -> !_entry.hasCompleted(), () -> "Replicant-0074: Request.onFailure invoked on completed request " + _entry + "." ); } _entry.setNormalCompletion( false ); _entry.setExpectingResults( false ); _connection.completeRequest( _entry, Objects.requireNonNull( onError ) ); } Request( @Nonnull final Connection connection, @Nonnull final RequestEntry entry ); @Nonnull String getConnectionId(); int getRequestId(); final void onSuccess( final boolean messageComplete, @Nonnull final SafeProcedure onSuccess ); void onFailure( @Nonnull final SafeProcedure onError );  }