GAE中正式支持getServletContext()吗? [英] Is getServletContext() officially supported in GAE?
本文介绍了GAE中正式支持getServletContext()吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
- 是否可以正常支持
getServletContext()
如果服务器分布在不同位置?
- 性能?
- 可以在更新值之前使用doPost或任务队列中的同步在上下文中吗?
解决方案
它是基本servlet规范的一部分,所以支持。但是,正如文档所说:
如果Web应用程序
在其部署
描述符中标记为分布式,则会有一个上下文每个虚拟机
实例。在
这种情况下,上下文不能被
用作共享全局
信息的位置(因为信息
将不是真正的全局)。改为使用
外部资源,例如数据库
。
Is getServletContext()
officially supported in GAE?
- is it ok if servers are distributed among diff locations?
- performance?
- could I use 'synchronize' within the doPost or in a task queue before updating a value in the context?
解决方案
It's part of the basic servlet spec, so yes, it's supported. However, as the docs say:
In the case of a web application marked "distributed" in its deployment descriptor, there will be one context instance for each virtual machine. In this situation, the context cannot be used as a location to share global information (because the information won't be truly global). Use an external resource like a database instead.
这篇关于GAE中正式支持getServletContext()吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文