当前位置:编程学习 > JAVA >>

redis错误。求解?

redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketTimeoutException: Read timed out
at redis.clients.jedis.Protocol.process(Protocol.java:79)
at redis.clients.jedis.Protocol.read(Protocol.java:131)
at redis.clients.jedis.Connection.getBinaryMultiBulkReply(Connection.java:199)
at redis.clients.jedis.Connection.getMultiBulkReply(Connection.java:192)
at redis.clients.jedis.Jedis.smembers(Jedis.java:1167)
at com.newegg.lab.webdatacenter.util.RedisUtil.getSetDB(RedisUtil.java:156)
at com.newegg.lab.webdatacenter.application.ApplicationContent.getCurrentHertrixStatus(ApplicationContent.java:47)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:273)
at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:264)
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86)
at org.quartz.core.JobRunShell.run(JobRunShell.java:216)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at java.net.SocketInputStream.read(SocketInputStream.java:90)
at redis.clients.util.RedisInputStream.fill(RedisInputStream.java:109)
at redis.clients.util.RedisInputStream.readByte(RedisInputStream.java:45)
at redis.clients.jedis.Protocol.process(Protocol.java:64)
... 15 more --------------------编程问答-------------------- redis的java客户端jredis对并发支持有点问题:
现调用一次,new 一个jredisinstance,添加自己关闭连接。
如下面代码
	public static Set<String> getSetDB(String ip){
Jedis jedis = null;
try{
jedis = getJedisInstance();
Set<String> strings=jedis.smembers(ip);
System.out.println("getSetDB=====>"+ip+"="+strings);
  return strings;
}catch(Exception e){
LogUtil.writeError("RedisUtil getSetDB exception!!!", e);
e.printStackTrace();
return null;
}finally{
jedis.disconnect();
}
}
--------------------编程问答-------------------- Jedis jedis = new Jedis("localhost");
没有做任何处理 也没有关闭  木有问题
如果这样不行 加了连接池
补充:Java ,  Web 开发
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,