Skip to content

Commit

Permalink
Experiment with IteratingCallback
Browse files Browse the repository at this point in the history
The previous semantic of `onCompleteFailure` has been renamed to `onFailure(Throwable)`, which is called immediately (but serialized) on either an abort or a failure.   A new `onCompleteFailure(Throwable)` method has been added that is called only after a `failed(throwable)` or a `abort(Throwable)` followed by `succeeded()` or `failed(Throwable)``

No usage has yet been made of the new `onCompleteFailure`, but the ICB implementation has been completely replaced by the one developed in #11876
  • Loading branch information
gregw committed Jul 15, 2024
1 parent f5d6d8d commit 6858307
Show file tree
Hide file tree
Showing 38 changed files with 1,089 additions and 317 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ protected void onCompleteSuccess()
}

@Override
protected void onCompleteFailure(Throwable failure)
protected void onFailure(Throwable failure)
{
// In case of a failure, either on the
// read or on the write, release the chunk.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ protected void onCompleteSuccess()
}

@Override
protected void onCompleteFailure(Throwable cause)
protected void onFailure(Throwable cause)
{
// The iteration completed with a failure.
getEndPoint().close(cause);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ protected void onCompleteSuccess()
}

@Override
protected void onCompleteFailure(Throwable x)
protected void onFailure(Throwable x)
{
x.printStackTrace();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ protected void onCompleteSuccess()
}

@Override
protected void onCompleteFailure(Throwable cause)
protected void onFailure(Throwable cause)
{
getEndPoint().close(cause);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ else if (expect100)
}

@Override
protected void onCompleteFailure(Throwable x)
protected void onFailure(Throwable x)
{
if (chunk != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,9 @@ protected void onCompleteSuccess()
}

@Override
protected void onCompleteFailure(Throwable cause)
protected void onFailure(Throwable cause)
{
super.onCompleteFailure(cause);
super.onFailure(cause);
release();
callback.failed(cause);
}
Expand Down Expand Up @@ -335,7 +335,7 @@ protected Action process() throws Exception
}

@Override
protected void onCompleteFailure(Throwable cause)
protected void onFailure(Throwable cause)
{
release();
callback.failed(cause);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ protected void onSuccess()
}

@Override
public void onCompleteFailure(Throwable x)
public void onFailure(Throwable x)
{
if (active != null)
active.failed(x);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ protected void onCompleteSuccess()
}

@Override
protected void onCompleteFailure(Throwable x)
protected void onFailure(Throwable x)
{
release();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ protected void onSuccess()
}

@Override
protected void onCompleteFailure(Throwable cause)
protected void onFailure(Throwable cause)
{
frameInfo.callback.failed(cause);
}
Expand Down Expand Up @@ -673,7 +673,7 @@ protected void onSuccess()
}

@Override
protected void onCompleteFailure(Throwable cause)
protected void onFailure(Throwable cause)
{
frameInfo.callback.failed(cause);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ protected void onSuccess()
}

@Override
protected void onCompleteFailure(Throwable failure)
protected void onFailure(Throwable failure)
{
if (LOG.isDebugEnabled())
LOG.debug("failed to write {} on {}", entries, this, failure);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ protected void onCompleteSuccess()
}

@Override
protected void onCompleteFailure(Throwable failure)
protected void onFailure(Throwable failure)
{
if (LOG.isDebugEnabled())
LOG.debug("failed to write buffers on {}", this, failure);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ protected void onSuccess()
}

@Override
protected void onCompleteFailure(Throwable cause)
protected void onFailure(Throwable cause)
{
if (LOG.isDebugEnabled())
LOG.debug("failed to write {} on {}", entry, this, cause);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,12 +413,12 @@ protected void onCompleteSuccess()
}

@Override
protected void onCompleteFailure(Throwable x)
protected void onFailure(Throwable x)
{
if (retainableByteBuffer != null)
retainableByteBuffer.release();
IO.close(channel);
super.onCompleteFailure(x);
super.onFailure(x);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ protected Action process() throws Throwable
}

@Override
protected void onCompleteFailure(Throwable x)
protected void onFailure(Throwable x)
{
if (current != null)
{
current.release();
current = Content.Chunk.next(current);
}
ExceptionUtil.callAndThen(x, source::fail, super::onCompleteFailure);
ExceptionUtil.callAndThen(x, source::fail, super::onFailure);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ public InvocationType getInvocationType()
}

@Override
protected void onCompleteFailure(Throwable cause)
protected void onFailure(Throwable cause)
{
entry.callback.failed(cause);
QuicConnection.this.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ protected void onCompleteSuccess()
}

@Override
protected void onCompleteFailure(Throwable failure)
protected void onFailure(Throwable failure)
{
if (LOG.isDebugEnabled())
LOG.debug("failed to write cipher bytes, closing session on {}", QuicSession.this, failure);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ protected void onSuccess()
}

@Override
protected void onCompleteFailure(Throwable x)
protected void onFailure(Throwable x)
{
if (LOG.isDebugEnabled())
LOG.debug("Failed to write {} bytes {}", filled, TunnelConnection.this, x);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,14 +322,14 @@ public GzipBufferCB(boolean complete, Callback callback, ByteBuffer content)
}

@Override
protected void onCompleteFailure(Throwable x)
protected void onFailure(Throwable x)
{
if (_deflaterEntry != null)
{
_deflaterEntry.release();
_deflaterEntry = null;
}
super.onCompleteFailure(x);
super.onFailure(x);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ protected void onCompleteSuccess()
}

@Override
public void onCompleteFailure(final Throwable x)
public void onFailure(final Throwable x)
{
failedCallback(release(), x);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ protected void onCompleteSuccess()
}

@Override
protected void onCompleteFailure(Throwable cause)
protected void onFailure(Throwable cause)
{
// There was a write error, close the Gateway Channel.
channel.close(cause);
Expand Down Expand Up @@ -378,7 +378,7 @@ protected void onCompleteSuccess()
}

@Override
protected void onCompleteFailure(Throwable cause)
protected void onFailure(Throwable cause)
{
// There was a write error, close the Gateway Channel.
channel.close(cause);
Expand Down
Loading

0 comments on commit 6858307

Please sign in to comment.