Article View: borland.public.jbuilder.java.api
Article #1898Re: How to close one java console from other?
From: Enrique Rodríguez
Date: Mon, 06 Aug 2001 22:42
Date: Mon, 06 Aug 2001 22:42
56 lines
2657 bytes
2657 bytes
Another aproach is to send a KILL signal to the JVM and catch it with a
shutdown hook.
// somewhere in the daemon (server) initilizing code.
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
// here goes the cleanup code.
}
});
I have using this aproach for a while and it worked ok.
To send a SIGKILL form an UNIX like OS, just type kill <pid> where pid is
the process id of the JVM. To get the pid use the ps command.
I've created one shell script wich takes the start and the stop parameter.
Some times, for some reason, the JVM doesn't get killed and i must kill it
with kill -9. If some one knows... I think this is a Blackdown's port
"feature" :)
I'm using JDK 1.3.0 from Blackdown in Linux 2.2.17.
I don't know how to kill an application from window's dos box. If some one
knows, please tell me! I'm curious :)
Quique
C. Lamont Gilbert wrote:
> RMI seems like the most organized way in this instance.
>
>
>
> "Andrey Ptashinskiy" <ptash@mail.ru> wrote in message
> news:3b6e8071_1@dnews...
>> Hi, All!
>> How to close one java console from other? For example, like Tomcat.
>> I have some thoughts, to use:
>> 1. socket for sending some message
>> 2. RMI
>>
>> Details:
>> I have some MyClass
>> To run it: "java MyClass -start"
>> It run in the same console. But I need to stop execution. It may be made
>> from other console.
>> For example: "java MayClass -stop"
>>
>> What can you offer?
>> Andrey.
>>
>>
>
>
>
Technical Details
Message-ID:
<3b6f1dac_2@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!cpk-news-hub1.bbnplanet.com!news.gtei.net!newscon02.news.prodigy.com!prodigy.com!nntp.flash.net!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnewsReferences:
<3b6e8071_1@dnews> <3b6e842b_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,9288e0cb92bd8828 X-Google-Attributes: gid1089d0,public X-Google-Thread: f74b3,9288e0cb92bd8828 X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-08-06 15:44:31 PST From: Enrique Rodríguez <anakin@conectate.com.uy> Subject: Re: How to close one java console from other? Newsgroups: borland.public.jbuilder.java.api,borland.public.jbuilder.java.language Followup-To: borland.public.jbuilder.java.api Date: Mon, 6 Aug 2001 19:42:59 -0300 References: <3b6e8071_1@dnews> <3b6e842b_1@dnews> Lines: 57 User-Agent: KNode/0.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit NNTP-Posting-Host: 200.40.25.97 Message-ID: <3b6f1dac_2@dnews> X-Trace: dnews 997137836 200.40.25.97 (6 Aug 2001 15:43:56 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!cpk-news-hub1.bbnplanet.com!news.gtei.net!newscon02.news.prodigy.com!prodigy.com!nntp.flash.net!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews