-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
1,005 additions
and
901 deletions.
There are no files selected for viewing
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
build.xml.data.CRC32=074da0ae | ||
build.xml.script.CRC32=b102c1a2 | ||
build.xml.stylesheet.CRC32=28e38971@1.38.1.45 | ||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. | ||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. | ||
nbproject/build-impl.xml.data.CRC32=074da0ae | ||
nbproject/build-impl.xml.script.CRC32=93195a2d | ||
nbproject/build-impl.xml.stylesheet.CRC32=78c6a6ee@1.38.1.45 | ||
build.xml.data.CRC32=074da0ae | ||
build.xml.script.CRC32=b102c1a2 | ||
build.xml.stylesheet.CRC32=28e38971@1.38.1.45 | ||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. | ||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. | ||
nbproject/build-impl.xml.data.CRC32=074da0ae | ||
nbproject/build-impl.xml.script.CRC32=7397afa4 | ||
nbproject/build-impl.xml.stylesheet.CRC32=f33e10ff@1.38.2.45 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
compile.on.save=true | ||
do.depend=false | ||
do.jar=true | ||
javac.debug=true | ||
javadoc.preview=true | ||
user.properties.file=C:\\Users\\arden\\.netbeans\\6.9\\build.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1"> | ||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/> | ||
</project-private> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
src/com/tujiao/jredis/pool/RedisPoolableObjectFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* To change this template, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
|
||
package com.tujiao.jredis.pool; | ||
|
||
import com.paojiao.redis.RedisClient; | ||
import org.apache.commons.pool.PoolableObjectFactory; | ||
import org.jredis.JRedis; | ||
import org.slf4j.LoggerFactory; | ||
import org.slf4j.Logger; | ||
|
||
/** | ||
* | ||
* @author arden | ||
*/ | ||
public class RedisPoolableObjectFactory implements PoolableObjectFactory { | ||
private static Logger logger = LoggerFactory.getLogger(RedisPoolableObjectFactory.class); | ||
|
||
@Override | ||
public void activateObject(Object o) throws Exception { | ||
logger.debug("Activating Object " + o); | ||
} | ||
|
||
@Override | ||
public void destroyObject(Object o) throws Exception { | ||
logger.debug("DestroyObject Object " + o); | ||
} | ||
|
||
@Override | ||
public Object makeObject() throws Exception { | ||
JRedis jredis = RedisClient.connect(); | ||
logger.debug("正在创建JRedis对象:" + jredis); | ||
return jredis; | ||
} | ||
|
||
@Override | ||
public void passivateObject(Object o) throws Exception { | ||
logger.debug("Passivating Object " + o); | ||
} | ||
|
||
@Override | ||
public boolean validateObject(Object o) { | ||
JRedis jredis = null; | ||
boolean result = true; | ||
try { | ||
if (o instanceof JRedis) { | ||
jredis = (JRedis)o; | ||
jredis.ping(); | ||
logger.debug("----:jredis:" + jredis); | ||
//RedisClient.pool.returnObject(jredis); | ||
} | ||
} catch (Exception e) { | ||
result = false; | ||
try { | ||
if (jredis != null) { | ||
jredis.quit(); | ||
} | ||
} catch (Exception ex) { | ||
//ex.printStackTrace(); | ||
} | ||
//e.printStackTrace(); | ||
} | ||
logger.debug("Validating Object " + o + " : " + result); | ||
return result; | ||
} | ||
|
||
} |