SOLARIS SIGNALS in JAVA

Hi,I am writing a java program which will be triggered by a shell script on solaris machine. how can i handle signals SIGUSR, SIGUSR2 etc... in the java program?Thanks in advanceRegardsHunger
[226 byte] By [J2EEHungera] at [2007-10-1 13:57:52]
# 1
You'll need to write native code for this, because its OS dependent.
sp00kera at 2007-7-10 17:13:27 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 2
You can handle OS signals in the shell script ("trap") and communicate them in some "pure java" way to the Java process.
BIJ001a at 2007-7-10 17:13:27 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 3

Hi,

the following trick might only work with some versions of Sun JDKs and is not recommended, however:

There is a class called sun.misc.Signal and an interface sun.misc.SignalHandler which does, what you need. But use it with care! The VM uses its own signal handlers and might interfere with yours. There is an option to the VM "-Xrs" which influences how the VM handles signals and which signals it handles by itself.

m.wintera at 2007-7-10 17:13:27 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 4
I have written a signal handler that works fine.However you shoudl note that java uses USRSIG2 and other signals for its own purposes. You cannot override some of these without upsetting the JVM.
Peter-Lawreya at 2007-7-10 17:13:27 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 5
Hi Peter,can you share the signal handler with us?Thanks in advanceRegardsj2eehunger
J2EEHungera at 2007-7-10 17:13:27 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 6
I would start with http://www-106.ibm.com/developerworks/ibm/library/i-signalhandling/And have a look at http://www.google.co.uk/search?q=sun.misc.signalhandler
Peter-Lawreya at 2007-7-10 17:13:27 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...