Package net.gleamynode.netty.channel

Examples of net.gleamynode.netty.channel.MessageEvent


            case INTEREST_OPS:
                OioWorker.setInterestOps(channel, future, ((Integer) value).intValue());
                break;
            }
        } else if (element instanceof MessageEvent) {
            MessageEvent event = (MessageEvent) element;
            OioSocketChannel channel = (OioSocketChannel) event.getChannel();
            ChannelFuture future = event.getFuture();
            Object message = event.getMessage();
            OioWorker.write(channel, future, message);
        }
    }
View Full Code Here


        if (!(element instanceof MessageEvent)) {
            context.sendUpstream(element);
            return;
        }

        MessageEvent e = (MessageEvent) element;
        if (!(e.getMessage() instanceof ByteArray)) {
            context.sendUpstream(element);
            return;
        }

        ByteArray src = (ByteArray) e.getMessage();
        byte[] dst = new byte[src.length()];
        src.get(src.firstIndex(), dst);
        ChannelUtil.fireMessageReceived(context, e.getChannel(), new String(dst, charsetName));
    }
View Full Code Here

        if (!(element instanceof MessageEvent)) {
            context.sendDownstream(element);
            return;
        }

        MessageEvent e = (MessageEvent) element;
        if (!(e.getMessage() instanceof String)) {
            context.sendDownstream(element);
            return;
        }

        String src = (String) e.getMessage();
        ChannelUtil.write(
                context, e.getChannel(), e.getFuture(), new HeapByteArray(src.getBytes(charsetName)));
    }
View Full Code Here

        if (!(element instanceof MessageEvent)) {
            context.sendDownstream(element);
            return;
        }

        MessageEvent e = (MessageEvent) element;
        ByteArrayOutputStream bout = new ByteArrayOutputStream(initialCapacity);
        bout.write(LENGTH_PLACEHOLDER);
        ObjectOutputStream oout = new CompactObjectOutputStream(bout);
        oout.writeObject(e.getMessage());
        oout.flush();
        oout.close();

        byte[] msg = bout.toByteArray();
        int bodyLen = msg.length - 4;
        msg[0] = (byte) (bodyLen >>> 24);
        msg[1] = (byte) (bodyLen >>> 16);
        msg[2] = (byte) (bodyLen >>>  8);
        msg[3] = (byte) (bodyLen >>>  0);

        ChannelUtil.write(
                context, e.getChannel(), e.getFuture(), new HeapByteArray(msg));
    }
View Full Code Here

            case INTEREST_OPS:
                NioWorker.setInterestOps(channel, future, ((Integer) value).intValue());
                break;
            }
        } else if (e instanceof MessageEvent) {
            MessageEvent event = (MessageEvent) e;
            NioSocketChannel channel = (NioSocketChannel) event.getChannel();
            channel.writeBuffer.offer(event);
            NioWorker.write(channel);
        }
    }
View Full Code Here

        if (!(evt instanceof MessageEvent)) {
            context.sendDownstream(evt);
            return;
        }

        MessageEvent e = (MessageEvent) evt;
        ChannelBufferOutputStream bout =
            new ChannelBufferOutputStream(dynamicBuffer(estimatedLength));
        bout.write(LENGTH_PLACEHOLDER);
        ObjectOutputStream oout = new CompactObjectOutputStream(bout);
        oout.writeObject(e.getMessage());
        oout.flush();
        oout.close();

        ChannelBuffer msg = bout.buffer();
        msg.setInt(0, msg.writerIndex() - 4);

        write(context, e.getChannel(), e.getFuture(), msg);
    }
View Full Code Here

            case INTEREST_OPS:
                NioWorker.setInterestOps(channel, future, ((Integer) value).intValue());
                break;
            }
        } else if (e instanceof MessageEvent) {
            MessageEvent event = (MessageEvent) e;
            NioSocketChannel channel = (NioSocketChannel) event.getChannel();
            channel.writeBuffer.offer(event);
            NioWorker.write(channel);
        }
    }
View Full Code Here

            case INTEREST_OPS:
                OioWorker.setInterestOps(channel, future, ((Integer) value).intValue());
                break;
            }
        } else if (e instanceof MessageEvent) {
            MessageEvent event = (MessageEvent) e;
            OioSocketChannel channel = (OioSocketChannel) event.getChannel();
            ChannelFuture future = event.getFuture();
            Object message = event.getMessage();
            OioWorker.write(channel, future, message);
        }
    }
View Full Code Here

        if (!(evt instanceof MessageEvent)) {
            context.sendUpstream(evt);
            return;
        }

        MessageEvent e = (MessageEvent) evt;
        if (!(e.getMessage() instanceof ChannelBuffer)) {
            context.sendUpstream(evt);
            return;
        }

        ChannelBuffer src = (ChannelBuffer) e.getMessage();
        byte[] dst = new byte[src.readableBytes()];
        src.getBytes(src.readerIndex(), dst);
        fireMessageReceived(context, e.getChannel(), new String(dst, charsetName));
    }
View Full Code Here

        if (!(evt instanceof MessageEvent)) {
            context.sendDownstream(evt);
            return;
        }

        MessageEvent e = (MessageEvent) evt;
        if (!(e.getMessage() instanceof String)) {
            context.sendDownstream(evt);
            return;
        }

        String src = (String) e.getMessage();
        write(context, e.getChannel(), e.getFuture(), ChannelBuffers.wrappedBuffer(src.getBytes(charsetName)));
    }
View Full Code Here

TOP

Related Classes of net.gleamynode.netty.channel.MessageEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.