@Test public void onSuccess_messageIncomplete() { 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( entry.getCompletionAction() ); assertFalse( entry.hasCompleted() ); request.onSuccess( false, () -> result.set( true ) ); assertNull( result.get() ); assertTrue( entry.hasCompleted() ); assertNotNull( entry.getCompletionAction() ); assertTrue( entry.isNormalCompletion() ); assertTrue( entry.isExpectingResults() ); }
public final void onSuccess( final boolean messageComplete, @Nonnull final SafeProcedure onSuccess ) { if ( Replicant.shouldCheckApiInvariants() ) { apiInvariant( () -> !_entry.hasCompleted(), () -> "Replicant-0073: Request.onSuccess invoked on completed request " + _entry + "." ); } _entry.setNormalCompletion( true ); _entry.setExpectingResults( !messageComplete ); _connection.completeRequest( _entry, Objects.requireNonNull( onSuccess ) ); }
Request { public final void onSuccess( final boolean messageComplete, @Nonnull final SafeProcedure onSuccess ) { if ( Replicant.shouldCheckApiInvariants() ) { apiInvariant( () -> !_entry.hasCompleted(), () -> "Replicant-0073: Request.onSuccess invoked on completed request " + _entry + "." ); } _entry.setNormalCompletion( true ); _entry.setExpectingResults( !messageComplete ); _connection.completeRequest( _entry, Objects.requireNonNull( onSuccess ) ); } }
Request { public final void onSuccess( final boolean messageComplete, @Nonnull final SafeProcedure onSuccess ) { if ( Replicant.shouldCheckApiInvariants() ) { apiInvariant( () -> !_entry.hasCompleted(), () -> "Replicant-0073: Request.onSuccess invoked on completed request " + _entry + "." ); } _entry.setNormalCompletion( true ); _entry.setExpectingResults( !messageComplete ); _connection.completeRequest( _entry, Objects.requireNonNull( onSuccess ) ); } Request( @Nonnull final Connection connection, @Nonnull final RequestEntry entry ); }
Request { public final void onSuccess( final boolean messageComplete, @Nonnull final SafeProcedure onSuccess ) { if ( Replicant.shouldCheckApiInvariants() ) { apiInvariant( () -> !_entry.hasCompleted(), () -> "Replicant-0073: Request.onSuccess invoked on completed request " + _entry + "." ); } _entry.setNormalCompletion( true ); _entry.setExpectingResults( !messageComplete ); _connection.completeRequest( _entry, Objects.requireNonNull( onSuccess ) ); } 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 final void onSuccess( final boolean messageComplete, @Nonnull final SafeProcedure onSuccess ) { if ( Replicant.shouldCheckApiInvariants() ) { apiInvariant( () -> !_entry.hasCompleted(), () -> "Replicant-0073: Request.onSuccess invoked on completed request " + _entry + "." ); } _entry.setNormalCompletion( true ); _entry.setExpectingResults( !messageComplete ); _connection.completeRequest( _entry, Objects.requireNonNull( onSuccess ) ); } 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 );  }