Re: Java and signal handler

Richard Troy <[email protected]>
Newsgroups gmane.linux.redhat.devel
Message-ID <[email protected]>
Ah....

Finally one I can answer:

...I'll referr you to the folks at Sun for more complete information, but
this pointer should get you going in the right direction. I'm only
familliar with catching the kill signal in Java because that's the only
one I happen to care about. (The other signals are likely caught in a
simmilar manner.) Here's how you declare a shutdown handler (catches
kill -9):


Runtime.getRuntime().addShutdownHook(Shutdown);

Note that 'Shutdown' is the name of a method in my code - change as
appropriate.

Regards,
Richard


-- 
Richard Troy, Chief Scientist
Science Tools Corporation
[email protected], 510-567-9957, http://ScienceTools.com/

On Thu, 10 Apr 2003, Ajay Bansal wrote:

> Date: Thu, 10 Apr 2003 15:32:22 +0530
> From: Ajay Bansal <[email protected]>
> Reply-To: [email protected]
> To: [email protected]
> Subject: Java and signal handler
>
>
> Hi All
>
> I have a java program. This is invoked by a shell script. And shell
> script is invoked by a C program.
>
> Now, this java program spawns 5-6 threads (depending on the load). For
> stopping the server, I send SIGTERM. But JAVA program is not responding
> to the signal..
>
> Do I need to handle the signals specially in the java programs, the way
> I do it in C program???
>
> -Ajay
>
>
>
>
> _______________________________________________
> Redhat-devel-list mailing list
> [email protected]
> https://listman.redhat.com/mailman/listinfo/redhat-devel-list
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.