-1

I have a Java program set up to make a request to a server every second, using Restlet, but every week during the same time they do some maintenance for about a minute within the hours that I'm running my program.

As a result, I get a couple of 504 errors and then a 503 error, and then for some reason my program stops running. It just doesn't continue after the 503 error. It says:

a recoverable error was detected (503), attempting again in 2000ms

but it doesn't attempt again. Since I've got it set up to keep requesting the server every second (which it stops doing once it hits the "recoverable error"), I would like to know if there's a way to make the program ignore the 504 and 503 errors and just continue on like nothing happened.

Qiu
  • 5,651
  • 10
  • 49
  • 56
Beez
  • 391
  • 5
  • 6
  • 16
  • 1
    please post the portion of the code (as simple as possible) showing your loop that makes the call every second (and how you have your try/catch setup) – Foon Jul 03 '15 at 02:10
  • You're asking us to guess what's wrong with your programming without showing it to us. You're encouraging speculative answers. – spender Jul 03 '15 at 02:24

2 Answers2

1

I understand your client program is developped using Restlet. You can setup the client resource to not retry on error by calling ClientResource#setRetryOnError(false), and catch exceptions, as said above.

Thierry Boileau
  • 866
  • 5
  • 8
0

You should catch the exceptions and resume the application again. Do you logic to return or resume the application inside the catch block.

Mwesigye John Bosco
  • 1,148
  • 2
  • 11
  • 14
  • What exceptions are they though? I tried catching exceptions, but it didn't change anything, and I can't find any specific information about it. – Beez Jun 28 '15 at 15:37
  • what do you mean by "it didn't change anything"? – Thierry Boileau Jun 28 '15 at 19:25
  • I mean there was no difference between catching exceptions and not catching exceptions. It doesn't appear to be throwing an exception. – Beez Jun 29 '15 at 03:24