org.springframework.data.redis.connection.rjc
Class RjcConnectionFactory

java.lang.Object
  extended by org.springframework.data.redis.connection.rjc.RjcConnectionFactory
All Implemented Interfaces:
DisposableBean, InitializingBean, PersistenceExceptionTranslator, RedisConnectionFactory

public class RjcConnectionFactory
extends Object
implements InitializingBean, DisposableBean, RedisConnectionFactory

Connection factory creating rjc based connections.


Constructor Summary
RjcConnectionFactory()
          Constructs a new RjcConnectionFactory instance with default settings (default connection pooling, no shard information).
 
Method Summary
 void afterPropertiesSet()
           
 void destroy()
           
 RedisConnection getConnection()
          Provides a suitable connection for interacting with Redis.
 int getDatabase()
          Returns the index of the database.
 String getHostName()
          Returns the Redis hostName.
 String getPassword()
          Returns the password used for authenticating with the Redis server.
 int getPort()
          Returns the port used to connect to the Redis instance.
 int getTimeout()
          Returns the timeout.
 boolean getUsePool()
          Indicates the use of a connection pool.
protected  RjcConnection postProcessConnection(RjcConnection connection)
          Post process a newly retrieved connection.
 void setDatabase(int index)
          Sets the index of the database used by this connection factory.
 void setHostName(String hostName)
          Sets the Redis hostName.
 void setPassword(String password)
          Sets the password used for authenticating with the Redis server.
 void setPort(int port)
          Sets the port used to connect to the Redis instance.
 void setTimeout(int timeout)
           
 void setUsePool(boolean usePool)
          Turns on or off the use of connection pooling.
 DataAccessException translateExceptionIfPossible(RuntimeException ex)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RjcConnectionFactory

public RjcConnectionFactory()
Constructs a new RjcConnectionFactory instance with default settings (default connection pooling, no shard information).

Method Detail

afterPropertiesSet

public void afterPropertiesSet()
Specified by:
afterPropertiesSet in interface InitializingBean

destroy

public void destroy()
Specified by:
destroy in interface DisposableBean

getConnection

public RedisConnection getConnection()
Description copied from interface: RedisConnectionFactory
Provides a suitable connection for interacting with Redis.

Specified by:
getConnection in interface RedisConnectionFactory
Returns:
connection for interacting with Redis.

postProcessConnection

protected RjcConnection postProcessConnection(RjcConnection connection)
Post process a newly retrieved connection. Useful for decorating or executing initialization commands on a new connection. This implementation simply returns the connection.

Parameters:
connection -
Returns:
processed connection

translateExceptionIfPossible

public DataAccessException translateExceptionIfPossible(RuntimeException ex)
Specified by:
translateExceptionIfPossible in interface PersistenceExceptionTranslator

getHostName

public String getHostName()
Returns the Redis hostName.

Returns:
Returns the hostName

setHostName

public void setHostName(String hostName)
Sets the Redis hostName.

Parameters:
hostName - The hostName to set.

getPassword

public String getPassword()
Returns the password used for authenticating with the Redis server.

Returns:
password for authentication

setPassword

public void setPassword(String password)
Sets the password used for authenticating with the Redis server.

Parameters:
password - the password to set

getPort

public int getPort()
Returns the port used to connect to the Redis instance.

Returns:
Redis port.

setPort

public void setPort(int port)
Sets the port used to connect to the Redis instance.

Parameters:
port - Redis port

getTimeout

public int getTimeout()
Returns the timeout.

Returns:
Returns the timeout

setTimeout

public void setTimeout(int timeout)
Parameters:
timeout - The timeout to set.

getUsePool

public boolean getUsePool()
Indicates the use of a connection pool.

Returns:
Returns the use of connection pooling.

setUsePool

public void setUsePool(boolean usePool)
Turns on or off the use of connection pooling.

Parameters:
usePool - The usePool to set.

getDatabase

public int getDatabase()
Returns the index of the database.

Returns:
Returns the database index

setDatabase

public void setDatabase(int index)
Sets the index of the database used by this connection factory. Can be between 0 (default) and 15.

Parameters:
index - database index