#12 Patch for forum thread: "Stopping all J-Interop threads"

open
nobody
None
5
2012-11-29
2011-10-07
Morten Andersen
No

Patch for forum thread: "Stopping all J-Interop threads (2010-05-27)"

Keywords: Stopping j-Interop threads, using j-Interop in application servers.

Patch attached for actively stopping the different threads and timers that j-Interop starts. This is usable for instance when using j-Interop in an application server where the shutdown hook will not be called at application undeploy.

See old discussion at:
http://sourceforge.net/projects/j-interop/forums/forum/600730/topic/3723405

Besides the threads/timers discussed in that forum thread I found another "loose" thread not being stopped by the shutdown hook in the SelectorManager-class (the thread with the name: 'jI_SelectorManager'). So I have added calling of SelectorManager#destroy() to the shutdown method via the new JIComTransportFactory#destroy()-method that I had to introduce.

The way to actively shutdown all the j-Interop threads is by calling the static method:
JISession#shutdownJInterop().

After this, I assume that j-Interop can no longer be used in the same classloader, i.e. this method should *only* be used in application servers.

(oh, and by the way: Would it make sense for the project maintainer to change the status of the patches to "closed" when they have been applied to the current source trunk. - I walked through the current open patches, and as far as I can see most of them has been patched into the source tree).

Discussion

  • patch v2 (NullPointerCheck) for JISession, JIComOxidRuntime, SelectorManager, JIComTransportFactory

     
    Attachments
  • Added a new version of the patch, with a check for serverSocket being null in the JIComOxidRuntime, as this would be the case if no connections has been made at all before shutdown.