Class 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
      void activateObject​(org.apache.commons.pool2.PooledObject<Jedis> pooledObject)  
      void destroyObject​(org.apache.commons.pool2.PooledObject<Jedis> pooledObject)  
      JedisClientConfig getClientConfig()
      Get the client configuration used by this factory.
      java.lang.String getHost()
      Get the host this factory connects to.
      JedisPool getPool()
      Get the pool reference.
      int getPort()
      Get the port this factory connects to.
      org.apache.commons.pool2.PooledObject<Jedis> makeObject()  
      void passivateObject​(org.apache.commons.pool2.PooledObject<Jedis> pooledObject)  
      void setPool​(JedisPool pool)
      Set the pool reference after factory creation.
      boolean validateObject​(org.apache.commons.pool2.PooledObject<Jedis> pooledObject)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.apache.commons.pool2.PooledObjectFactory

        destroyObject
    • 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 host
        port - the Redis/Valkey server port
        clientConfig - 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:
        makeObject in interface org.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:
        destroyObject in interface org.apache.commons.pool2.PooledObjectFactory<Jedis>
        Throws:
        java.lang.Exception
      • validateObject

        public boolean validateObject​(org.apache.commons.pool2.PooledObject<Jedis> pooledObject)
        Specified by:
        validateObject in interface org.apache.commons.pool2.PooledObjectFactory<Jedis>
      • activateObject

        public void activateObject​(org.apache.commons.pool2.PooledObject<Jedis> pooledObject)
                            throws java.lang.Exception
        Specified by:
        activateObject in interface org.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:
        passivateObject in interface org.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