public class ZKUUIDService extends UUIDService
ZKUtils
). The
sequence will be reset to 0, once max is reached.UUIDService.ApplicationType
Modifier and Type | Field and Description |
---|---|
static String |
CONF_PREFIX |
static String |
CONF_SEQUENCE_MAX |
static ThreadLocal<SimpleDateFormat> |
dt |
static String |
LOCKS_NODE |
static long |
RESET_VALUE |
static int |
RETRY_COUNT |
static String |
ZK_SEQUENCE_PATH |
CONF_GENERATOR, startTime
DEFAULT_LOCK_TIMEOUT, lockTimeout
Constructor and Description |
---|
ZKUUIDService() |
Modifier and Type | Method and Description |
---|---|
protected String |
createSequence()
Gets the unique id.
|
void |
destroy()
Destroy the UUID service.
|
String |
getPromotedLock() |
protected long |
getZKSequence() |
void |
init(Services services)
Initialize the UUID service.
|
void |
setMaxSequence(long sequence) |
appendTimeToSequence, generateChildId, generateId, getChildName, getCounter, getId, getInterface, longPadding, resetStartTime
public static final String CONF_PREFIX
public static final String CONF_SEQUENCE_MAX
public static final String LOCKS_NODE
public static final String ZK_SEQUENCE_PATH
public static final long RESET_VALUE
public static final int RETRY_COUNT
public static final ThreadLocal<SimpleDateFormat> dt
public ZKUUIDService()
public void init(Services services) throws ServiceException
UUIDService
init
in interface Service
init
in class UUIDService
services
- services instance.ServiceException
- thrown if the UUID service could not be initialized.protected String createSequence()
createSequence
in class UUIDService
Exception
- the exceptionprotected long getZKSequence() throws Exception
Exception
public void destroy()
UUIDService
destroy
in interface Service
destroy
in class UUIDService
public String getPromotedLock()
public void setMaxSequence(long sequence)
Copyright © 2015 Apache Software Foundation. All Rights Reserved.