public class ClientImpl extends AbstractClient
| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEFAULT_CHECK_CONNECTION_BEFORE_USE |
| Constructor and Description |
|---|
ClientImpl(Config config)
Create a new ClientImpl, which creates it's own connection to Redis using values from the config.
|
ClientImpl(Config config,
boolean checkConnectionBeforeUse)
Create a new ClientImpl, which creates it's own connection to Redis using values from the config.
|
ClientImpl(Config config,
long initialDelay,
long period,
TimeUnit timeUnit)
Create a new ClientImpl, which creates it's own connection to Redis using values from the config and
spawns a thread to ensure the connection stays open.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
doAcquireLock(String lockName,
String lockHolder,
Integer timeout)
Actually acquire the lock based upon the client acquisition model
|
protected void |
doEnqueue(String queue,
String jobJson)
Actually enqueue the serialized job.
|
protected void |
doPriorityEnqueue(String queue,
String jobJson)
Actually enqueue the serialized job with high priority.
|
void |
end()
Quits the connection to the Redis server.
|
acquireLock, doAcquireLock, doEnqueue, doPriorityEnqueue, enqueue, getNamespace, key, priorityEnqueuepublic static final boolean DEFAULT_CHECK_CONNECTION_BEFORE_USE
public ClientImpl(Config config)
config - used to create a connection to Redispublic ClientImpl(Config config, boolean checkConnectionBeforeUse)
config - used to create a connection to RedischeckConnectionBeforeUse - check to make sure the connection is alive before using itIllegalArgumentException - if the config is nullpublic ClientImpl(Config config, long initialDelay, long period, TimeUnit timeUnit)
config - used to create a connection to RedisinitialDelay - the time to delay first connection checkperiod - the period between successive connection checkstimeUnit - the time unit of the initialDelay and period parametersprotected void doEnqueue(String queue, String jobJson)
AbstractClientdoEnqueue in class AbstractClientqueue - the queue to add the Job tojobJson - the serialized Jobprotected void doPriorityEnqueue(String queue, String jobJson)
AbstractClientdoPriorityEnqueue in class AbstractClientqueue - the queue to add the Job tojobJson - the serialized Jobprotected boolean doAcquireLock(String lockName, String lockHolder, Integer timeout) throws Exception
AbstractClientdoAcquireLock in class AbstractClientlockName - all calls to this method will contend for a unique lock with
the name of lockNamelockHolder - a unique string used to tell if you are the current holder of
a lock for both acquisition, and extensiontimeout - seconds until the lock will expireExceptionpublic void end()
ClientCopyright © 2011-2013. All Rights Reserved.