小编Nim*_*007的帖子

Pika blocks_connection.py 随机超时连接到RabbitMQ

我有一个兔子 mq 在机器上运行

  • 客户端和rabbitMQ都在同一个网络上运行
  • rabbitMQ有很多客户端
  • 我可以从rabbitMQ ping 客户端并返回
  • 机器之间测得的最长延迟为 12.1 毫秒
  • 网络详细信息:标准交换机网络(在单个物理机上运行的虚拟机网络 - 使用 vmware VC)

我在初始化 RPC 连接时收到随机超时

/usr/lib/python2.6/site-packages/pika-0.9.5-py2.6.egg/pika/adapters/blocking_connection.py

问题是超时不一致并且不时发生。

当手动测试这个问题并从同一台机器上运行 blocks_connection.py 1000 次时,它失败了,不会产生超时。

这是我失败时得到的错误:

2013-04-23 08:24:23,396 runtest-trigger.24397 24397 DEBUG      producer_rabbit initiate_rpc_connection Connecting to RabbitMQ RPC queue rpcqueue_java on host: auto-db1
2013-04-23 08:24:25,350 runtest-trigger.24397 24397 ERROR      testrunner go   Run 1354: cought exception: timed out
Traceback (most recent call last):
  File "/testrunner.py", line 193, in go
    self.set_runparams(jobid)
  File "/testrunner.py", line 483, in set_runparams
    self.runparams.producers_testrun = self.initialize_producers_testrun(self.runparams)
  File "/basehandler.py", line 114, …
Run Code Online (Sandbox Code Playgroud)

python rpc rabbitmq pika python-pika

5
推荐指数
1
解决办法
4316
查看次数

Java Spring Framework jmx托管注释@ManagedAttribute未在MBeanServerConnection/Jconsole/Visual vm/bean列表中显示方法

我已经将Spring注释添加到我的代码中但是当通过visual vm连接时,方法"myExample()"没有显示在JMX bean列表中

我的代码:

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jmx.export.annotation.ManagedAttribute;
import org.springframework.jmx.export.annotation.ManagedResource;
import org.springframework.stereotype.Component;


@Component
@ManagedResource
public class MyClass {

   @Autowired
   private Example exampleService;

   @ManagedAttribute
   public String myExample() {
      return exampleService.getSomething().toString();
   }
} 
Run Code Online (Sandbox Code Playgroud)

知道为什么会这样吗?

java spring spring-annotations spring-jmx

4
推荐指数
1
解决办法
3145
查看次数

"setenforce 0"如何以及为什么允许Java 7运行?

我对正在进行的程序进行了一些更改,并且我已经将Java从Java 6更新为Java 7.

我在CentOS 5.8 32位VM上运行程序.

在Java更新之前,它工作正常.

现在该过程不是以错误开头的:

 [root@CentOS-58-i-0 bin]# ./agent.sh start

 Starting Agent.....d. running (23442).
 Error: dl failure on line 864
 Error: failed /agent/jre/lib/i386/client/libjvm.so, 
 because /agent/jre/lib/i386/client/libjvm.so: 
 cannot restore segment prot after reloc: Permission denied
Run Code Online (Sandbox Code Playgroud)

我已经在线检查过,解决方案/解决方法就是运行命令:

   setenforce 0
Run Code Online (Sandbox Code Playgroud)

它会起作用.

阅读setenforce命令的文档,我不明白它的作用以及它是如何解决问题的.

所以我的问题是:

  1. 什么可能导致错误阻止我启动我的过程?
  2. 为什么setenforce命令会解决它?
  3. 请简要说明setenforce一般情况.

java linux selinux java-7

3
推荐指数
1
解决办法
5744
查看次数

使用RestTemplate进行基本身份验证 - 编译错误 - 构造函数HttpClient()不可见

试图将基本身份验证添加到restTemplate

我遇到的问题是我无法初始化:(在代码片段中都有导入)

HttpClient client = new HttpClient();
Run Code Online (Sandbox Code Playgroud)

此代码解决了编译错误(没有建议eclipse可以解决此问题)

1)问题是什么?

2)我输入了错误的课程吗?

我的代码片段:

import org.apache.http.client.HttpClient;
//OR (not together)
import sun.net.www.http.HttpClient;


HttpClient client = new HttpClient(); //this line dosent compile
UsernamePasswordCredentials credentials =
new UsernamePasswordCredentials("USERNAME","PASS");
client.getState().setCredentials(
  new AuthScope("www.example.com", 9090, AuthScope.ANY_REALM),
  credentials);
CommonsClientHttpRequestFactory commons =
     new CommonsClientHttpRequestFactory(client);

RestTemplate template = new RestTemplate(commons);
SomeObject result = template.getForObject(
     "http://www.example.com:9090/",SomeObject.class
 );
Run Code Online (Sandbox Code Playgroud)

运行此获取异常:

> failed due to an unhandled exception: java.lang.Error: Unresolved
> compilation problems:     The constructor HttpClient() is not visible
>   The method getState() is undefined for …
Run Code Online (Sandbox Code Playgroud)

java rest spring basic-authentication http-headers

3
推荐指数
1
解决办法
1万
查看次数

加特林-在群集中运行负载测试/向外扩展

我需要许多API调用来对我的应用进行压力测试

正在调查加特林-http: //gatling.io/

我对报告和结果感到满意

问题是它在1台计算机上运行,​​我需要使用来自不同网络的多个HTTP连接进行测试

为此,我请参阅集群运行文档:http : //gatling.io/docs/1.5.6/user_documentation/cookbooks/scaling_out.html

但是它无法提供足够的信息来完成此任务。

我不明白如何在远程计算机上触发测试并知道它们何时完成?

是否有1位用户遇到此问题,并且对此任务有Wiki /解决方案?

谢谢

bash scala stress-testing load-testing gatling

1
推荐指数
1
解决办法
1932
查看次数

PHP - 使用字符串""前缀中的类函数不起作用

试图在echo中的字符串中使用我的类的函数是不行的,可能是因为字符串"",有更好的方法吗?

这是我的代码:

class example{
    private $name = "Cool";

    function getName(){
        return $this->name;
    }
}


$example = new example();

//THIS WONT WORK 
echo "the name : $example->getName()";
//THIS WILL PRINT :
//the name : ()

//THIS WILL WORK
$name = $example->getName();
echo "the name : $name";
//THIS WILL PRINT :
//the name : Cool
Run Code Online (Sandbox Code Playgroud)

怎么能在字符串里面实现呢?

谢谢

php web

-1
推荐指数
1
解决办法
80
查看次数

多行的Java数组声明.

嗨!

我刚刚开始学习Java,我想知道在声明数组时是否有可能将数组元素放在多行中.

以下代码给出了一个错误:

public String[] songList = {'Stadium Arcadium', 'Make You Feel Better', 'Under The Bridge',
       'Wet Sand', 'Californication', 'Charlie', 'Aeroplane', 'Transcending', 'Ethiopia'};
Run Code Online (Sandbox Code Playgroud)

非常感谢你!

java arrays

-4
推荐指数
1
解决办法
5610
查看次数