RedisUtil共享连接池false

时间:2014-01-06 11:27:52

标签: java tomcat redis atmosphere jedis

我在 tomcat 服务器上使用 Atmosphere 框架作为服务器端脚本。
我也在使用 redis 服务器并使用 jedis 库进行java。

我正在关注登录tomcat控制台,之后所有的氛围连接都接近服务器,服务器无法与客户端通信:

10:59:51.443 [http-bio-8080-exec-6] INFO  o.a.samples.pubsub.EventsLogger - onDisconnect():   120.138.212.106:55163
11:01:52.502 [http-bio-8080-exec-3] INFO  o.a.plugin.redis.RedisBroadcaster - org.atmosphere.plugin.redis.RedisUtil shared connection pool false
11:01:52.504 [http-bio-8080-exec-3] DEBUG o.a.util.AbstractBroadcasterProxy - Reconfiguring Broadcaster media1
11:01:52.505 [http-bio-8080-exec-3] INFO  o.a.samples.pubsub.EventsLogger - onSuspend(): 120.138.212.106:55166
11:01:52.510 [http-bio-8080-exec-3] INFO  o.a.samples.pubsub.EventsLogger - onConnect(): WebSocketEvent{message='', type=CONNECT, webSocket=org.apache.catalina.websocket.WsOutbound@133e9fa}

任何人都可以帮我解决这个问题吗?

我正在使用以下代码来安装redis连接池:

public class ServerStart implements ServletContextListener {

private static JedisPool pool;

@Override
public void contextInitialized(ServletContextEvent sce) {        
        pool = new JedisPool(new JedisPoolConfig(), "localhost", 6379);
}

public static Jedis getResourceFromPool() {
    Jedis jedis = pool.getResource();
    return jedis;
}

@Override
public void contextDestroyed(ServletContextEvent sce) {

}

}  

我使用getResourceFromPool()方法获取redis连接。

1 个答案:

答案 0 :(得分:0)

Atmosphere正在使用它自己的Jedis Pool。要将其设置为true,请添加以下init-param

org.atmosphere.plugin.redis.RedisBroadcaster.sharedPool   真

- Jeanfrancois