How to time out calling a function from an application

Discussion in 'Java' started by Mullin, Apr 6, 2005.

  1. Mullin

    Mullin Guest

    inside my program, it will call a function of 3rd party java class,
    but sometimes it may hang and no error/exception thrown. then, my
    application doesn't work properly.

    i want to know how to make the following thrown an exception after a
    period of time to my main program, some timeout exception? then, my
    application can continue processing.

    try {
    objLog.info("before convert");
    jpegConverted =
    objConvertService.convert(_objAttachment.getData(),sExtension,"JPEG",((docconv.service.ImageProfile)
    (objObject)));
    objLog.info("after convert");
    } catch(IllegalFileTypeException _objIlegalfiletypeexception)
    {
    objLog.err(sContentName + ": Illegal File Type Exception
    returned by transcoder.",_objIlegalfiletypeexception);
    convertSuccess = false;
    } catch(ConvertException _objConvertexception) {
    objLog.err(sContentName + ": Convert Exception returned by
    transcoder.",_objConvertexception);
    convertSuccess = false;
    } catch(Exception _objException) {
    objLog.err(sContentName + ": Others Exception returned by
    transcoder.",_objException);
    convertSuccess = false;
    }
    Mullin, Apr 6, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andreas Lagemann
    Replies:
    8
    Views:
    477
    Mike Wahler
    Jan 10, 2005
  2. tiwy
    Replies:
    0
    Views:
    438
  3. flamesrock
    Replies:
    8
    Views:
    449
    Hendrik van Rooyen
    Nov 24, 2006
  4. Replies:
    3
    Views:
    1,993
    Steven D'Aprano
    Jul 25, 2009
  5. Richard A. DeVenezia
    Replies:
    4
    Views:
    120
    Lasse Reichstein Nielsen
    Sep 5, 2003
Loading...

Share This Page