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 PROTECTED]
England                            (MIME welcome)

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to