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

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

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

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);
  }
 }
}
origin: io.hops/hadoop-yarn-registry

@Test
public void testCreateTwice() throws Throwable {
 byte[] buffer = getTestBuffer();
 curatorService.zkCreate("/testcreatetwice",
   CreateMode.PERSISTENT, buffer,
   rootACL);
 try {
  curatorService.zkCreate("/testcreatetwice",
    CreateMode.PERSISTENT, buffer,
    rootACL);
  fail();
 } catch (FileAlreadyExistsException e) {
 }
}
origin: org.apache.hadoop/hadoop-yarn-registry

@Test
public void testCreateTwice() throws Throwable {
 byte[] buffer = getTestBuffer();
 curatorService.zkCreate("/testcreatetwice",
   CreateMode.PERSISTENT, buffer,
   rootACL);
 try {
  curatorService.zkCreate("/testcreatetwice",
    CreateMode.PERSISTENT, buffer,
    rootACL);
  fail();
 } catch (FileAlreadyExistsException e) {
 }
}
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

@Test
public void testCreate() throws Throwable {
 curatorService.zkCreate("/testcreate",
   CreateMode.PERSISTENT, getTestBuffer(),
   rootACL
 );
 pathMustExist("/testcreate");
}
origin: io.hops/hadoop-yarn-registry

@Test
public void testCreateUpdate() throws Throwable {
 byte[] buffer = getTestBuffer();
 curatorService.zkCreate("/testcreateupdate",
   CreateMode.PERSISTENT, buffer,
   rootACL
 );
 curatorService.zkUpdate("/testcreateupdate", buffer);
}
origin: io.hops/hadoop-yarn-registry

@Test
public void testCreate() throws Throwable {
 curatorService.zkCreate("/testcreate",
   CreateMode.PERSISTENT, getTestBuffer(),
   rootACL
 );
 pathMustExist("/testcreate");
}
origin: org.apache.hadoop/hadoop-yarn-registry

@Test
public void testCreateUpdate() throws Throwable {
 byte[] buffer = getTestBuffer();
 curatorService.zkCreate("/testcreateupdate",
   CreateMode.PERSISTENT, buffer,
   rootACL
 );
 curatorService.zkUpdate("/testcreateupdate", buffer);
}
org.apache.hadoop.registry.client.impl.zkCuratorServicezkCreate

Javadoc

Create a path with given data. byte[0] is used for a path without data

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
  • 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
  • checkServiceLive
    Internal check that a service is in the live state
  • 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

  • Making http requests using okhttp
  • getResourceAsStream (ClassLoader)
  • runOnUiThread (Activity)
  • getExternalFilesDir (Context)
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Top 12 Jupyter Notebook extensions
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