Here its mentioned,
"The client libraries make sharing a credential across threads straightforward. Each client library has a session (or user) object with a credential that it reuses throughout its lifetime. To share the credential across threads, simply construct each session using the same credential. In all client libraries, the credential is a thread-safe object that refreshes itself synchronously when its access token expires."
Credential oAuth2Credential = new OfflineCredentials.Builder()
.forApi(OfflineCredentials.Api.ADWORDS)
.withClientSecrets(GOOGLE_ADWORDS_CLIENT_ID, GOOGLE_ADWORDS_CLIENT_SECRET)
.withRefreshToken(refreshToken).build().generateCredential();
// Construct an AdWordsSession.
AdWordsSession session = new AdWordsSession.Builder().withClientCustomerId(clientCustomerId)
.withDeveloperToken(GOOGLE_ADWORDS_DEVELOPER_TOKEN)
.withOAuth2Credential(oAuth2Credential)
.withUserAgent("test_user").build();
AdWordsServicesInterface adWordsServices = AdWordsServices.getInstance();
userListService = adWordsServices.get(session, AdwordsUserListServiceInterface.class);
I am batching 20k emails from my end and for every 20k emails I am firing the above code. But according to the above quote
(which is a bit confusing), this is not a best practice? If I understand the above paragraph correctly, do you guys suggest that the
oAuth2Credential variable be made into Thread-Safe object and then it should be used to create session persistently?
Or If I am mistaken can you guys please help me in explaining this?
Thanks
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "AdWords API and Google Ads API Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adwords-api/-ZTdzU32paI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adwords-api+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/7c89fb07-650f-4599-b17c-9f634ce431b3%40googlegroups.com.