boris wrote:
> 
> I know JServ is handling Servlets,
> but I also need to have code running on the server side that
> is independent of client requests, like updating a database at
> certain time intervals, providing load information, etc...
> 
> Can I start, check, and stop Java applications under JServ?
> Or do I have to start the Java apps from the command line ?
> (But that invokes an additional JVM, doesn't it?)
> 
> I appreciate any help on this matter.
> Thanks a lot
> 
Yessir... I use this method:
in the init() method of the servlet I do something like:

        Class c=Class.forName("MyApplication");
        Object o=c.newInstance();
        Thread t=new Thread(new AppRunner(o),null);
        t.start();

And I have a runnable like

public class AppRunner {
        private Object o=null;
        private String argv[]=null;

        public Apprunner(Object o, String argv[]) {
                super();
                this.o=o;
                this.argv=argv;
        }

        public void run() {
                this.o.main(this.argv[]);
        }
}

Or something like it... I don't have the sources here, at the moment....
And this starts the application!

        Pier

-- 
-------------------------------------------------------------
  Be sure to vote for JServ in the Java Developer's Journal 
 Readers' Choice Awards Category number 2 (Apache-JServ #24)
http://www.sys-con.com/java/readerschoice/nominationform.html
-------------------------------------------------------------


----------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
READ THE FAQ!!!!     <http://java.apache.org/faq/>
Archives and Other:  <http://java.apache.org/main/mail.html/>
Problems?:           [EMAIL PROTECTED]

Reply via email to