Skip to main content
Question

Box java sdk - too many requests

  • May 22, 2025
  • 4 replies
  • 55 views

Forum|alt.badge.img

Hi,

 

I'm using box java sdk to integrate my application to BOX. I want to know how 429 error responses from BOX server are being handled by box java sdk. Whether it retries the request after time specified in the Retry-After header or not?

 

And another thing whatever value we are in Retry-After header will in seconds or milliseconds?

 

Any help would be appreciated.

 

Thanks in advance.

4 replies

Forum|alt.badge.img

Hey  ,

 

The Java SDK does retry for cases of 5XX and 429. How we attempt retry is with exponential backoff with randomized jitter to negate too many requests firing off again at once with the retry.

 

You can see the logic for this backoff here.

 

The reason for using this type of backoff strategy is to make sure that the multitude of requests that could potentially be sent gets smoothed over a period of time on the retry and not too many of the requests  are being sent over concurrently again.

 

The retry time is usually denoted in milliseconds.

 

Let us know if this is helpful and if you have any other questions please reach out. And for SDK specific issues please feel free to file a request here.


Forum|alt.badge.img

Can you please inform us how many times it'll we be retried before giving up?


Forum|alt.badge.img

Hey ,

 

The request will be retried 3 times before stopping.


Forum|alt.badge.img

Hi Bharath N V,

 

You can set the setMaxRequestAttempts and setConnectTimeout on the BoxAPIConnection to get better results.

 

Example:

BoxAPIConnection api;

api = BoxDeveloperEditionAPIConnection.getAppEnterpriseConnection(boxConfig);
api.setMaxRequestAttempts(20); // number of attempts
api.setConnectTimeout(10000); // time out in milliseconds

 

I have the same issue.

 

Regards,

 

Marcel