public class AsyncSocketTransportFactory extends Object
AsyncSocketTransport
connection to a Redis Server via the getTransport method.
The default implementation is to return an AsyncJavaSocketTransport
object constructed via the host, port and this as the transportFactory.
The implementation can be changed to another class providing the same constructor. The Fully qualified className has to be specied as a
System property org.aredis.net.AsyncSocketTransport or as a property with the same name in aredis_transport.properties which should be in the CLASSPATH.\
Set the className as custom if you want to extend this class and override getTransport and set defaultFactory in the sub-class's static block so that the
getDefault method returns the overridden AsyncSocketTransportFactory.Modifier and Type | Field and Description |
---|---|
static String |
CUSTOM_CLASS_NAME
Used this as the class name you are extending AsyncSocketTransportFactory and overriding getTransport.
|
static String |
DEFAULT_CLASS_NAME
Default class name of AsyncJavaSocketTransport that is used if no custom class is specified.
|
protected static AsyncSocketTransportFactory |
defaultFactory
Default factory which is returned by the singleton method getDefault.
|
static String |
RESOLVED_CLASS_NAME
The resolved Class name created in the static block.
|
static Constructor<AsyncSocketTransport> |
RESOLVED_TRANSPORT_CONSTRUCTOR
The Resolved Consctructor that is used by getTransport.
|
protected Constructor<AsyncSocketTransport> |
transportConstructor
Resolved constructor to use to create the AsyncSocketTransport.
|
Constructor and Description |
---|
AsyncSocketTransportFactory()
Create an AsyncSocketTransportFactory with default config.
|
AsyncSocketTransportFactory(AsyncSocketTransportConfig pconfig)
Create an AsyncSocketTransportFactory.
|
Modifier and Type | Method and Description |
---|---|
AsyncSocketTransportConfig |
getConfig()
Gets Config in use.
|
static AsyncSocketTransportFactory |
getDefault()
Singleton method to return defaultFactory.
|
AsyncSocketTransport |
getTransport(String host,
int port)
Creates an AsyncSocketTransport to a redis server by using resolved transportConstructor.
|
protected Constructor<AsyncSocketTransport> transportConstructor
protected static volatile AsyncSocketTransportFactory defaultFactory
public static final String DEFAULT_CLASS_NAME
public static final String CUSTOM_CLASS_NAME
public static final String RESOLVED_CLASS_NAME
public static final Constructor<AsyncSocketTransport> RESOLVED_TRANSPORT_CONSTRUCTOR
public AsyncSocketTransportFactory(AsyncSocketTransportConfig pconfig)
pconfig
- Config to usepublic AsyncSocketTransportFactory()
public AsyncSocketTransport getTransport(String host, int port)
host
- Server Hostport
- Server Portpublic static AsyncSocketTransportFactory getDefault()
public AsyncSocketTransportConfig getConfig()
Copyright © 2013- Suresh Mahalingam. All Rights Reserved.