Tabnine Logo
CuratorService.checkServiceLive
Code IndexAdd Tabnine to your IDE (free)

How to use
checkServiceLive
method
in
org.apache.hadoop.registry.client.impl.zk.CuratorService

Best Java code snippets using org.apache.hadoop.registry.client.impl.zk.CuratorService.checkServiceLive (Showing top 20 results out of 315)

origin: org.apache.hadoop/hadoop-yarn-registry

/**
 * Probe for a path existing.
 *
 * @param path path of operation
 * @return true if the path was visible from the ZK server
 * queried.
 * @throws IOException on any exception other than
 *                     {@link PathNotFoundException}
 */
public boolean zkPathExists(String path) throws IOException {
 checkServiceLive();
 try {
  // if zkStat(path) returns without throwing an exception, the return value
  // is guaranteed to be not null
  zkStat(path);
  return true;
 } catch (PathNotFoundException e) {
  return false;
 } catch (IOException e) {
  throw e;
 }
}
origin: io.hops/hadoop-yarn-registry

/**
 * Probe for a path existing
 * @param path path of operation
 * @return true if the path was visible from the ZK server
 * queried.
 * @throws IOException on any exception other than
 * {@link PathNotFoundException}
 */
public boolean zkPathExists(String path) throws IOException {
 checkServiceLive();
 try {
  // if zkStat(path) returns without throwing an exception, the return value
  // is guaranteed to be not null
  zkStat(path);
  return true;
 } catch (PathNotFoundException e) {
  return false;
 } catch (IOException e) {
  throw e;
 }
}
origin: io.hops/hadoop-yarn-registry

/**
 * Read data on a path
 * @param path path of operation
 * @return the data
 * @throws IOException read failure
 */
public byte[] zkRead(String path) throws IOException {
 checkServiceLive();
 String fullpath = createFullPath(path);
 try {
  if (LOG.isDebugEnabled()) {
   LOG.debug("Reading {}", fullpath);
  }
  return curator.getData().forPath(fullpath);
 } catch (Exception e) {
  throw operationFailure(fullpath, "read()", e);
 }
}
origin: org.apache.hadoop/hadoop-yarn-registry

/**
 * Read data on a path.
 *
 * @param path path of operation
 * @return the data
 * @throws IOException read failure
 */
public byte[] zkRead(String path) throws IOException {
 checkServiceLive();
 String fullpath = createFullPath(path);
 try {
  if (LOG.isDebugEnabled()) {
   LOG.debug("Reading {}", fullpath);
  }
  return curator.getData().forPath(fullpath);
 } catch (Exception e) {
  throw operationFailure(fullpath, "read()", e);
 }
}
origin: io.hops/hadoop-yarn-registry

/**
 * List all children of a path
 * @param path path of operation
 * @return a possibly empty list of children
 * @throws IOException
 */
public List<String> zkList(String path) throws IOException {
 checkServiceLive();
 String fullpath = createFullPath(path);
 try {
  if (LOG.isDebugEnabled()) {
   LOG.debug("ls {}", fullpath);
  }
  GetChildrenBuilder builder = curator.getChildren();
  List<String> children = builder.forPath(fullpath);
  return children;
 } catch (Exception e) {
  throw operationFailure(path, "ls()", e);
 }
}
origin: org.apache.hadoop/hadoop-yarn-registry

/**
 * List all children of a path.
 *
 * @param path path of operation
 * @return a possibly empty list of children
 * @throws IOException
 */
public List<String> zkList(String path) throws IOException {
 checkServiceLive();
 String fullpath = createFullPath(path);
 try {
  if (LOG.isDebugEnabled()) {
   LOG.debug("ls {}", fullpath);
  }
  GetChildrenBuilder builder = curator.getChildren();
  List<String> children = builder.forPath(fullpath);
  return children;
 } catch (Exception e) {
  throw operationFailure(path, "ls()", e);
 }
}
origin: io.hops/hadoop-yarn-registry

/**
 * Update the data for a path
 * @param path path of operation
 * @param data new data
 * @throws IOException
 */
public void zkUpdate(String path, byte[] data) throws IOException {
 Preconditions.checkArgument(data != null, "null data");
 checkServiceLive();
 path = createFullPath(path);
 try {
  if (LOG.isDebugEnabled()) {
   LOG.debug("Updating {} with {} bytes", path, data.length);
  }
  curator.setData().forPath(path, data);
 } catch (Exception e) {
  throw operationFailure(path, "update()", e);
 }
}
origin: org.apache.hadoop/hadoop-yarn-registry

/**
 * Update the data for a path.
 *
 * @param path path of operation
 * @param data new data
 * @throws IOException
 */
public void zkUpdate(String path, byte[] data) throws IOException {
 Preconditions.checkArgument(data != null, "null data");
 checkServiceLive();
 path = createFullPath(path);
 try {
  if (LOG.isDebugEnabled()) {
   LOG.debug("Updating {} with {} bytes", path, data.length);
  }
  curator.setData().forPath(path, data);
 } catch (Exception e) {
  throw operationFailure(path, "update()", e);
 }
}
origin: org.apache.hadoop/hadoop-yarn-registry

/**
 * Stat the file.
 *
 * @param path path of operation
 * @return a curator stat entry
 * @throws IOException           on a failure
 * @throws PathNotFoundException if the path was not found
 */
public Stat zkStat(String path) throws IOException {
 checkServiceLive();
 String fullpath = createFullPath(path);
 Stat stat;
 try {
  if (LOG.isDebugEnabled()) {
   LOG.debug("Stat {}", fullpath);
  }
  stat = curator.checkExists().forPath(fullpath);
 } catch (Exception e) {
  throw operationFailure(fullpath, "read()", e);
 }
 if (stat == null) {
  throw new PathNotFoundException(path);
 }
 return stat;
}
origin: io.hops/hadoop-yarn-registry

/**
 * Stat the file
 * @param path path of operation
 * @return a curator stat entry
 * @throws IOException on a failure
 * @throws PathNotFoundException if the path was not found
 */
public Stat zkStat(String path) throws IOException {
 checkServiceLive();
 String fullpath = createFullPath(path);
 Stat stat;
 try {
  if (LOG.isDebugEnabled()) {
   LOG.debug("Stat {}", fullpath);
  }
  stat = curator.checkExists().forPath(fullpath);
 } catch (Exception e) {
  throw operationFailure(fullpath, "read()", e);
 }
 if (stat == null) {
  throw new PathNotFoundException(path);
 }
 return stat;
}
origin: io.hops/hadoop-yarn-registry

/**
 * Create a path with given data. byte[0] is used for a path
 * without data
 * @param path path of operation
 * @param data initial data
 * @param acls
 * @throws IOException
 */
public void zkCreate(String path,
  CreateMode mode,
  byte[] data,
  List<ACL> acls) throws IOException {
 Preconditions.checkArgument(data != null, "null data");
 checkServiceLive();
 String fullpath = createFullPath(path);
 try {
  if (LOG.isDebugEnabled()) {
   LOG.debug("Creating {} with {} bytes of data and ACL {}",
     fullpath, data.length,
     new RegistrySecurity.AclListInfo(acls));
  }
  curator.create().withMode(mode).withACL(acls).forPath(fullpath, data);
 } catch (Exception e) {
  throw operationFailure(fullpath, "create()", e, acls);
 }
}
origin: io.hops/hadoop-yarn-registry

/**
 * Get the ACLs of a path
 * @param path path of operation
 * @return a possibly empty list of ACLs
 * @throws IOException
 */
public List<ACL> zkGetACLS(String path) throws IOException {
 checkServiceLive();
 String fullpath = createFullPath(path);
 List<ACL> acls;
 try {
  if (LOG.isDebugEnabled()) {
   LOG.debug("GetACLS {}", fullpath);
  }
  acls = curator.getACL().forPath(fullpath);
 } catch (Exception e) {
  throw operationFailure(fullpath, "read()", e);
 }
 if (acls == null) {
  throw new PathNotFoundException(path);
 }
 return acls;
}
origin: org.apache.hadoop/hadoop-yarn-registry

/**
 * Create a path with given data. byte[0] is used for a path
 * without data.
 *
 * @param path path of operation
 * @param data initial data
 * @param acls
 * @throws IOException
 */
public void zkCreate(String path,
  CreateMode mode,
  byte[] data,
  List<ACL> acls) throws IOException {
 Preconditions.checkArgument(data != null, "null data");
 checkServiceLive();
 String fullpath = createFullPath(path);
 try {
  if (LOG.isDebugEnabled()) {
   LOG.debug("Creating {} with {} bytes of data and ACL {}",
     fullpath, data.length,
     new RegistrySecurity.AclListInfo(acls));
  }
  curator.create().withMode(mode).withACL(acls).forPath(fullpath, data);
 } catch (Exception e) {
  throw operationFailure(fullpath, "create()", e, acls);
 }
}
origin: io.hops/hadoop-yarn-registry

 List<ACL> acls)
 throws IOException {
checkServiceLive();
path = createFullPath(path);
if (acls == null || acls.isEmpty()) {
origin: org.apache.hadoop/hadoop-yarn-registry

 boolean recursive,
 BackgroundCallback backgroundCallback) throws IOException {
checkServiceLive();
String fullpath = createFullPath(path);
try {
origin: org.apache.hadoop/hadoop-yarn-registry

/**
 * Get the ACLs of a path.
 *
 * @param path path of operation
 * @return a possibly empty list of ACLs
 * @throws IOException
 */
public List<ACL> zkGetACLS(String path) throws IOException {
 checkServiceLive();
 String fullpath = createFullPath(path);
 List<ACL> acls;
 try {
  if (LOG.isDebugEnabled()) {
   LOG.debug("GetACLS {}", fullpath);
  }
  acls = curator.getACL().forPath(fullpath);
 } catch (Exception e) {
  throw operationFailure(fullpath, "read()", e);
 }
 if (acls == null) {
  throw new PathNotFoundException(path);
 }
 return acls;
}
origin: org.apache.hadoop/hadoop-yarn-registry

 List<ACL> acls)
 throws IOException {
checkServiceLive();
path = createFullPath(path);
if (acls == null || acls.isEmpty()) {
origin: io.hops/hadoop-yarn-registry

 boolean recursive,
 BackgroundCallback backgroundCallback) throws IOException {
checkServiceLive();
String fullpath = createFullPath(path);
try {
origin: io.hops/hadoop-yarn-registry

/**
 * Create or update an entry
 * @param path path
 * @param data data
 * @param acl ACL for path -used when creating a new entry
 * @param overwrite enable overwrite
 * @throws IOException
 * @return true if the entry was created, false if it was simply updated.
 */
public boolean zkSet(String path,
  CreateMode mode,
  byte[] data,
  List<ACL> acl, boolean overwrite) throws IOException {
 Preconditions.checkArgument(data != null, "null data");
 checkServiceLive();
 if (!zkPathExists(path)) {
  zkCreate(path, mode, data, acl);
  return true;
 } else {
  if (overwrite) {
   zkUpdate(path, data);
   return false;
  } else {
   throw new FileAlreadyExistsException(path);
  }
 }
}
origin: org.apache.hadoop/hadoop-yarn-registry

/**
 * Create or update an entry.
 *
 * @param path      path
 * @param data      data
 * @param acl       ACL for path -used when creating a new entry
 * @param overwrite enable overwrite
 * @return true if the entry was created, false if it was simply updated.
 * @throws IOException
 */
public boolean zkSet(String path,
  CreateMode mode,
  byte[] data,
  List<ACL> acl, boolean overwrite) throws IOException {
 Preconditions.checkArgument(data != null, "null data");
 checkServiceLive();
 if (!zkPathExists(path)) {
  zkCreate(path, mode, data, acl);
  return true;
 } else {
  if (overwrite) {
   zkUpdate(path, data);
   return false;
  } else {
   throw new FileAlreadyExistsException(path);
  }
 }
}
org.apache.hadoop.registry.client.impl.zkCuratorServicecheckServiceLive

Javadoc

Internal check that a service is in the live state

Popular methods of CuratorService

  • zkPathExists
    Probe for a path existing
  • bindingDiagnosticDetails
    Get the binding diagnostics
  • dumpPath
    Return a path dumper instance which can do a full dump of the registry tree in its toString() operat
  • zkCreate
    Create a path with given data. byte[0] is used for a path without data
  • zkMkPath
    Create a directory. It is not an error if it already exists
  • zkUpdate
    Update the data for a path
  • <init>
    Construct the service.
  • addService
  • buildConnectionString
    Override point: get the connection string used to connect to the ZK service
  • buildSecurityDiagnostics
    Build the security diagnostics string
  • createCurator
    Create a new curator instance off the root path; using configuration options provided in the service
  • createEnsembleProvider
    Create the ensemble provider for this registry, by invoking RegistryBindingSource#supplyBindingInfor
  • createCurator,
  • createEnsembleProvider,
  • createFullPath,
  • getConfig,
  • getName,
  • getRegistrySecurity,
  • getServiceState,
  • init,
  • isInState

Popular in Java

  • Creating JSON documents from java classes using gson
  • getResourceAsStream (ClassLoader)
  • startActivity (Activity)
  • requestLocationUpdates (LocationManager)
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now