Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/345.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java SpringHTTP调用程序在处理下一个请求之前等待一秒钟_Java_Spring_Spring Remoting_Httpinvoker - Fatal编程技术网

Java SpringHTTP调用程序在处理下一个请求之前等待一秒钟

Java SpringHTTP调用程序在处理下一个请求之前等待一秒钟,java,spring,spring-remoting,httpinvoker,Java,Spring,Spring Remoting,Httpinvoker,我已经设置了一个SpringHTTP调用器示例,如第20.4节所述 如果我连续执行多个服务调用(请参阅我的for循环),则单个调用之间的间隔为1秒,尽管服务器在不到4ms的时间内处理该方法 任何想法 斯特凡 下面是配置和调用: <!-- server side --> <bean name="configurationServiceExporter" class="org.springframework.remoting.httpinvoker.SimpleHttpInvoke

我已经设置了一个SpringHTTP调用器示例,如第20.4节所述

如果我连续执行多个服务调用(请参阅我的for循环),则单个调用之间的间隔为1秒,尽管服务器在不到4ms的时间内处理该方法

任何想法

斯特凡

下面是配置和调用:

<!-- server side -->
<bean name="configurationServiceExporter"
class="org.springframework.remoting.httpinvoker.SimpleHttpInvokerServiceExporter">
    <property name="service" ref="configurationService" />
    <property name="serviceInterface"
        value="remote.service.ConfigurationService" />
</bean>
<bean id="httpServer"
    class="org.springframework.remoting.support.SimpleHttpServerFactoryBean">
    <property name="contexts">
        <util:map>
                    <entry key="/remoting/ConfigurationService" value-ref="configurationServiceExporter" />
                    </util:map>
    </property>
    <property name="port" value="${port.httpinvoker}" />
</bean>

<!-- client side -->
<bean id="configurationServiceProxy"     class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
    <property name="serviceUrl"
        value="http://localhost:7777/remoting/ConfigurationService" />
    <property name="serviceInterface"
        value="remote.service.ConfigurationService" />
</bean>

/** here the service call*/
@Component
public class ServiceConsumer {

private ConfigurationService configurationService;

public void do(){
 for (int i = 0; i < 10; i++) 
    this.configurationService.getConfigurationValue(SMTP_HOST);
}

/**这是服务电话*/
@组成部分
公共类服务消费者{
专用配置服务配置服务;
公营部门{
对于(int i=0;i<10;i++)
this.configurationService.getConfigurationValue(SMTP\U主机);
}

发现了问题。它没有连接到Spring HTTP Invoker。我更新到Java 7。当我使用Java 6运行我的应用程序时,它与更新前一样工作(在请求之间没有等待一秒钟。如果我知道更多,我会回来。

我只是遇到了同样的问题:

  • 春季远程处理
  • 延迟“恰好”1秒
  • 爪哇7
不幸的是,我无法找到这种奇怪行为的原因,但存在一种解决方法:使用jetty而不是
SimpleHttpServerFactoryBean

这归结为稍微更改xml配置,即如何准确描述xml配置


延迟消失了;与在Java 6中使用
SimpleHttpServerFactoryBean
相比,触发请求的速度似乎加快了。

刚刚遇到了完全相同的问题。您找到解决方案了吗?可能与?