Print

Print


You'd need to implement it yourself.  Another approach you could do  
is have it listen on a port and flag a variable to inform you that  
you should die when an accept occurs.  Maybe create a thread like this:

public boolean pleaseDie = false;
public void makeKill()
	{
	Thread t = new Thread(new Runnable()
		{
		public void run()
			{
			StreamSocket sock = new StreamSocket(5000);
			sock.accept();
			pleaseDie = true;  // don't bother to synchronize
			}
		});
	t.start();
	}

Then to die you could just do:

	telnet localhost 5000

Another approach you could use is to interrupt the control-c signal  
in Unix.  Java can't trap signals by default.  But googling for "Java  
signals" gives lots of stuff on how to handle it using JNI.  Not a  
happy approach, but...

Sean


On Jun 1, 2008, at 12:36 PM, Shane wrote:

> Okay.  Is there an external way to send a running ecj process a  
> message to stop?
>
> Here is an simple example of how I could do this:
> I could have ecj poll periodically for a file named "stop.txt" on  
> the filesytem and if it exists, it would call Evolve.cleanup(state)  
> and System.exit(0).  Then anytime I want to stop ecj, I just create  
> the stop file and then delete it after ecj has stopped.
>
> Is there currently a way to stop ecj using a similar technique or  
> do I need to implement this myself?  Also, if I need to do this  
> myself, can you think of a better way to do it than the example above?