public class UUIDService extends Object implements Service
The configuration property 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 |
static int |
MAX_ACTION_ID_LEN |
static int |
MAX_OOZIE_JOB_ID_LEN |
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 static final int MAX_OOZIE_JOB_ID_LEN
public static final int MAX_ACTION_ID_LEN
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, 'W' for Workflow and 'B' for Bundle.Services.CONF_SYSTEM_ID
configuration property.
Unique ID Example: 0007728-150515180312570-oozie-oozi-Wprotected String createSequence()
protected long getCounter()
protected String appendTimeToSequence(long id, String localStartTime)
public String generateChildId(String id, String childName)
If the same child name is given the returned child ID is the same.
id
- unique ID.childName
- child name.public String getId(String childId)
childId
- child ID.public String getChildName(String childId)
childId
- child ID.Copyright © 2018 Apache Software Foundation. All rights reserved.