通过AppEngine调整泽西岛的加载时间 [英] Tweak loading times of Jersey over AppEngine

查看:134
本文介绍了通过AppEngine调整泽西岛的加载时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我的应用程序服务无法启动或响应甚至热身请求,因为泽西岛扫描这些库的时间过长。硬编码所有资源的路径。

 < servlet-name> Jersey REST服务< / servlet-name> 
< servlet-class> com.sun.jersey.spi.container.servlet.ServletContainer< / servlet-class>
< init-param>
< param-name> javax.ws.rs.Application< / param-name>
< param-value> com.livily.rest.JerseyApplication< / param-value>
< / init-param>



泽西应用程序拥有所有课程

  public Set< Class<?>> getClasses()
{
Set< Class<?>> s = new HashSet< Class<>>();
s.add(com.livily.rest.visitor.UserRatingUtil.class);
}

但是,球衣正在扫描大量供应商

  2013年3月8日下午3点39分40秒com.sun.jersey.core.spi.component.ProviderServices getServiceClasses 
CONFIG:找到提供程序: class com.sun.jersey.server.impl.model.parameter.multivalued.StringReaderProviders $ StringConstructor

它是做了大约50-100次,然后

  2013年3月8日下午3时39分41秒com.sun.jersey。 server.impl.modelapi.annotation.IntrospectionModeller createResource 
FINEST:由IntrospectionModeler创建的一个新的抽象资源:AbstractResource(/ current-status, - CurrentStatus:1个构造函数,0个字段,0个setter方法,1个res方法, 0个子类别方法,0个子类别定位器)

每个元素



总共花费的时间约4-10秒,并且appengine不喜欢这个,因为它期望快速结束加载;否则它开始给怪异的500错误(甚至静态文件)。



我很难过;任何帮助将不胜感激。

解决方案

设置 jersey.config.disableAutoDiscovery 。有关详细信息,请参阅配置属性

< init-param>
< param-name> jersey.config.disableAutoDiscovery< / param-name>
< param-value> true< /参数值>
< / init-param>


my application service is not able to start or respond to even warmup requests as the time taken by Jersey to scan the libraries is inordinate.

I have created application and hardcoded all the paths of the Resources for jersey.

<servlet-name>Jersey REST Service</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>com.livily.rest.JerseyApplication</param-value>
</init-param>

Jersey Application has all the classes

public Set<Class<?>> getClasses()
{
Set<Class<?>> s = new HashSet<Class<?>>();
s.add(com.livily.rest.visitor.UserRatingUtil.class);
}

However, jersey is scanning for lot of providers

Mar 8, 2013 3:39:40 PM com.sun.jersey.core.spi.component.ProviderServices getServiceClasses
CONFIG:     Provider found: class com.sun.jersey.server.impl.model.parameter.multivalued.StringReaderProviders$StringConstructor

It is doing it about 50-100 times and then

Mar 8, 2013 3:39:41 PM com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller createResource
FINEST: A new abstract resource created by IntrospectionModeler: AbstractResource("/current-status", - CurrentStatus: 1 constructors, 0 fields, 0 setter methods, 1 res methods, 0 subres methods, 0 subres locators )

for each one

The time taken in total is about 4-10 secs and appengine does not like this as it expects to wrap up the loading quickly; otherwise it starts giving weird 500 errors (for even static files).

I am stumped; any help will be appreciated.

解决方案

Set jersey.config.disableAutoDiscovery. See Configuration Properties for details.

<init-param>
    <param-name>jersey.config.disableAutoDiscovery</param-name>
    <param-value>true</param-value>
</init-param>

这篇关于通过AppEngine调整泽西岛的加载时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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