How to close BoxDeveloperEditionAPIConnection or BoxTransactionalAPIConnection ?
AnsweredWe are creating one BoxDeveloperEditionAPIConnection in main thread like :
BoxDeveloperEditionAPIConnection api = new BoxDeveloperEditionAPIConnection(...);
Then we create multiple daemon threads and in each thread we create :
BoxTransactionalAPIConnection = new BoxTransactionalAPIConnection(api.getAccessToken());
So now we have one BoxDeveloperEditionAPIConnection and multiple BoxTransactionalAPIConnection ' s
The question is how to close these connections? We couldn't find any method for closing the connection.
Should we call revokeToken on each connection instead ?
Would appreciate any help or suggestion in this. Thanks.
-
Hello,
As mentioned in this guide, tokens are valid for 60 minutes. Are you using one of our SDKS? Token management should be built in if so.
Thanks,
Alex, Box Developer Advocate
-
We are using following Box SDK : GitHub - box/box-java-sdk: The Box SDK for Java.
So if we create mulitple instances of BoxDeveloperEditionAPIConnection or BoxTransactionalAPIConnection then don't we need to manage closing of these connections ?
Is there anything we need to manage on our side for these connections or tokens ?
Thanks.
-
Hi Abhishek Mayee,
You don't need to manage the BoxDeveloperEditionAPIConnection nor BoxTransactionalAPIConnection. There is no resource "opened" like for example socket that you should close. Connections basically manage token exchange so that you do not need to worry about this.
If you want to revoke tokens used you can call api.revokeToken() . As Alex Novotny said token will expire after 60 minutes.
Please sign in to leave a comment.
Comments
3 comments