ECJ-INTEREST-L Archives

June 2008

ECJ-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Monospaced Font
Show HTML Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Reply To:
ECJ Evolutionary Computation Toolkit <[log in to unmask]>
Date:
Sun, 1 Jun 2008 15:54:17 -0500
Content-Type:
multipart/alternative
Parts/Attachments:
text/plain (1753 bytes) , text/html (2870 bytes)
The socket approach looks like it will do the trick.  Thanks.

On Sun, Jun 1, 2008 at 1:21 PM, Sean Luke <[log in to unmask]> wrote:

> 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?
>>
>


ATOM RSS1 RSS2