|
From: Leif M. <le...@ta...> - 2003-07-02 05:36:36
|
Max, Another user just asked me about this same thing in the Help forums: https://sourceforge.net/forum/forum.php?thread_id=889788&forum_id=122338 Here is my excerpt: --- If you are using Windows, then the easiest thing for you to do would be to create a simple Java class which simply waits until 10:00am and then calls the main method of your real application. The JVM would always be running, but it would work. --- I did a quick web search and was surprised that there is not much out there to do cron jobs on Windows systems. I did find this application: BJS http://www.camelliasoftware.com/ But it is a bit pricy 8-| Maybe I should make one of those.... Akso this one: http://www.cosbatch.com/ I have never tried either of these or spent more than 5 minutes on their sites. If anyone knows of any other available tools please post. For now I would suggest just writing a simple class that sits idle until a specified time and then calls your application's main method. If your application does not work correctly if the main method is called more than once in the same JVM instance, then simply call WrapperManager.restart() after the main method completes. The JVM will then restart and wait until the specified time the following day. You should be able to get this up and running in a few minutes. Cheers, Leif Max Stolyarov wrote: > Leif, > > My name is Max Stolyarov. I was communicating on the issue that I am > having with a wrapper, probably my fault for not understanding its > functionality and behavior completely. My main issue is that my java > application is a simple application that has to do its job and exit. > Then I thought I can rely on the wrapper to restart my application > after a certain period of time specified by the wrapper.restart.delay > in the config file. Unfortunately this does not happen, and when my > application completes I see that application's service status is being > changed to stopped, which off cause will prevent my app from > restarting. Please help me to understand who and how can make > application restart; I am trying to accomplish the same thing as > "cron" jobs in Unix. Thanks in advance. > > Max > > -----Original Message----- > From: Bill Littman [mailto:bli...@to...] > Sent: Thursday, June 26, 2003 1:30 PM > To: Max Stolyarov > Subject: RE: More information on message posted to SorceForge.net > > Max- > > Good questions, and they are probably better off sent to Leif, the > author of Wrapper. Here are my guesses though. I am guessing that the > native part of wrapper is what is executed when the service starts. > The native part then starts a JVM with > org.tanukisoftware.wrapper.WrapperSimpleApp as the main class. The > config files tell WrapperSimpleApp how to behave. I am also guessing > that either the WrapperSimpleApp or the native code starts a thread > that performs some type of ping on a piece of wrapper that is on the > same thread that the app is on. If a response is not received after a > given time (which I am pretty sure is configurable) the JVM is restarted. > > Again, this is just a guess and if you find out let me know. > > You also say that: 'when my application terminates the service status > changes to "Stopped"'. Are you doing a System.exit? If so, probably > the app is not restarted. If not, then it is probably a configuration > issue. > > Hope this helps. > > -Bill > > -----Original Message----- > From: Max Stolyarov [mailto:MSt...@li...] > Sent: Thursday, June 26, 2003 11:47 AM > To: Bill Littman > Subject: RE: More information on message posted to SorceForge.net > > Bill, > > I am sorry for bombarding you with so many questions but I am just > lost here. Can you explain me how wrapper works and how it is able > to restart JVM when it terminates. The way I understand, the > wrapper is used to register class > "org.tanukisoftware.wrapper.WrapperSimpleApp" as a service and > this is the class that starts my java app. If this is correct, > then how does the wrapper senses when my application terminates > and when it should restart the JVM? What I see as I monitor my > services is that when my application terminates the service status > changes to "Stopped" and that's it; it never restarts again. > Please, if you have time help me with this issue. With my > application I need to monitor some activity on hard drive time > after time, but I don't want to block and wait inside the > application while I am waiting for a next time to check my > information. Thanks in advance > > Max > > -----Original Message----- > From: Bill Littman [mailto:bli...@to...] > Sent: Thursday, June 26, 2003 11:30 AM > To: Max Stolyarov > Subject: RE: More information on message posted to SorceForge.net > > Hi Max- > > Nope, never tried command line parameters with wrapper. Our apps > use System properties instead of command line parms (it is kind of > an unstated company policy) and they work just fine. > > -Bill > > -----Original Message----- > From: Max Stolyarov [mailto:MSt...@li...] > Sent: Thursday, June 26, 2003 9:54 AM > To: Bill Littman > Subject: RE: More information on message posted to SorceForge.net > > Bill, > > The problem was on my side and not with the wrapper. I think I > had a spelling mistake in the configuration file. If you don't > mind me asking, did you every tried to pass command line > parameters to the main method of your application that wrapper > runs. I tried to specify my command line parameter using > > wrapper.app.parameter.2 = "c:\\wrapper\\bin\\sampleApp.bat" > > but for some reason or not the main method in my application > threw ArrayOutofBoundException as it tried to read the first > argument - args[0]. Any ideas??? > > Thanks in advance, > > Max > > -----Original Message----- > From: Bill Littman [mailto:bli...@to...] > Sent: Thursday, June 26, 2003 8:41 AM > To: Max Stolyarov > Subject: RE: More information on message posted to SorceForge.net > > Hi Max- > > I did not play around with the service restart delay parm. I > have noticed that wrapper will restart my app on occasion and > it appears to work fine. Researching proper parameters for > this is on my to-do list. > > What did you do to get your app to work? I would like to > document it on my side in case we do more with wrapper. > > Thanks. > > -Bill > > -----Original Message----- > From: Max Stolyarov [mailto:MSt...@li...] > Sent: Thursday, June 26, 2003 8:33 AM > To: Bill Littman > Subject: RE: More information on message posted to > SorceForge.net > > Bill, > > Thanks, I got this working. I really appreciate all the > help. Did you ever try service restart delay parameter to > ensure that if or when service terminates the wrapper will > restart it after a certain time delay? Thanks > > Max > > -----Original Message----- > From: Bill Littman [mailto:bli...@to...] > Sent: Wednesday, June 25, 2003 3:06 PM > To: Max Stolyarov > Subject: RE: More information on message posted to > SorceForge.net > > Hey Max- > > I used the first method (WrapperSimpleApp). FYI, attached > are my configuration files. I broke them up into two > because sometime in the future, I will have two services > running. Common will be used by both services, and > Production is specific to that particular service. I will > have a Training configuration file that is a peer to > Production (and maybe more). > > Hope this helps. Let me know if you have any other questions. > > -Bill > > -----Original Message----- > From: Max Stolyarov [mailto:MSt...@li...] > Sent: Wednesday, June 25, 2003 2:14 PM > To: Bill Littman > Subject: RE: More information on message posted to > SorceForge.net > > Bill, > > Thanks for responding. I tried that already. Did you > use the first integration method to register your > application as NT service using > org.tanukisoftware.wrapper.WrapperSimpleApp or did you > write a class that implemented WrapperListener > interface? Thanks > > Max > > -----Original Message----- > From: Bill Littman [mailto:bli...@to...] > Sent: Wednesday, June 25, 2003 2:08 PM > To: Max Stolyarov > Subject: RE: More information on message posted to > SorceForge.net > > Hi Max- > > I am not sure this is everything, but I know if I add > the line directly below, the java frame displays. If > the line is not there, or if the value is false, the > frame does not display. > > wrapper.ntservice.interactive=true > > Hope this works for you. > > -Bill > > -----Original Message----- > From: Max Stolyarov > [mailto:MSt...@li...] > Sent: Wednesday, June 25, 2003 1:54 PM > To: Bill Littman > Subject: More information on message posted to > SorceForge.net > > Hello Bill, > > My name is Max. I have read the message that you > posted to the mailing list for java service > wrapper and I have a question for you. What did > you have to do to display a java frame from your > java application that you have registered as NT > service using Java Service wrapper? Did you have > to modify your wrapper.conf file in any way? I > wrote a simple application that I am trying to run > as a service under NT using > org.tanukisoftware.wrapper.WrapperSimpleApp and > which suppose to display a dialog window once in a > while, but I can't get the frame to display? I can > get it display when I run my application stand > alone but not when it runs as a service. > Appreciate all the help. > > Max Stolyarov > |