我在tomcat服务器上为我的服务器端脚本使用Atmosphere框架。
我也在使用redis服务器并使用java 的jedis库。
我正在登录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 连接。