private void invokeAndClose(ChannelHandlerContext ctx, Object target, BoundExecutable boundExecutable, MethodExecutionHandle<?, ?> methodExecutionHandle, boolean isClose) { Object result; try { result = invokeExecutable(boundExecutable, methodExecutionHandle); } catch (Exception e) { if (LOG.isErrorEnabled()) { LOG.error("Error invoking @OnClose handler " + target.getClass().getSimpleName() + "." + methodExecutionHandle.getExecutableMethod() + ": " + e.getMessage(), e); } ctx.close(); return; } if (Publishers.isConvertibleToPublisher(result)) { Flowable<?> flowable = instrumentPublisher(ctx, result); flowable.toList().subscribe((BiConsumer<List<?>, Throwable>) (objects, throwable) -> { if (throwable != null) { if (LOG.isErrorEnabled()) { LOG.error("Error subscribing to @" + (isClose ? "OnClose" : "OnError") + " handler for WebSocket bean [" + target + "]: " + throwable.getMessage(), throwable); } } ctx.close(); }); } else { ctx.close(); } }
try { BoundExecutable finalBoundExecutable = boundExecutable; Object result = invokeExecutable(finalBoundExecutable, openMethod); if (Publishers.isConvertibleToPublisher(result)) { Flowable<?> flowable = instrumentPublisher(ctx, result);
); Object result = invokeExecutable(boundExecutable, messageHandler); if (Publishers.isConvertibleToPublisher(result)) { Flowable<?> flowable = instrumentPublisher(ctx, result);