List of usage examples for io.netty.channel ChannelHandlerContext fireChannelReadComplete
@Override ChannelHandlerContext fireChannelReadComplete();
From source file:org.opendaylight.usc.plugin.UscRemoteDeviceHandler.java
License:Open Source License
@Override public void channelReadComplete(ChannelHandlerContext ctx) throws Exception { if (isRemote(ctx)) { byte[] data = getPayloadFromByteBuf(buffer); LOG.trace(/*from w w w. j av a2s. c o m*/ "Read complete,send message to remote channel: " + routeId + ",message is " + new String(data)); broker.sendRequest(new UscRemoteDataMessage(routeId, data, true)); buffer.clear(); return; } // propagate the data to rest of handlers in pipeline ctx.fireChannelReadComplete(); }
From source file:org.rzo.netty.ahessian.io.InputStreamHandler.java
License:Apache License
/** * Instantiates a new input stream decoder. * /*from w w w . j a va 2 s . c o m*/ * @param executor * the thread pool */ /* * (non-Javadoc) * * @see * org.jboss.netty.channel.SimpleChannelUpstreamHandler#messageReceived( * org.jboss.netty.channel.ChannelHandlerContext, * org.jboss.netty.channel.MessageEvent) */ @Override public void channelRead(final ChannelHandlerContext ctx, final Object e) throws Exception { // System.out.println(System.currentTimeMillis()+" InputStreamHanlder.messageReceived +"); _in.write(((ByteBuf) e)); ctx.fireChannelReadComplete(); ctx.fireChannelRead(_in); // System.out.println(System.currentTimeMillis()+" InputStreamHanlder.messageReceived -"); }
From source file:org.rzo.netty.ahessian.rpc.client.HessianProxyFactory.java
License:Apache License
@Override public void channelRead(final ChannelHandlerContext ctx, Object e) throws Exception { if (e instanceof HessianRPCReplyMessage) { final HessianRPCReplyMessage message = (HessianRPCReplyMessage) e; {/* ww w.ja va2 s.c o m*/ final Long id = message.getCallId(); if (id != null) { final HessianProxyFuture future = (HessianProxyFuture) _openCalls.get(id); if (future == null) { ahessianLogger.warn("no future found for call-id " + id); return; } if (message.getCompleted() == null || Boolean.TRUE.equals(message.getCompleted())) if ((!future.hasCallbacks())) { _openCalls.remove(id); } if (_doneListener != null && _openCalls.isEmpty()) _doneListener.run(); if (future != null) // setting message in future may fire listeners -> run // in separate thread _executor.execute(new Runnable() { public void run() { // System.out.println("executing callback"); try { if (message.getValue() instanceof InputStreamReplyMessage) { InputStream stream = _clientStreamManager.newInputStream( ((InputStreamReplyMessage) message.getValue()).getId()); // caller should get a stream, not the // reply message.setValue(stream); } future.set(message, ctx); // check in case this was a callback if (future.isDone()) if (!future.hasCallbacks()) { _openCalls.remove(id); } } catch (Throwable e) { e.printStackTrace(); } } }); else ahessianLogger.warn("no future for call reply " + id + " " + message.getValue()); } else ahessianLogger.warn("message missing id " + message); } } else if (e instanceof InputStreamReplyMessage) { _clientStreamManager.messageReceived((InputStreamReplyMessage) e); } // ctx.fireChannelRead(e); ctx.fireChannelReadComplete(); }
From source file:org.rzo.netty.ahessian.rpc.server.HessianRPCServiceHandler.java
License:Apache License
@Override public void channelRead(ChannelHandlerContext ctx, Object obj) throws Exception { if (obj instanceof HessianRPCCallMessage) { HessianRPCCallMessage message = (HessianRPCCallMessage) obj; Long callbackCallId = (Long) message.getHeaders().get(Constants.CALLBACK_CALL_ID_HEADER_KEY); if (callbackCallId == null) { Integer group = (Integer) message.getHeaders().get(Constants.GROUP_HEADER_KEY); _pendingCalls.put(message, group); } else//from ww w . ja v a 2 s .c o m handleCallbackReply(message); } else throw new RuntimeException("unexpected message type: " + obj.getClass()); ctx.fireChannelReadComplete(); }
From source file:org.wso2.gw.emulator.http.client.handler.HttpClientHandler.java
License:Open Source License
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) { if (msg instanceof HttpResponse) { this.processorContext = new HttpClientProcessorContext(); this.processorContext.setClientInformationContext(clientInformationContext); this.responseContext = new HttpResponseContext(); this.responseInformationProcessor = new HttpResponseInformationProcessor(); this.responseAssertProcessor = new HttpResponseAssertProcessor(); HttpResponse response = (HttpResponse) msg; processorContext.setHttpResponse(response); responseInformationProcessor.process(processorContext); }/* w ww . j av a2 s .c o m*/ if (msg instanceof HttpContent) { HttpContent httpContent = (HttpContent) msg; ByteBuf content = httpContent.content(); if (content.isReadable()) { this.responseInformationProcessor.appendDecoderResult(responseContext, httpContent, content); } if (content instanceof LastHttpContent) { ctx.fireChannelReadComplete(); } } }
From source file:org.wso2.gw.emulator.http.client.HttpResponseProcessHandler.java
License:Open Source License
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) { if (msg instanceof HttpResponse) { this.responseContext = new HttpResponseContext(); this.responseInformationProcessor = new HttpResponseInformationProcessor(); this.responseAssertProcessor = new HttpResponseAssertProcessor(); HttpResponse response = (HttpResponse) msg; responseInformationProcessor.process(response, responseContext); }/* w w w . j a v a 2 s.c o m*/ if (msg instanceof HttpContent) { HttpContent httpContent = (HttpContent) msg; ByteBuf content = httpContent.content(); if (content.isReadable()) { this.responseInformationProcessor.appendDecoderResult(responseContext, httpContent, content); } if (content instanceof LastHttpContent) { ctx.fireChannelReadComplete(); } } }
From source file:org.wso2.gw.emulator.http.consumer.HttpResponseProcessHandler.java
License:Open Source License
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) { if (msg instanceof HttpRequest) { readingDelay(consumerContext.getReadingDelay()); this.httpRequestContext = new HttpRequestContext(); this.httpRequestInformationProcessor = new HttpRequestInformationProcessor(); this.httpResponseProcessor = new HttpResponseProcessor(consumerContext); HttpRequest httpRequest = (HttpRequest) msg; if (HttpHeaders.is100ContinueExpected(httpRequest)) { send100Continue(ctx);//from www. ja v a2s . c om } httpRequestInformationProcessor.process(httpRequest, httpRequestContext); } else { if (msg instanceof HttpContent) { HttpContent httpContent = (HttpContent) msg; ByteBuf content = httpContent.content(); if (content.isReadable()) { httpRequestInformationProcessor.appendDecoderResult(httpRequestContext, httpContent, content); } } if (msg instanceof LastHttpContent) { ctx.fireChannelReadComplete(); } } }
From source file:org.wso2.gw.emulator.http.server.handler.HttpServerHandler.java
License:Open Source License
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) { if (msg instanceof HttpRequest) { // readingDelay(serverInformationContext.getReadingDelay()); this.httpRequestInformationProcessor = new HttpRequestInformationProcessor(); this.httpResponseProcessor = new HttpResponseProcessor(); this.httpProcessorContext = new HttpServerProcessorContext(); this.httpProcessorContext.setHttpRequestContext(new HttpRequestContext()); this.httpProcessorContext.setServerInformationContext(serverInformationContext); HttpRequest httpRequest = (HttpRequest) msg; this.httpProcessorContext.setHttpRequest(httpRequest); if (HttpHeaders.is100ContinueExpected(httpRequest)) { send100Continue(ctx);/* w ww.ja va2 s . c o m*/ } httpRequestInformationProcessor.process(httpProcessorContext); } else { if (msg instanceof HttpContent) { HttpContent httpContent = (HttpContent) msg; if (httpContent.content().isReadable()) { httpProcessorContext.setHttpContent(httpContent); httpRequestInformationProcessor.process(httpProcessorContext); } } if (msg instanceof LastHttpContent) { this.requestResponseMatchingProcessor = new HttpRequestResponseMatchingProcessor(); this.requestResponseMatchingProcessor.process(httpProcessorContext); ctx.fireChannelReadComplete(); } } }
From source file:reactor.ipc.netty.channel.NettyOperations.java
License:Open Source License
/** * React after inbound {@link Channel#read} * * @param ctx the current {@link ChannelHandlerContext} *///w ww . ja va2 s. c om protected void afterInboundNext(ChannelHandlerContext ctx) { ctx.fireChannelReadComplete(); }
From source file:sailfish.remoting.handler.HeartbeatChannelHandler.java
License:Apache License
@Override public void channelReadComplete(ChannelHandlerContext ctx) throws Exception { ctx.channel().attr(ChannelAttrKeys.lastReadTimeMillis).set(System.currentTimeMillis()); ctx.fireChannelReadComplete(); }