Google应用引擎 - 在启动时初始化对象 [英] Google app engine - initialize object at start up

查看:129
本文介绍了Google应用引擎 - 在启动时初始化对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在谷歌应用程序引擎上开发GWT应用程序,我正在寻找初始化对象的最佳方法(如单例,列表,共享资源等)。
我想我正在寻找像Spring应用程序上下文文件



的任何想法?

解决方案

a href =http://code.google.com/appengine/docs/java/config/appconfig.html#Using_a_ServletContextListener =nofollow> http://code.google.com/appengine/docs/java/ config / appconfig.html#Using_a_ServletContextListener



基本上,您将创建一个Servlet上下文侦听器,该Servlet上下文侦听器是为精确设计的servlet API的一部分你指的是什么。如果你在本地运行,它会在启动服务器时运行。在应用程序引擎环境中,它应该针对每个热身请求运行(为避免这种情况,您可以使用始终开启,该设置将在此处设置: http://code.google.com/appengine/docs/adminconsole/instances.html#Always_On


I am developing a GWT application on google app engine and I am looking for the best approach to initialize objects (like singleton, list, shared resources etc). I guess I am looking for something like "Spring application context file"

any ideas?

解决方案

What you're looking for is here:

http://code.google.com/appengine/docs/java/config/appconfig.html#Using_a_ServletContextListener

Basically, you're going to make a Servlet Context Listener, which is a part of the servlet API designed for exactly what you're referring to. If you're running this locally, it will run when you start your server. In the app engine environment it should run for every warm up request (to avoid, this, you can use "Always ON", which will be set here: http://code.google.com/appengine/docs/adminconsole/instances.html#Always_On)

这篇关于Google应用引擎 - 在启动时初始化对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆