1 Reply Latest reply on Oct 21, 2002 10:22 AM by trosenbaum

    Client using OIL2 lingers 1 minute at exit

    trosenbaum

      A client using the OIL2 invocation layer lingers 1 minute when exiting.

      Did the following:

      Create a TopicConnection (OIL2ConnectionFactory)
      Create a TopicSession (untransacted, auto ack)
      Lookup a Topic
      Create a TopicPublisher for the Topic
      Create a TemporaryTopic
      Create a TopicSubscriber for the TemporaryTopic
      Publish a message using TopicPublisher
      close() TopicPublisher
      close() TopicSubscriber
      close() TopicSession
      close() TopicConnection
      return from main thread

      At this point, there is a 1 minute
      delay before the process actually exits.

      When using OIL instead (ConnectionFactory)
      the process exits immediately.

      The delay has to do with the PooledExecutor
      used by the OIL2SocketHandler.

      This can be fixed by modifying the
      OIL2SocketHandler.stop() method
      to interrupt all tasks in its pool:

      Change:

      public void stop()
      {
      if (log.isTraceEnabled())
      log.trace("Stopping");
      running = false;
      worker.interrupt();
      }

      To:

      public void stop()
      {
      if (log.isTraceEnabled())
      log.trace("Stopping");
      running = false;
      worker.interrupt();
      pool.interruptAll();
      }

      I don't know enough about the OIL2 code yet to
      say for certain that this is the right thing to
      do. I'm hoping that someone who does understand
      OIL2 code fully can look at/fix this issue.

      After applying the above modification, the same
      sequence above results in the process exiting
      immediately when the main thread exits (no more
      1 minute delay).

      I also noted that the version of the "concurrent"
      library used by JBoss is apparently older than the
      current version released by its developer (e.g.
      the latest PooledExecutor has a shutdownNow() method
      that is not present in the version used by JBoss).

      I entered a bug for this behavior on SourceForge.

        • 1. Re: Client using OIL2 lingers 1 minute at exit
          trosenbaum

          Well, like I said, I don't understand this code.
          With the above change in place, there is an
          occassional infinite hang when doing a close()
          on the Connection:

          Connection.close (Connection:425)
          OIL2SocketHandler.connectionClosing
          (OIL2ServerIL:346)
          OIL2SocketHandler.synchRequest
          (OIL2SocketHandler:411)

          hangs here in o = slot.take()