Hi,

The Java client library has a page on Thread Safety 
<https://github.com/googleads/googleads-java-lib/wiki/Thread-Safety> that 
answers many of the questions below.

Regarding the AdWordsSession, you could either keep a separate instance per 
account or reuse the same instance and call *setClientCustomerId(...)* between 
calls. Note, however, that instances of this class are *not* thread-safe.

If you still have questions after reading through the page linked above, 
let me know.

Thanks,
Josh, AdWords API Team

On Friday, January 23, 2015 at 12:41:09 PM UTC-5, Jonathan wrote:
>
> Hey everybody
>
> I have a question about the AdwordsSession object and the AdWordsServices 
> object and whats the best way to use these objects
>
> We have an MCC account with a few accounts.
>
> As for my understanding i will need to create a different instance 
> of AdwordsSession for each of the accounts. Can i keep these instance alive 
> for as much time as i want?
> For instance if i create an AdwordsSession for account A and then keep it 
> referenced in a Map with a key of the account, can i just pull the same 
> object later on (week or month or year)? i guess there would be some 
> timeout?
>
> I have also read that i should create a different instance of 
> the AdWordsServices object for each account. Why is that?
>
> Should the com.google.api.client.auth.oauth2.Credential object be created 
> only once and used by all of the different AdWordsSession.Builder() ? Or 
> creating one Credential for each session?
>
> Should this Credential object instance also be saved in memory for later 
> use or should be created each time it is needed? 
> This is the object that refreshes automatically right? i would love to 
> understand how that works and if i should do anything to make sure that 
> everything will work as expected?
>
>
> Sorry for asking so many questions at once - thanks for any help!
> Cheers
>
>
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
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 the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at http://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/d61b0b80-106f-4d28-a9b7-d8d575e4ac73%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to