You should first test that Context destroy is called as I recall from
earlier discussion that this may not be used in GAE/J

On Mar 19, 5:49 pm, Conor Power <[email protected]> wrote:
> you could use a Servlet Content Listener, which will tell you when the
> Servlet context starts / stops ... you'll at least know when Google are
> loading or unloading your app.
>
> from reading your email however, it seems like there maybe a little
> confusion around app initialization. if you truly have to do some
> initialization each time the JVM starts, you won't want to store
> "initialized" in the datastore as if / when other instances are spun up they
> will be in an inconsistent state than what you want.
>
> it seems like you want this initialized state on a per context basis.
>
> C
>
> On Fri, Mar 19, 2010 at 3:18 PM, John Patterson <[email protected]>wrote:
>
>
>
> > Deploying a new version has no effect on data stored in the datastore.
>
> > What do you mean by "initialize" your app.  If you are referring to loading
> > data into memory then that needs to be done for every instance of your app
> > that is loaded.  Not just once per deployment.
>
> > On 19 Mar 2010, at 19:10, Ali Ok wrote:
>
> >  Ok, I understood this one. However, I think you should warn the
> >> developers not to use static variables at all, in a large and red
> >> styled documentation paragraph.
>
> >> In this case, assume that every static variable is converted, and they
> >> all being set from Datastore.
> >> However, this does not solve the problem.
> >> Let me explain an example:
> >> * After deployment, at the first request, let me put a flag,
> >> "initialized=true", into datastore
> >> * On later requests, my app does not need to be initialized, since I
> >> get initialized=true from Datastore. Everything is cool.
>
> >> * Let's make a new deployment to App Engine at this stage.
> >> * After deployment of a new version, my app needs to be intialized
> >> again
> >> * In the code, once again I check my "initialized" flag from Datastore
> >> is "true", since a new deployment doesn't clear the stored data,
> >> right?
> >> * How to determine that a new deployment is made, and the
> >> initialization needs to be run again?
>
> >> What are the effects of a new deployment to the Datastore?
>
> >> Thanks for your replies,
> >> Ali
>
> >> On 18 Mart, 22:34, Don Schwarz <[email protected]> wrote:
>
> >>> Unlike most Java hosting providers, we load and unload your code on JVMs
> >>> as
> >>> your load patterns change.  This will result in static variable static
> >>> being
> >>> lost, and as a result you should only expect durability of data stored in
> >>> the datastore.  Transient data should generally be stored in memcache,
> >>> although data may be evicted from memcache as well.
>
> >>> For more information, see:
>
> >>>http://code.google.com/appengine/kb/java.html#What_Causes_Loading_Req...
>
> >>> On Thu, Mar 18, 2010 at 9:34 AM, Ali Ok <[email protected]> wrote:
>
> >>>> Hi,
> >>>> I am trying to implement Google App Engine support for Myfaces 2. You
> >>>> can see the work [1] [2].
> >>>> At the moment, I am making some trials to identify the problem at [2].
>
> >>>  I am experiencing an interesting problem. My filter's static variable
> >>>> is lost after some time(ie. 3 minutes)
> >>>> I have a filter like this:
> >>>> public class TestFilter implements Filter
> >>>> {
> >>>> ...
> >>>>  private static String myStaticVariable;
>
> >>>   public void doFilter(ServletRequest arg0, ServletResponse arg1,
> >>>>           FilterChain arg2) throws IOException, ServletException
> >>>>       {
> >>>>               log.warning("myStaticVariable" + myStaticVariable);
> >>>>               if(myStaticVariable==null)
> >>>>                       myStaticVariable = "someValue";
> >>>>               arg2.doFilter(arg0, arg1);
> >>>>       }
> >>>> ...
> >>>> }
>
> >>>  When I make the first request, "myStaticVariable" is set to
> >>>> "someValue". If I make a request in a short period (ie. 20 seconds), I
> >>>> see that value of "myStaticVariable" is still "someValue".
> >>>> However, after 3 minutes, when I make another request, I see that
> >>>> "myStaticVariable" is set to its default value (null).
>
> >>>  Why are my static variables are gone? Am I doing something wrong?
>
> >>>  I can understand that the reconstruction of the filter and loss of
> >>>> instance variables; we are trying to run our application on cloud.
> >>>> But loss of static variables are completely weird.
>
> >>>  I couldn't find an issue on Google Code project, thus wanted to ask
> >>>> you before opening an issue.
>
> >>>  Thanks,
> >>>> Ali
>
> >>>  [1]https://issues.apache.org/jira/browse/MYFACES-2559
> >>>> [2]https://issues.apache.org/jira/browse/MYFACES-2606
>
> >>>  --
> >>>> You received this message because you are subscribed to the Google
> >>>> Groups
> >>>> "Google App Engine for Java" group.
> >>>> To post to this group, send email to
> >>>> [email protected].
> >>>> To unsubscribe from this group, send email to
> >>>> [email protected]<google-appengine-java%2B
> >>>>  [email protected]>
> >>>> <google-appengine-java%[email protected]<google-appengine-java
> >>>>  %[email protected]>
>
> >>>> .
> >>>> For more options, visit this group at
> >>>>http://groups.google.com/group/google-appengine-java?hl=en.
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "Google App Engine for Java" group.
> >> To post to this group, send email to
> >> [email protected].
> >> To unsubscribe from this group, send email to
> >> [email protected]<google-appengine-java%2B
> >>  [email protected]>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/google-appengine-java?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine for Java" group.
> > To post to this group, send email to
> > [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<google-appengine-java%2B 
> > [email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine-java?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" 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/google-appengine-java?hl=en.

Reply via email to