??????Bug?·-????Bug
?????????????????Bug????????ó?(????/Э??)?????????????????????Щ????IO?????Bug?????????????????????д???????·?????????????????????????????????????
????????Bug???
??????ù???Redis???

???????????????????hget??hset??????Redis??壬?????????Redis??CPU??IO?д????????CPU??????????:

????CPU????????o??Redis??????????????????????????????readTimeOut?????????????????????hget??hset????kill????????????Redis??CPU???????
???????δ??????????
????????????????????????????????????????????????????????????????д?????Redis?????????????????????????????????????????key??????get User123456Name???????????redis????????OK??????????:

?????????????????????op??Redis?????????Key???delete????????????:

???????????????????????????????????????????????????????????????????????????????????????????10?????????????????????????????:

????????????????????????????????????????????????顣
??????????????????????????Okay??
????Bug????
???????Bug????Redis????Server???????????????Bug???????????Jedis???????Key????ò???????????????????????????????
??????СBug??Χ
????????:Redis?????t??????????????????????????Redis??????
???????:Redis?????key??Bug????????????????????????Okay??
????????:?????????????з??????????A???????????????A????json????(redis?????json)??
?????????????????????????????Redis?????????????????????A????????B????json??????
?????????????λ
??????????????Jedis??????????????t???????????????????????????????????????????Jedis?????????
??????????????????????δ???:
public Object invoke(Object proxy??Method method??Object[] args) throws Throwable{
JedisClient jedisClient = jedisPool.getResource();
try{
return method.invoke(jedisClient??args);
} catch(Exception e){
logger.error("invoke redis error"??e);
throw e;
}finally {
if(jedisClient != null){
// ?????????????
jedisPool.returnResource(jedisClient);
}
}
}
???????????ú????????????д?????????????????????н??????????????????Druid??????????????IO??fatal??????????????????????????jedisClient?????????о?????????????
????Bug????
?????????????????????????????????jedisClient????????в???????????????????????????????????????????????
???????????
????????????μ?redis????
????????Jedis???
????public String get(final String key) {
????checkIsInMulti();
????client.sendCommand(Protocol.Command.GET?? key);
????return client.getBulkReply();
????}
????Jedis?????????Bio?????????????????????:

????????????????redis????

????????Redis??????????????????????????command???????????readTimeOut????
?????????????????????3???
??????Redis??????????command???????????????command??socket????????inputream??buffer???????????command????????????

??????????inputStream?????и?????????????????????
???????????????????????????????????????????????

???????????????get user789Key?????get user456Key?????????????????????????????
?????????????

???????????????????ζ????????????μ??????????Redis?????????????????
???????get????????OK
?????????????????????????get????????OK??????????????????????set?????????????OK??get???????????????????????????
?????????????????????????????
????????????Redis????????????????????????????????????????????JedisClient????????+1???????????>3?????????????????????????????????????????????Bug????????????
????????ε???????????inputstream???з?
???????У????Redis????????????inputstream?????′ζ??????????????????
????????????????????
???????????IO?????????????????????????????檔
?????????Э????????????????
????????η??????????????????packetId??????????????????????packetId????????????????ν??????????????????е?packetId??????????packetId????????′??????:
????if(oldPacketId != packetIdFromData){
????throw new RuntimeException("????");
????}
???????
????????????????????????У?????IO???????????????????????????????????????????????socket????inputstream??buffer?е???????????????????????????
????????????????????Э?飬??????packetId????????????????μ??????????????????????????????????????????????????????Ч???????