Package redis.clients.jedis
Class GlideJedisFactory
- java.lang.Object
-
- redis.clients.jedis.GlideJedisFactory
-
- All Implemented Interfaces:
org.apache.commons.pool2.PooledObjectFactory<Jedis>
public class GlideJedisFactory extends java.lang.Object implements org.apache.commons.pool2.PooledObjectFactory<Jedis>
Factory for creating and managing Jedis instances backed by GLIDE clients in a connection pool. This factory implements the Apache Commons Pool PooledObjectFactory interface to provide proper connection lifecycle management.
-
-
Constructor Summary
Constructors Constructor Description GlideJedisFactory(java.lang.String host, int port, JedisClientConfig clientConfig)Create a new factory for Jedis connections.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivateObject(org.apache.commons.pool2.PooledObject<Jedis> pooledObject)voiddestroyObject(org.apache.commons.pool2.PooledObject<Jedis> pooledObject)JedisClientConfiggetClientConfig()Get the client configuration used by this factory.java.lang.StringgetHost()Get the host this factory connects to.JedisPoolgetPool()Get the pool reference.intgetPort()Get the port this factory connects to.org.apache.commons.pool2.PooledObject<Jedis>makeObject()voidpassivateObject(org.apache.commons.pool2.PooledObject<Jedis> pooledObject)voidsetPool(JedisPool pool)Set the pool reference after factory creation.booleanvalidateObject(org.apache.commons.pool2.PooledObject<Jedis> pooledObject)
-
-
-
Constructor Detail
-
GlideJedisFactory
public GlideJedisFactory(java.lang.String host, int port, JedisClientConfig clientConfig)Create a new factory for Jedis connections.- Parameters:
host- the Redis/Valkey server hostport- the Redis/Valkey server portclientConfig- the client configuration
-
-
Method Detail
-
setPool
public void setPool(JedisPool pool)
Set the pool reference after factory creation. This is called by JedisPool after the factory is created but before it's used.- Parameters:
pool- the JedisPool that owns this factory
-
makeObject
public org.apache.commons.pool2.PooledObject<Jedis> makeObject() throws java.lang.Exception
- Specified by:
makeObjectin interfaceorg.apache.commons.pool2.PooledObjectFactory<Jedis>- Throws:
java.lang.Exception
-
destroyObject
public void destroyObject(org.apache.commons.pool2.PooledObject<Jedis> pooledObject) throws java.lang.Exception
- Specified by:
destroyObjectin interfaceorg.apache.commons.pool2.PooledObjectFactory<Jedis>- Throws:
java.lang.Exception
-
validateObject
public boolean validateObject(org.apache.commons.pool2.PooledObject<Jedis> pooledObject)
- Specified by:
validateObjectin interfaceorg.apache.commons.pool2.PooledObjectFactory<Jedis>
-
activateObject
public void activateObject(org.apache.commons.pool2.PooledObject<Jedis> pooledObject) throws java.lang.Exception
- Specified by:
activateObjectin interfaceorg.apache.commons.pool2.PooledObjectFactory<Jedis>- Throws:
java.lang.Exception
-
passivateObject
public void passivateObject(org.apache.commons.pool2.PooledObject<Jedis> pooledObject) throws java.lang.Exception
- Specified by:
passivateObjectin interfaceorg.apache.commons.pool2.PooledObjectFactory<Jedis>- Throws:
java.lang.Exception
-
getHost
public java.lang.String getHost()
Get the host this factory connects to.- Returns:
- the host
-
getPort
public int getPort()
Get the port this factory connects to.- Returns:
- the port
-
getClientConfig
public JedisClientConfig getClientConfig()
Get the client configuration used by this factory.- Returns:
- the client configuration
-
getPool
public JedisPool getPool()
Get the pool reference.- Returns:
- the pool reference, or null if not set
-
-