public class UUIDService extends Object implements Service
CONF_GENERATOR
specifies the ID generation type, 'random' or 'counter'.
For 'random' uses the JDK UUID.randomUUID() method.
For 'counter' uses a counter postfixed wit the system start up time.Modifier and Type | Class and Description |
---|---|
static class |
UUIDService.ApplicationType |
Modifier and Type | Field and Description |
---|---|
static String |
CONF_GENERATOR |
static String |
CONF_PREFIX |
protected String |
startTime |
DEFAULT_LOCK_TIMEOUT, lockTimeout
Constructor and Description |
---|
UUIDService() |
Modifier and Type | Method and Description |
---|---|
protected String |
appendTimeToSequence(long id,
String localStartTime) |
protected String |
createSequence() |
void |
destroy()
Destroy the UUID service.
|
String |
generateChildId(String id,
String childName)
Create a child ID.
|
String |
generateId(UUIDService.ApplicationType type)
Create a unique ID.
|
String |
getChildName(String childId)
Return the child name from a child ID.
|
protected long |
getCounter() |
String |
getId(String childId)
Return the ID from a child ID.
|
Class<? extends Service> |
getInterface()
Return the public interface for UUID service.
|
void |
init(Services services)
Initialize the UUID service.
|
protected String |
longPadding(long number) |
protected void |
resetStartTime()
reset start time
|
public static final String CONF_PREFIX
public static final String CONF_GENERATOR
public UUIDService()
public void init(Services services) throws ServiceException
init
in interface Service
services
- services instance.ServiceException
- thrown if the UUID service could not be initialized.protected void resetStartTime()
public Class<? extends Service> getInterface()
getInterface
in interface Service
UUIDService
.protected String longPadding(long number)
public String generateId(UUIDService.ApplicationType type)
type:
- Type of Id. Generally 'C' for Coordinator and 'W' for Workflow.protected String createSequence()
protected long getCounter()
protected String appendTimeToSequence(long id, String localStartTime)
public String generateChildId(String id, String childName)
id
- unique ID.childName
- child name.public String getId(String childId)
childId
- child ID.public String getChildName(String childId)
childId
- child ID.Copyright © 2015 Apache Software Foundation. All Rights Reserved.