We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello,
I have a problem with a piece of code, sometimes it is too slow. The code is responsible for testing a printer, the problem is that if the printer is offline, the program crashes for 15-20 seconds. I want that if after 2 seconds has not done the task, jump the code.
Something like a break if the time exceeds two seconds
I think it can work with try {} catch (TimeoutException e) {} but, I not know how could do exception.
I've been looking Thread and TimeoutException but not how to do.
Is there any way to do this?
thanks in advance
Answers
Isn't there a code processing for what I want to do?
This is not a hardware problem, it is an attempt to fix a bug in java.
https://forum.processing.org/two/discussion/7312/how-can-i-throw-exception-from-my-code
Thanks for anwswer Eeyorelife.
I can solved problen with Thread
It sample code mayby can help in future questions.