avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Qing Yan <qing...@gmail.com>
Subject NettyServer readiness
Date Fri, 03 Dec 2010 07:54:17 GMT
Hello,

 Why the channel get closed after reading single message?

NettyServer.java :

public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) {
      try {
        NettyDataPack dataPack = (NettyDataPack) e.getMessage();
        List<ByteBuffer> req = dataPack.getDatas();
        List<ByteBuffer> res = responder.respond(req);
        dataPack.setDatas(res);
        e.getChannel().write(dataPack);
      } catch (IOException ex) {
        LOG.warn("unexpect error");
      } finally {
        e.getChannel().close();
      }
    }

Thus second RPC call via the same channel will throw exceptions:

14391 [New I/O server worker #1-1] INFO org.apache.avro.ipc.NettyServer -
[id: 0x0020be79, /10.13.19.38:1779 :> /10.13.19.38:1775] DISCONNECTED
14406 [New I/O server worker #1-1] INFO org.apache.avro.ipc.NettyServer -
[id: 0x0020be79, /10.13.19.38:1779 :> /10.13.19.38:1775] UNBOUND
14406 [New I/O server worker #1-1] INFO org.apache.avro.ipc.NettyServer -
[id: 0x0020be79, /10.13.19.38:1779 :> /10.13.19.38:1775] CLOSED
14563 [main] INFO org.apache.avro.ipc.NettyTransceiver - [id: 0x018088c0, /
10.13.19.38:1779 :> 0.0.0.0/0.0.0.0:1775] INTEREST_CHANGED
14563 [main] INFO org.apache.avro.ipc.NettyTransceiver - [id: 0x018088c0, /
10.13.19.38:1779 :> 0.0.0.0/0.0.0.0:1775] INTEREST_CHANGED
14563 [main] WARN org.apache.avro.ipc.NettyTransceiver - Unexpected
exception from downstream.
java.nio.channels.ClosedChannelException
    at
org.jboss.netty.channel.socket.nio.NioWorker.cleanUpWriteBuffer(NioWorker.java:637)
    at
org.jboss.netty.channel.socket.nio.NioWorker.writeFromUserCode(NioWorker.java:370)
    at
org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink.eventSunk(NioClientSocketPipelineSink.java:117)
    at org.jboss.netty.channel.Channels.write(Channels.java:632)
    at
org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:70)
    at org.jboss.netty.channel.Channels.write(Channels.java:611)
    at org.jboss.netty.channel.Channels.write(Channels.java:578)
    at
org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:259)
    at
org.apache.avro.ipc.NettyTransceiver.transceive(NettyTransceiver.java:125)
    at org.apache.avro.ipc.Requestor.request(Requestor.java:123)
    at
org.apache.avro.specific.SpecificRequestor.invoke(SpecificRequestor.java:52)
    at $Proxy4.publish(Unknown Source)
    at NettyTest$ServiceImpl.main(NettyTest.java:58)
Exception in thread "main" java.lang.NullPointerException
    at
org.apache.avro.ipc.ByteBufferInputStream.getBuffer(ByteBufferInputStream.java:78)
    at
org.apache.avro.ipc.ByteBufferInputStream.read(ByteBufferInputStream.java:46)
    at
org.apache.avro.io.BinaryDecoder$InputStreamByteSource.tryReadRaw(BinaryDecoder.java:830)
    at
org.apache.avro.io.BinaryDecoder$ByteSource.compactAndFill(BinaryDecoder.java:684)
    at org.apache.avro.io.BinaryDecoder.ensureBounds(BinaryDecoder.java:462)
    at org.apache.avro.io.BinaryDecoder.readLong(BinaryDecoder.java:171)
    at
org.apache.avro.io.BinaryDecoder.doReadItemCount(BinaryDecoder.java:352)
    at org.apache.avro.io.BinaryDecoder.readMapStart(BinaryDecoder.java:399)
    at
org.apache.avro.io.ValidatingDecoder.readMapStart(ValidatingDecoder.java:196)
    at
org.apache.avro.generic.GenericDatumReader.readMap(GenericDatumReader.java:224)
    at
org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:117)
    at
org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:105)
    at org.apache.avro.ipc.Requestor.request(Requestor.java:138)
    at
org.apache.avro.specific.SpecificRequestor.invoke(SpecificRequestor.java:52)
    at $Proxy4.publish(Unknown Source)
    at NettyTest$ServiceImpl.main(NettyTest.java:58)

Mime
View raw message