How to keep JRE running at W2K logoff?

A

Adam Sandler

Hello,

I have a Java application which processes messages and places data
extracted from those messages into a database. Someone suggested that
if application was made into a service then the message processing
would be truely automatic.

At any rate, the app's jar was made into a Windows service and
everything works great... except for one thing, when the message
processing service is running and a user logs off, the javaw.exe
process associated with the custom integrated message processing
service is terminated as well.

This really stinks... in the meantime, I have a clunky script which
monitors for interactive logoffs and restarts the message processing
service when needed. This is a good workaround to keep messages
getting automatically sent to the database during off hours and/or when
nobody is logged on.

However, I hate the word "workaround". Furthermore, there are a number
of drawbacks to restarting the service at logoff... among some of the
more major ones would be in Windows land, the built in or system
accounts can sometimes be viewed as interactive logoffs and the result
is, depending on network processes like replication, there can be many,
many service restarts during the day -- even when no human is actively
using the system!

Is there any way I can force the JVM for this process not to die at
logoff?

Thanks!
 
S

Steve W. Jackson

Adam Sandler said:
Hello,

I have a Java application which processes messages and places data
extracted from those messages into a database. Someone suggested that
if application was made into a service then the message processing
would be truely automatic.

At any rate, the app's jar was made into a Windows service and
everything works great... except for one thing, when the message
processing service is running and a user logs off, the javaw.exe
process associated with the custom integrated message processing
service is terminated as well.

This really stinks... in the meantime, I have a clunky script which
monitors for interactive logoffs and restarts the message processing
service when needed. This is a good workaround to keep messages
getting automatically sent to the database during off hours and/or when
nobody is logged on.

However, I hate the word "workaround". Furthermore, there are a number
of drawbacks to restarting the service at logoff... among some of the
more major ones would be in Windows land, the built in or system
accounts can sometimes be viewed as interactive logoffs and the result
is, depending on network processes like replication, there can be many,
many service restarts during the day -- even when no human is actively
using the system!

Is there any way I can force the JVM for this process not to die at
logoff?

Thanks!

Indeed there is. There's an open source product available called
JavaService at <http://javaservice.objectweb.org/>. I've employed it in
order to set up two services related to my application. It allows you
to specify parameters to pass to the Java app at startup, as well as
designating means of stopping the service and setting other parameters.
It's been improved since I initially discovered and employed it.

= Steve =
 
I

Igor Kolomiyets

Hi,

add -Xrs key when you launch javaw (or java) process. It stops java from
listening and reacting on OS signals. There is one overhead of using it,
you should add your own shutdown hook to the program as it will not stop
execution after Ctrl+C is pressed. Shudtown hooks should explicitly call
System.exit().

Best regards,
Igor.

Adam Sandler пишет:
 
A

Adam Sandler

Run it on a real operating system? ;-)

Was that really necessary? Unfortunately, IT managers and government
users have a hard-on for all things Microsoft. I don't get to choose
the platform; I just have to make it work.

At any rate thanks to all for their help!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top