|
From: Russell B. <rb...@po...> - 2005-10-10 22:03:26
|
Unless I'm completely misunderstanding the instructions I assumed that the wrapper would constantly run and it would rerun my sub app on a desired time patter via wrapper.restart.delay. How ever my application starts up, runs once and the shuts down cleanly. Right now for testing tell my thread to just rerun 15 minutes after it ends, which doesn't seem right. To clarify, I want to basically run my java app every 15 minutes, but I want to run it as a service, because there is a large chuck of start up code/processing that I want to do once not 4 times an hour. Someone please help, yes I've searched the archives and help and found other similar questions that were either unanswered or had completely confusing ones that didn't seem to answer the actual question. Here is my configuration file. ---------------------------------------------------------------------------------------------- wrapper.java.command=D:\Java\jre_1.4.2\bin\java.exe wrapper.java.mainclass=com.POM.feedMonitor.Service wrapper.working.dir=D:\Java\Applications\FeedMonitor wrapper.console.format=PM wrapper.console.loglevel=DEBUG wrapper.logfile=D:/Java/Applications/FeedMonitor/wrapper.log wrapper.logfile.format=LPTM wrapper.logfile.loglevel=DEBUG wrapper.logfile.maxsize=0 wrapper.syslog.loglevel=NONE wrapper.console.title=Feed Monitor wrapper.ntservice.name=Feed_Monitor wrapper.ntservice.displayname=Feed Monitor wrapper.ntservice.description=Feed Monitor wrapper.ntservice.starttype=AUTO_START wrapper.ntservice.interactive=false wrapper.restart.delay=900 wrapper.ping.interval=15 ---------------------------------------------------------------------------------------------- |
|
From: Russell B. <rb...@po...> - 2005-10-11 12:00:25
|
Unless I'm completely misunderstanding the instructions I assumed that the wrapper would constantly run and it would rerun my sub app on a desired time patter via wrapper.restart.delay. How ever my application starts up, runs once and the shuts down cleanly. Right now for testing tell my thread to just rerun 15 minutes after it ends, which doesn't seem right. To clarify, I want to basically run my java app every 15 minutes, but I want to run it as a service, because there is a large chuck of start up code/processing that I want to do once not 4 times an hour. Someone please help, yes I've searched the archives and help and found other similar questions that were either unanswered or had completely confusing ones that didn't seem to answer the actual question. Here is my configuration file. ---------------------------------------------------------------------------------------------- wrapper.java.command=D:\Java\jre_1.4.2\bin\java.exe wrapper.java.mainclass=com.POM.feedMonitor.Service wrapper.working.dir=D:\Java\Applications\FeedMonitor wrapper.console.format=PM wrapper.console.loglevel=DEBUG wrapper.logfile=D:/Java/Applications/FeedMonitor/wrapper.log wrapper.logfile.format=LPTM wrapper.logfile.loglevel=DEBUG wrapper.logfile.maxsize=0 wrapper.syslog.loglevel=NONE wrapper.console.title=Feed Monitor wrapper.ntservice.name=Feed_Monitor wrapper.ntservice.displayname=Feed Monitor wrapper.ntservice.description=Feed Monitor wrapper.ntservice.starttype=AUTO_START wrapper.ntservice.interactive=false wrapper.restart.delay=900 wrapper.ping.interval=15 ---------------------------------------------------------------------------------------------- |
|
From: Leif M. <le...@ta...> - 2005-10-10 22:31:07
|
Russell, The restart functions are really only designed to restart a JVM which "fails" in any one of a number of ways. It sounds like in your case, the Java application is completing without problems and exiting normally. The Wrapper is handling this correctly by exiting. Is there a reason why you don't just create a thread within your JVM that runs an operation every 15 minutes? This way the JVM stays up. That would have the disadvantage of having the JVM take up memory while it is idle... One way that you could make this work is to add the following configuration properties to your wrapper.conf file. wrapper.on_exit.0=RESTART wrapper.restart.delay=900 See the following: http://wrapper.tanukisoftware.org/doc/english/prop-on-exit-n.html http://wrapper.tanukisoftware.org/doc/english/prop-restart-delay.html That should override the default shutdown behavior and queue up a restart when the JVM exits normally. Let me know how this works as I didn't actually try it just now... You might want to use a different exit code to trigger the restart so you have a way to actually cause the cycle to stop. Use System.exit(1) or something. Cheers, Leif Russell Brown wrote: > Unless I’m completely misunderstanding the instructions I assumed that > the wrapper would constantly run and it would rerun my sub app on a > desired time patter via > > wrapper.restart.delay. How ever my application starts up, runs once > and the shuts down cleanly. Right now for testing tell my thread to > just rerun 15 minutes after it ends, which doesn’t seem right. > > To clarify, I want to basically run my java app every 15 minutes, but > I want to run it as a service, because there is a large chuck of start > up code/processing that I want to do once not 4 times an hour. Someone > please help, yes I’ve searched the archives and help and found other > similar questions that were either unanswered or had completely > confusing ones that didn’t seem to answer the actual question. > > Here is my configuration file… > > ---------------------------------------------------------------------------------------------- > wrapper.java.command=D:\Java\jre_1.4.2\bin\java.exe > > wrapper.java.mainclass=com.POM.feedMonitor.Service > > wrapper.working.dir=D:\Java\Applications\FeedMonitor > > wrapper.console.format=PM > > wrapper.console.loglevel=DEBUG > > wrapper.logfile=D:/Java/Applications/FeedMonitor/wrapper.log > > wrapper.logfile.format=LPTM > > wrapper.logfile.loglevel=DEBUG > > wrapper.logfile.maxsize=0 > > wrapper.syslog.loglevel=NONE > > wrapper.console.title=Feed Monitor > > wrapper.ntservice.name=Feed_Monitor > > wrapper.ntservice.displayname=Feed Monitor > > wrapper.ntservice.description=Feed Monitor > > wrapper.ntservice.starttype=AUTO_START > > wrapper.ntservice.interactive=false > > wrapper.restart.delay=900 > > wrapper.ping.interval=15 > > ---------------------------------------------------------------------------------------------- > |
|
From: Russell B. <rb...@po...> - 2005-10-11 13:33:09
|
Sorry, I reposted the message because I actually sent it before I approved my subscription and I got an error email. The application I made some more changes last night and it now works as follows. I have a Service.class which is called by the wrapper. That starts a MonitorService thread, which then runs the actual FeedMonitor every 15 minutes. So is it stupid to have a thread running a thread that starts a new thread every 15 minutes, just to avoid a bunch of base db hits and processing every 15 minutes... I'm starting to think so, but it was at least a good practice in futility. Is what I have no correct or a bastardization of Java and the Wrapper in general? Thanks Russ -----Original Message----- From: wra...@li... [mailto:wra...@li...] On Behalf Of Leif Mortenson Sent: Monday, October 10, 2005 6:31 PM To: wra...@li... Subject: Re: [Wrapper-user] Service starts, app runs once, then shutdowns? Russell, The restart functions are really only designed to restart a JVM which "fails" in any one of a number of ways. It sounds like in your case, the Java application is completing without problems and exiting normally. The Wrapper is handling this correctly by exiting. Is there a reason why you don't just create a thread within your JVM that runs an operation every 15 minutes? This way the JVM stays up. That would have the disadvantage of having the JVM take up memory while it is idle... One way that you could make this work is to add the following configuration properties to your wrapper.conf file. wrapper.on_exit.0=RESTART wrapper.restart.delay=900 See the following: http://wrapper.tanukisoftware.org/doc/english/prop-on-exit-n.html http://wrapper.tanukisoftware.org/doc/english/prop-restart-delay.html That should override the default shutdown behavior and queue up a restart when the JVM exits normally. Let me know how this works as I didn't actually try it just now... You might want to use a different exit code to trigger the restart so you have a way to actually cause the cycle to stop. Use System.exit(1) or something. Cheers, Leif |
|
From: Leif M. <le...@ta...> - 2005-10-13 02:42:20
|
Russell,
I often write applications that contain cron-job like functions. I
even have a timer
manager component which simplifies the task as it is so common. Nothing
wrong
with it. ;-)
For your application, I would just have a single thread which has a
main loop
that calls a method running your FeedMonitor then sleeps for 15
minutes. If would
loop until the JVM decides its time to shut down.
You would want to implement a shutdown hook that would be able to
wake the
main loop up so it could exit in the middle of the 15 minute wake as
well. That
will be needed to make the app shutdown promptly.
Cheers,
Leif
Russell Brown wrote:
>Sorry, I reposted the message because I actually sent it before I approved my subscription and I got an error email.
>
>The application I made some more changes last night and it now works as follows. I have a Service.class which is called by the
>wrapper. That starts a MonitorService thread, which then runs the actual FeedMonitor every 15 minutes. So is it stupid to have a
>thread running a thread that starts a new thread every 15 minutes, just to avoid a bunch of base db hits and processing every 15
>minutes... I'm starting to think so, but it was at least a good practice in futility.
>
>Is what I have no correct or a bastardization of Java and the Wrapper in general?
>
>Thanks
>Russ
>
>
|