org.apache.oozie.service
Class ZKUUIDService

java.lang.Object
  extended by org.apache.oozie.service.UUIDService
      extended by org.apache.oozie.service.ZKUUIDService
All Implemented Interfaces:
Service

public class ZKUUIDService
extends UUIDService

Service that provides distributed job id sequence via ZooKeeper. Requires that a ZooKeeper ensemble is available. The sequence path will be located under a ZNode named "job_id_sequence" under the namespace (see ZKUtils). The sequence will be reset to 0, once max is reached.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.oozie.service.UUIDService
UUIDService.ApplicationType
 
Field Summary
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
           
 
Fields inherited from class org.apache.oozie.service.UUIDService
CONF_GENERATOR, startTime
 
Fields inherited from interface org.apache.oozie.service.Service
DEFAULT_LOCK_TIMEOUT, lockTimeout, USE_XCOMMAND
 
Constructor Summary
ZKUUIDService()
           
 
Method Summary
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)
           
 
Methods inherited from class org.apache.oozie.service.UUIDService
appendTimeToSequence, generateChildId, generateId, getChildName, getCounter, getId, getInterface, longPadding, resetStartTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONF_PREFIX

public static final String CONF_PREFIX
See Also:
Constant Field Values

CONF_SEQUENCE_MAX

public static final String CONF_SEQUENCE_MAX
See Also:
Constant Field Values

LOCKS_NODE

public static final String LOCKS_NODE
See Also:
Constant Field Values

ZK_SEQUENCE_PATH

public static final String ZK_SEQUENCE_PATH
See Also:
Constant Field Values

RESET_VALUE

public static final long RESET_VALUE
See Also:
Constant Field Values

RETRY_COUNT

public static final int RETRY_COUNT
See Also:
Constant Field Values

dt

public static final ThreadLocal<SimpleDateFormat> dt
Constructor Detail

ZKUUIDService

public ZKUUIDService()
Method Detail

init

public void init(Services services)
          throws ServiceException
Description copied from class: UUIDService
Initialize the UUID service.

Specified by:
init in interface Service
Overrides:
init in class UUIDService
Parameters:
services - services instance.
Throws:
ServiceException - thrown if the UUID service could not be initialized.

createSequence

protected String createSequence()
Gets the unique id.

Overrides:
createSequence in class UUIDService
Returns:
the id
Throws:
Exception - the exception

getZKSequence

protected long getZKSequence()
                      throws Exception
Throws:
Exception

destroy

public void destroy()
Description copied from class: UUIDService
Destroy the UUID service.

Specified by:
destroy in interface Service
Overrides:
destroy in class UUIDService

getPromotedLock

public String getPromotedLock()

setMaxSequence

public void setMaxSequence(long sequence)


Copyright © 2015 Apache Software Foundation. All Rights Reserved.