Re: command line WO Freeze
Re: command line WO Freeze
- Subject: Re: command line WO Freeze
- From: Patrick Middleton <email@hidden>
- Date: Mon, 23 Oct 2006 11:31:23 +0100
On 23 Oct 2006, at 11:03, Frank Stock wrote:
Hi,
I have to do crop images with Cocoa, so I wrote a JNI-framework to
solve that, but it seems that Core Image doesn't clean up very
well. So I use a terminal command now. The problem is, when my
command line-routine is crashing (I know that it shouldn't, but if
it does..) WO is hanging.
I use the following routine:
try{
Process runningApp = Runtime.getRuntime().exec("... to my
routine....");
...
runningApp.waitFor(); // If the command line routine is
crashing, WO is freezing here
...
}
catch(IOException e) {
NSLog.err.appendln("Didn't start up!");
throw e;
}
Any idea or a better way to solve my problem?
Thanks,
Frank Stock
NNS produtions
Belgium
________
Running the image conversion in a separate process space is good,
because if it crashes, it doesn't crash your application with it.
This technique is working well for me in WO451/ObjC with ImageMagick
convert on MacOSX 10.1.5 and with sips on MacOSX 10.4.x .
Do the image conversion in a separate thread. Have synchronised
instance variables/methods so that the calling thread can know when
the conversion is complete. Have the calling thread sleep for
perhaps 1s perhaps 10 times -- or use sleep() or wait() and catch an
InterruptedException Of course, if conversion has not completed
normally or crashed and exited in 10s, you have to decide what your
app should do next.
Your command-line routine probably isn't crashing -- it's probably
blocked waiting trying to read from standard input.
--
Patrick Middleton
OneStep Solutions plc
351 London Road Phone: +44 (0)1702 426400
Hadleigh Fax: +44 (0)1702 556855
Essex. SS7 2BT Email: email@hidden
England (MIME welcome)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden