No. Instances don't get reloaded per request with Endpoints. That would be
a terrible waste of resources.

Sorry, I probably should have clarified/explained more in my previous
email, but I was in a bit of a rush when I wrote that. Endpoints doesn't
support static methods ( see this article, scroll down to the API Methods
header<https://cloud.google.com/developers/articles/google-cloud-endpoints-for-android>)
unless they're marked as private. When OP tried to run his static
method,
it may not have run or failed off.

In addition, I cheated a little bit on the answer and noted that the OP
cross-posted his question to
SO<http://stackoverflow.com/questions/23123160/google-cloud-endpoint-initialization>,
where he said that he needed data tables precomputed during init. That's
something that really needs to be moved to a regular cron or similar.

@OP/Mike: Can you post a simple test case?




-----------------
-Vinny P
Technology & Media Advisor
Chicago, IL

App Engine Code Samples: http://www.learntogoogleit.com




On Thu, Apr 24, 2014 at 12:50 PM, Gilberto Torrezan Filho <
[email protected]> wrote:

> Let me see if I understood correctly: are you saying a instance of my
> entire VM are launched every time a request is handled by the GCE engine?
> All my singleton classes (DAOs, default values, some utilities) are
> reinstantiated each request?
>
> I don't save sensitive state in memory (I use Memcache/Datastore for
> that), but some objects cloud be reused among requests, the way it works on
> regular GAE frontend requests.
>
> On Wednesday, April 23, 2014 4:13:52 AM UTC-3, Vinny P wrote:
>>
>> On Wed, Apr 16, 2014 at 8:37 PM, Mike D <[email protected]> wrote:
>>
>> I have some initialization stuff that I'd like to do before GCE can be
>>> used.  How would I do this?  I tried creating a ServletContextListener and
>>> then calling a static method on my GCE but that doesn't work.  In debugging
>>> I can see that the GCEs static variables are not set when a method is
>>> invoked.
>>>
>>
>>
>> Endpoints applications are slightly different than normal web
>> applications; as you remarked in your post, static variables don't retain
>> their values.
>>
>> If you need to do initialization, you should handle init separately
>> (perhaps as part of a cron job) and save the results into the
>> datastore/cloud storage/cloud SQL.
>>
>>
>> -----------------
>> -Vinny P
>> Technology & Media Advisor
>> Chicago, IL
>>
>> App Engine Code Samples: http://www.learntogoogleit.com
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/google-appengine.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/d/optout.

Reply via email to