You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by None None <ja...@hotmail.com> on 2004/10/07 16:31:57 UTC
How to write app class for proc run?
So far I have this... But I cant seem to get it to stop when I execute it...
Thanks
public class Executer
{
private static Executer daemon = null;
private boolean state = false;
public static void main(String[] args)
{
if(daemon == null)
{
daemon = new Executer();
try
{
daemon.init();
}
catch(Throwable t)
{
t.printStackTrace();
return;
}
}
if(args.length > 0)
if(args[0].equals("start"))
daemon.start();
else if(args[0].equals("stop"))
daemon.stop();
}
public void init()
{
state = true;
}
public void start()
{
while(state)
{
System.out.println("Running...");
try
{
Thread.sleep(1000);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
}
public void stop()
{
state = false;
}
}
_________________________________________________________________
Scan and help eliminate destructive viruses from your inbound and outbound
e-mail and attachments.
http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines
Start enjoying all the benefits of MSNŽ Premium right now and get the
first two months FREE*.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org