Hi, > > 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.
But this doesn't help solving the problem I described above. > >if you truly have to do some > > initialization each time the JVM starts, I mean the opposite. I don't want to do initialization every time Google loads my app. I will convert all static variables into datastore entries. Instead, I want to save the state for a lifetime, until a new "deployment" is made. I think you assumed I was writing about "loading", but I meant "deployment". So, my question is how to determine a new "deployment"(uploading the new application with the same version name) in my app programatically. Thanks, Ali On Mar 19, 7:31 pm, Peter Ondruska <peter.ondru...@gmail.com> wrote: > 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 <iamco...@gmail.com> 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 > > <jdpatter...@gmail.com>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 <schwa...@google.com> 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 <al...@aliok.com.tr> 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 > > >>>> google-appengine-j...@googlegroups.com. > > >>>> To unsubscribe from this group, send email to > > >>>> google-appengine-java+unsubscr...@googlegroups.com<google-appengine-java%2B > > >>>> unsubscr...@googlegroups.com> > > >>>> <google-appengine-java%2bunsubscr...@googlegroups.com<google-appengine-java > > >>>> %252bunsubscr...@googlegroups.com> > > > >>>> . > > >>>> 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 > > >> google-appengine-j...@googlegroups.com. > > >> To unsubscribe from this group, send email to > > >> google-appengine-java+unsubscr...@googlegroups.com<google-appengine-java%2B > > >> unsubscr...@googlegroups.com> > > >> . > > >> 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 > > > google-appengine-j...@googlegroups.com. > > > To unsubscribe from this group, send email to > > > google-appengine-java+unsubscr...@googlegroups.com<google-appengine-java%2B > > > unsubscr...@googlegroups.com> > > > . > > > 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.