Toggle navigation
Home
io.vertx.core.Handler to io.vertx.core.Future
No. of Instances - 3
No. of Commits - 3
No. of Projects - {'vert.x'}
Hierarchy/Composition: R_SUPER_T
Primitive Info: -
NameSpace: Internal -> Internal
Mapping:
Add or Remove Method invocation
completionHandler.handle(Future.failedFuture("Push reset by client"))
to
completionHandler.fail("Push reset by client")
resultHandler.handle(Future.succeededFuture(bytesWritten))
to
result.tryComplete(bytesWritten)
resultHandler.handle(Future.failedFuture(f.cause()))
to
result.tryFail(f.cause())
resultHandler.handle(Future.succeededFuture(bytesWritten))
to
result.tryComplete(bytesWritten)
resultHandler.handle(Future.failedFuture(f.cause()))
to
result.tryFail(f.cause())
Wrap or Un-wrap
addListener
to
addListener
Rename Variable
resultHandler
to
result
resultHandler
to
result
Update Anonymous class
{ @Override public void userEventTriggered( ChannelHandlerContext ctx, Object evt) throws Exception { if (evt instanceof RandomAccessFile) { ChannelFuture fut=ctx.writeAndFlush(new ChunkedFile((RandomAccessFile)evt,offset,length,8192)); fut.addListener(f -> { if (resultHandler != null) { if (f.isSuccess()) { resultHandler.handle(Future.succeededFuture(bytesWritten)); } else { resultHandler.handle(Future.failedFuture(f.cause())); } } fut.addListener(ChannelFutureListener.CLOSE); } ); } } }
to
{ @Override public void userEventTriggered( ChannelHandlerContext ctx, Object evt) throws Exception { if (evt instanceof RandomAccessFile) { ChannelFuture fut=ctx.writeAndFlush(new ChunkedFile((RandomAccessFile)evt,offset,length,8192)); fut.addListener(f -> { if (f.isSuccess()) { result.tryComplete(bytesWritten); } else { result.tryFail(f.cause()); } fut.addListener(ChannelFutureListener.CLOSE); } ); } } @Override public void exceptionCaught( ChannelHandlerContext ctx, Throwable cause) throws Exception { result.tryFail(cause); } }