Example #1
0
  @Override
  public void init(Services services) throws ServiceException {

    super.init(services);
    try {
      zk = ZKUtils.register(this);
      atomicIdGenerator =
          new DistributedAtomicLong(zk.getClient(), ZK_SEQUENCE_PATH, ZKUtils.getRetryPloicy());
    } catch (Exception ex) {
      throw new ServiceException(ErrorCode.E1700, ex.getMessage(), ex);
    }
  }
Example #2
0
 @Override
 public void destroy() {
   if (zk != null) {
     zk.unregister(this);
   }
   zk = null;
   super.destroy();
 }