本文整理了Java中org.jboss.netty.channel.Channels.fireMessageReceived()
方法的一些代码示例,展示了Channels.fireMessageReceived()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Channels.fireMessageReceived()
方法的具体详情如下:
包路径:org.jboss.netty.channel.Channels
类名称:Channels
方法名:fireMessageReceived
[英]Sends a "messageReceived" event to the first ChannelUpstreamHandler in the ChannelPipeline of the specified Channel.
[中]将“messageReceived”事件发送到指定通道的ChannelPipeline中的第一个ChannelUpstreamHandler。
代码示例来源:origin: io.netty/netty
/**
* Sends a {@code "messageReceived"} event to the first
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of
* the specified {@link Channel}.
*
* @param message the received message
*/
public static void fireMessageReceived(Channel channel, Object message) {
fireMessageReceived(channel, message, null);
}
代码示例来源:origin: io.netty/netty
public void readSettingsEnd() {
Object frame = spdySettingsFrame;
spdySettingsFrame = null;
Channels.fireMessageReceived(ctx, frame);
}
代码示例来源:origin: io.netty/netty
protected final void unfoldAndFireMessageReceived(
ChannelHandlerContext context, SocketAddress remoteAddress, Object result) {
if (unfold) {
if (result instanceof Object[]) {
for (Object r: (Object[]) result) {
Channels.fireMessageReceived(context, r, remoteAddress);
}
} else if (result instanceof Iterable<?>) {
for (Object r: (Iterable<?>) result) {
Channels.fireMessageReceived(context, r, remoteAddress);
}
} else {
Channels.fireMessageReceived(context, result, remoteAddress);
}
} else {
Channels.fireMessageReceived(context, result, remoteAddress);
}
}
代码示例来源:origin: io.netty/netty
public void readGoAwayFrame(int lastGoodStreamId, int statusCode) {
SpdyGoAwayFrame spdyGoAwayFrame = new DefaultSpdyGoAwayFrame(lastGoodStreamId, statusCode);
Channels.fireMessageReceived(ctx, spdyGoAwayFrame);
}
代码示例来源:origin: io.netty/netty
public void readPingFrame(int id) {
SpdyPingFrame spdyPingFrame = new DefaultSpdyPingFrame(id);
Channels.fireMessageReceived(ctx, spdyPingFrame);
}
代码示例来源:origin: io.netty/netty
public void readRstStreamFrame(int streamId, int statusCode) {
SpdyRstStreamFrame spdyRstStreamFrame = new DefaultSpdyRstStreamFrame(streamId, statusCode);
Channels.fireMessageReceived(ctx, spdyRstStreamFrame);
}
代码示例来源:origin: io.netty/netty
public void readWindowUpdateFrame(int streamId, int deltaWindowSize) {
SpdyWindowUpdateFrame spdyWindowUpdateFrame = new DefaultSpdyWindowUpdateFrame(streamId, deltaWindowSize);
Channels.fireMessageReceived(ctx, spdyWindowUpdateFrame);
}
代码示例来源:origin: io.netty/netty
public boolean offer(Object input) {
fireMessageReceived(getChannel(), input);
return !isEmpty();
}
}
代码示例来源:origin: io.netty/netty
public void readHeaderBlockEnd() {
Object frame = null;
try {
spdyHeaderBlockDecoder.endHeaderBlock(spdyHeadersFrame);
frame = spdyHeadersFrame;
spdyHeadersFrame = null;
} catch (Exception e) {
Channels.fireExceptionCaught(ctx, e);
}
if (frame != null) {
Channels.fireMessageReceived(ctx, frame);
}
}
代码示例来源:origin: io.netty/netty
public void readDataFrame(int streamId, boolean last, ChannelBuffer data) {
SpdyDataFrame spdyDataFrame = new DefaultSpdyDataFrame(streamId);
spdyDataFrame.setLast(last);
spdyDataFrame.setData(data);
Channels.fireMessageReceived(ctx, spdyDataFrame);
}
代码示例来源:origin: io.netty/netty
@Override
boolean process() throws IOException {
byte[] buf;
int readBytes;
PushbackInputStream in = channel.getInputStream();
int bytesToRead = in.available();
if (bytesToRead > 0) {
buf = new byte[bytesToRead];
readBytes = in.read(buf);
} else {
int b = in.read();
if (b < 0) {
return false;
}
in.unread(b);
return true;
}
fireMessageReceived(channel, channel.getConfig().getBufferFactory().getBuffer(buf, 0, readBytes));
return true;
}
代码示例来源:origin: io.netty/netty
public void handleUpstream(
ChannelHandlerContext ctx, ChannelEvent evt) throws Exception {
if (!(evt instanceof MessageEvent)) {
ctx.sendUpstream(evt);
return;
}
MessageEvent e = (MessageEvent) evt;
Object originalMessage = e.getMessage();
Object decodedMessage = decode(ctx, e.getChannel(), originalMessage);
if (originalMessage == decodedMessage) {
ctx.sendUpstream(evt);
} else if (decodedMessage != null) {
fireMessageReceived(ctx, decodedMessage, e.getRemoteAddress());
}
}
代码示例来源:origin: voldemort/voldemort
Channels.fireMessageReceived(ctx, coordinatorRequest);
代码示例来源:origin: io.netty/netty
@Override
boolean process() throws IOException {
ReceiveBufferSizePredictor predictor =
channel.getConfig().getReceiveBufferSizePredictor();
byte[] buf = new byte[predictor.nextReceiveBufferSize()];
DatagramPacket packet = new DatagramPacket(buf, buf.length);
try {
channel.socket.receive(packet);
} catch (InterruptedIOException e) {
// Can happen on interruption.
// Keep receiving unless the channel is closed.
return true;
}
fireMessageReceived(
channel,
channel.getConfig().getBufferFactory().getBuffer(buf, 0, packet.getLength()),
packet.getSocketAddress());
return true;
}
代码示例来源:origin: io.netty/netty
/**
* Replace this {@link FrameDecoder} in the {@link ChannelPipeline} with the given {@link ChannelHandler}. All
* remaining bytes in the {@link ChannelBuffer} will get send to the new {@link ChannelHandler} that was used
* as replacement
*
*/
public void replace(String handlerName, ChannelHandler handler) {
if (ctx == null) {
throw new IllegalStateException(
"Replace cann only be called once the FrameDecoder is added to the ChannelPipeline");
}
ChannelPipeline pipeline = ctx.getPipeline();
pipeline.addAfter(ctx.getName(), handlerName, handler);
try {
if (cumulation != null) {
Channels.fireMessageReceived(ctx, cumulation.readBytes(actualReadableBytes()));
}
} finally {
pipeline.remove(this);
}
}
代码示例来源:origin: io.netty/netty
private void issueStreamError(
ChannelHandlerContext ctx, SocketAddress remoteAddress, int streamId, SpdyStreamStatus status) {
boolean fireMessageReceived = !spdySession.isRemoteSideClosed(streamId);
ChannelFuture future = Channels.future(ctx.getChannel());
removeStream(streamId, future);
SpdyRstStreamFrame spdyRstStreamFrame = new DefaultSpdyRstStreamFrame(streamId, status);
Channels.write(ctx, future, spdyRstStreamFrame, remoteAddress);
if (fireMessageReceived) {
Channels.fireMessageReceived(ctx, spdyRstStreamFrame, remoteAddress);
}
}
代码示例来源:origin: io.netty/netty
@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
if (!readingChunks) {
HttpResponse res = (HttpResponse) e.getMessage();
if (res.getStatus().getCode() != HttpResponseStatus.OK.getCode()) {
throw new ChannelException("Unexpected HTTP response status: " + res.getStatus());
}
if (res.isChunked()) {
readingChunks = true;
} else {
ChannelBuffer content = res.getContent();
if (content.readable()) {
fireMessageReceived(HttpTunnelingClientSocketChannel.this, content);
}
// Reached to the end of response - close the request.
closeReal(succeededFuture(virtualChannel));
}
} else {
HttpChunk chunk = (HttpChunk) e.getMessage();
if (!chunk.isLast()) {
fireMessageReceived(HttpTunnelingClientSocketChannel.this, chunk.getContent());
} else {
readingChunks = false;
// Reached to the end of response - close the request.
closeReal(succeededFuture(virtualChannel));
}
}
}
代码示例来源:origin: voldemort/voldemort
store,
parseZoneId());
Channels.fireMessageReceived(ctx, voldemortStoreRequest);
} else {
logger.error("Error when getting store. Non Existing store name.");
代码示例来源:origin: apache/incubator-dubbo
Channels.fireMessageReceived(ctx, msg, event.getRemoteAddress());
代码示例来源:origin: apache/incubator-dubbo
Channels.fireMessageReceived(ctx, msg, event.getRemoteAddress());
内容来源于网络,如有侵权,请联系作者删除!