1 Reply Latest reply on Apr 22, 2004 1:40 PM by Adrian Brock

    error on connection.close()

    null null Newbie

      I have an MDB that sends a messaeg to another JMS Queue. When I do a
      QueueConnection connect.close()
      on the SENDING MDB I find that I get the following exception on the RECEIVING MDB:

      2004-04-22 14:07:31,384 TRACE [org.jboss.mq.il.uil2.SocketManager] WriteTask was interrupted
      java.lang.InterruptedException
       at EDU.oswego.cs.dl.util.concurrent.LinkedQueue.take(LinkedQueue.java:106)
       at org.jboss.mq.il.uil2.SocketManager$WriteTask.run(SocketManager.java:473)
       at java.lang.Thread.run(Thread.java:534)
      2004-04-22 14:07:31,384 DEBUG [org.jboss.mq.il.uil2.SocketManager] End WriteTask.run
      2004-04-22 14:07:31,384 TRACE [org.jboss.mq.il.uil2.SocketManager] Exiting on IOE
      java.net.SocketException: socket closed
       at java.net.SocketInputStream.socketRead0(Native Method)
       at java.net.SocketInputStream.read(SocketInputStream.java:129)
       at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
       at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
       at org.jboss.util.stream.NotifyingBufferedInputStream.read(NotifyingBufferedInputStream.java:67)
       at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2133)
       at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2313)
       at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2380)
       at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2452)
       at java.io.ObjectInputStream$BlockDataInputStream.readByte(ObjectInputStream.java:2601)
       at java.io.ObjectInputStream.readByte(ObjectInputStream.java:845)
       at org.jboss.mq.il.uil2.SocketManager$ReadTask.run(SocketManager.java:278)
       at java.lang.Thread.run(Thread.java:534)
      2004-04-22 14:07:31,399 DEBUG [org.jboss.mq.il.uil2.ServerSocketManagerHandler] Exiting on IOE
      java.net.SocketException: socket closed
       at java.net.SocketInputStream.socketRead0(Native Method)
       at java.net.SocketInputStream.read(SocketInputStream.java:129)
       at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
       at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
       at org.jboss.util.stream.NotifyingBufferedInputStream.read(NotifyingBufferedInputStream.java:67)
       at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2133)
       at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2313)
       at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2380)
       at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2452)
       at java.io.ObjectInputStream$BlockDataInputStream.readByte(ObjectInputStream.java:2601)
       at java.io.ObjectInputStream.readByte(ObjectInputStream.java:845)
       at org.jboss.mq.il.uil2.SocketManager$ReadTask.run(SocketManager.java:278)
       at java.lang.Thread.run(Thread.java:534)
      2004-04-22 14:07:31,399 DEBUG [org.jboss.mq.il.uil2.SocketManager] End ReadTask.run


      The receiving MDB processes the message fine, the exception just worries me. If I don't do the connect.close(), the exception does not appear.
      For now I am not doing the connect.close() and allowing the GC to kill the connection object, but I would rather do this explicitly. I realize its a TRACE level log, so is the exception something I should worry about?



        • 1. Re: error on connection.close()
          Adrian Brock Master

          The interrupted exception is how it stops the thread internally.

          See ReadTask.stop() or WriteTask.stop()

          You should not leave it to the garbage collector, that is a guaranteed mechanism
          to leave sockets open and run out of client sockets to bind to.
          The gc is only guaranteed to run when you are running out of memory, not
          running out sockets.

          Besides, jbossmq's Connection implementation has no
          finalize()
          {
          this.close();
          }

          it wouldn't work because the connection is hard referenced by the ping clock
          daemon (it would never get called).

          Regards,
          Adrian