Http2LifecycleManager.onException rename

Motivation:
Http2LifecycleManager.onException takes a Throwable as a paramter and not an Exception. There are also onConnectionError and onStreamError methods in the codec. We should rename this method to onError for consistency and clarity.

Modifications:
- Rename Http2LifecycleManager.onException to Http2LifecycleManager.onError

Result:
More consistent and clarified interface.
This commit is contained in:
Scott Mitchell 2015-09-15 15:33:17 -07:00
parent 1c14e5bd4c
commit 5edffb7198
3 changed files with 9 additions and 9 deletions

View File

@ -171,7 +171,7 @@ public class DefaultHttp2ConnectionEncoder implements Http2ConnectionEncoder {
endOfStream, promise)); endOfStream, promise));
return promise; return promise;
} catch (Http2NoMoreStreamIdsException e) { } catch (Http2NoMoreStreamIdsException e) {
lifecycleManager.onException(ctx, e); lifecycleManager.onError(ctx, e);
return promise.setFailure(e); return promise.setFailure(e);
} catch (Throwable e) { } catch (Throwable e) {
return promise.setFailure(e); return promise.setFailure(e);
@ -332,7 +332,7 @@ public class DefaultHttp2ConnectionEncoder implements Http2ConnectionEncoder {
@Override @Override
public void error(ChannelHandlerContext ctx, Throwable cause) { public void error(ChannelHandlerContext ctx, Throwable cause) {
queue.releaseAndFailAll(cause); queue.releaseAndFailAll(cause);
lifecycleManager.onException(ctx, cause); lifecycleManager.onError(ctx, cause);
promise.tryFailure(cause); promise.tryFailure(cause);
} }
@ -400,7 +400,7 @@ public class DefaultHttp2ConnectionEncoder implements Http2ConnectionEncoder {
@Override @Override
public void error(ChannelHandlerContext ctx, Throwable cause) { public void error(ChannelHandlerContext ctx, Throwable cause) {
if (ctx != null) { if (ctx != null) {
lifecycleManager.onException(ctx, cause); lifecycleManager.onError(ctx, cause);
} }
promise.tryFailure(cause); promise.tryFailure(cause);
} }

View File

@ -271,7 +271,7 @@ public class Http2ConnectionHandler extends ByteToMessageDecoder implements Http
byteDecoder.decode(ctx, in, out); byteDecoder.decode(ctx, in, out);
} }
} catch (Throwable e) { } catch (Throwable e) {
onException(ctx, e); onError(ctx, e);
} }
} }
@ -388,7 +388,7 @@ public class Http2ConnectionHandler extends ByteToMessageDecoder implements Http
try { try {
decoder.decodeFrame(ctx, in, out); decoder.decodeFrame(ctx, in, out);
} catch (Throwable e) { } catch (Throwable e) {
onException(ctx, e); onError(ctx, e);
} }
} }
} }
@ -490,7 +490,7 @@ public class Http2ConnectionHandler extends ByteToMessageDecoder implements Http
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
if (getEmbeddedHttp2Exception(cause) != null) { if (getEmbeddedHttp2Exception(cause) != null) {
// Some exception in the causality chain is an Http2Exception - handle it. // Some exception in the causality chain is an Http2Exception - handle it.
onException(ctx, cause); onError(ctx, cause);
} else { } else {
super.exceptionCaught(ctx, cause); super.exceptionCaught(ctx, cause);
} }
@ -556,7 +556,7 @@ public class Http2ConnectionHandler extends ByteToMessageDecoder implements Http
* Central handler for all exceptions caught during HTTP/2 processing. * Central handler for all exceptions caught during HTTP/2 processing.
*/ */
@Override @Override
public void onException(ChannelHandlerContext ctx, Throwable cause) { public void onError(ChannelHandlerContext ctx, Throwable cause) {
Http2Exception embedded = getEmbeddedHttp2Exception(cause); Http2Exception embedded = getEmbeddedHttp2Exception(cause);
if (isStreamError(embedded)) { if (isStreamError(embedded)) {
onStreamError(ctx, cause, (StreamException) embedded); onStreamError(ctx, cause, (StreamException) embedded);

View File

@ -85,7 +85,7 @@ public interface Http2LifecycleManager {
ByteBuf debugData, ChannelPromise promise); ByteBuf debugData, ChannelPromise promise);
/** /**
* Processes the given exception. * Processes the given error.
*/ */
void onException(ChannelHandlerContext ctx, Throwable cause); void onError(ChannelHandlerContext ctx, Throwable cause);
} }