How to time out calling a function from an application

M

Mullin

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;
}
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top