确定代码是否运行在应用程序引擎运行时(Java) [英] identify whether is code running on app engine runtime (Java)

查看:72
本文介绍了确定代码是否运行在应用程序引擎运行时(Java)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何确定某些代码(serv-let或简单类)是否在Google App Engine运行时(Java)上运行,以便人们可以决定是否利用应用程序引擎的特定库?是否有一些可靠的运行时间环境ID?

解决方案

您可以检查 com.google.appengine .runtime.version 属性:

 字符串appEngineVersion = System.getProperty(com.google.appengine .runtime.version); 

如果已设置,则为App Engine。



<但我会考虑使用单独的构建目标,以避免运行时间开销。


How can one identify whether some code (a serv-let or a simple class) is running on Google App Engine run-time (Java) so that one can decide whether to utilize app engine's specific libraries or not? Is there some reliable runtime enviroment ID for that?

解决方案

You can check the com.google.appengine.runtime.version property:

String appEngineVersion = System.getProperty("com.google.appengine.runtime.version");

If it's set, it's App Engine.

But I would consider using separate build targets instead, to avoid the runtime overhead.

这篇关于确定代码是否运行在应用程序引擎运行时(Java)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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