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,
int timeout)
Actually acquire the lock based upon the client acquisition model.
|
protected void |
doDelayedEnqueue(String queue,
String msg,
long future) |
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.
|
protected void |
doRemoveDelayedEnqueue(String queue,
String msg) |
void |
end()
Quits the connection to the Redis server.
|
acquireLock, delayedEnqueue, doAcquireLock, doDelayedEnqueue, doEnqueue, doPriorityEnqueue, doRemoveDelayedEnqueue, enqueue, getNamespace, key, priorityEnqueue, removeDelayedEnqueuepublic 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)
doEnqueue in class AbstractClientqueue - the queue to add the Job tojobJson - the serialized Jobprotected void doPriorityEnqueue(String queue, String jobJson)
doPriorityEnqueue in class AbstractClientqueue - the queue to add the Job tojobJson - the serialized Jobprotected boolean doAcquireLock(String lockName, String lockHolder, int timeout) throws Exception
doAcquireLock in class AbstractClientlockName - the name of the lock to acquirelockHolder - a unique string identifying the callertimeout - number of seconds until the lock will expireException - in case something goes wrongpublic void end()
protected void doDelayedEnqueue(String queue, String msg, long future) throws Exception
doDelayedEnqueue in class AbstractClientExceptionprotected void doRemoveDelayedEnqueue(String queue, String msg) throws Exception
doRemoveDelayedEnqueue in class AbstractClientExceptionCopyright © 2011-2015. All Rights Reserved.