"Michael Bothager" <-> wrote in message
news:3bf17de4$0$745$edfadb0f@dspool01.news.tele.dk...
> Windows Resource Kit har værktøj til at installere et
> vilkårligt program som en service, kaldet anysrv.exe og
> tilhørende program instsrv.exe til at oprette servicen.
>
> Største ulempe er dog, at når man standser servicen,
> så "crasher" JVM'en, samt at hvis JVM'en "crasher" af
> anden årsag (f.ex. StackOverflow
, ja så triller servicen
> fornøjeligt videre inde i service manageren.
>
> Husk at du skal anvende JVM'en fra JDK 1.3.1 for at den
> skal "overleve" at du logger ud fra maskinen. De ædre JDK'er
> reagerede på de kontrol-events, der sker ved logoff.
Dette var faktisk først et problem fra og med version JDK 1.3.0. Version
1.2.x har ikke det problem. Problemet er at VM'en "lytter" på system event
og fanger derfor logoff eventen. Dette problem lå længe øverst (flest votes)
på SUN's bugliste og er blevet løst fra og med version 1.3.1. Desvære skal
du, så vidt jeg husker, give VM'en specielt -Xrs parameter (reduce use of OS
signals by Java/VM (see documentation)) for at den ikke stadig terminere ved
logoff eventen. See evt følgende side i dokumentation:
http://java.sun.com/j2se/1.3/docs/tooldocs/win32/java.html
-Xrs
Reduces usage of operating-system signals by the Java virtual machine (JVM).
This option is available beginning with J2SE 1.3.1.
In J2SE 1.3.0, the Shutdown Hooks facility was added to allow orderly
shutdown of a Java application. The intent was to allow user cleanup code
(such as closing database connections) to run at shutdown, even if the JVM
terminates abruptly.
The JVM watches for console control events to implement shutdown hooks for
abnormal JVM termination. Specifically, the JVM registers a console control
handler which begins shutdown-hook processing and returns TRUE for
CTRL_C_EVENT, CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT, and CTRL_SHUTDOWN_EVENT.
The JVM uses a similar mechanism to implement the pre-1.2 feature of dumping
thread stacks for debugging purposes. Sun's JVM uses CTRL_BREAK_EVENT to
perform thread dumps.
If the JVM is run as a service (for example, the servlet engine for a web
server), it can receive CTRL_LOGOFF_EVENT but should not initiate shutdown
since the operating system will not actually terminate the process. To avoid
possible interference such as this, the -Xrs command-line option has been
added beginning with J2SE 1.3.1. When the -Xrs option is used on Sun's JVM,
the JVM does not install a console control handler, implying that it does
not watch for or process CTRL_C_EVENT, CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT,
or CTRL_SHUTDOWN_EVENT.
There are two consequences of specifying -Xrs:
a.. Ctrl-Break thread dumps are not available.
b.. User code is responsible for causing shutdown hooks to run, for
example by calling System.exit() when the JVM is to be terminated.
/Christian Damsgaard
> Mvh Michael
>
>
>