Codota Logo
DistributedMap
Code IndexAdd Codota to your IDE (free)

How to use
DistributedMap
in
com.oath.micro.server.distributed

Best Java code snippets using com.oath.micro.server.distributed.DistributedMap (Showing top 16 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
OutputStreamWriter o =
  • Codota IconOutputStream out;new OutputStreamWriter(out)
  • Codota IconOutputStream out;String charsetName;new OutputStreamWriter(out, charsetName)
  • Codota IconHttpURLConnection connection;new OutputStreamWriter(connection.getOutputStream())
  • Smart code suggestions by Codota
}
origin: aol/micro-server

private VersionedKey loadKeyFromCouchbase() {
  Optional<String> optionalKey = connection.get(key);
  return optionalKey.flatMap(val -> Optional.of(JacksonUtil.convertFromJson(val, VersionedKey.class)))
           .orElse(newKey(0L));
}
origin: aol/micro-server

  @GET
  @Path("/put")
  public String put() {
    client.put("hello", "world");
    return "added";
  }
}
origin: aol/micro-server

private void delete(String withVersion) {
  connection.delete(withVersion);
}
origin: aol/micro-server

@SuppressWarnings("unchecked")
private Object nonAtomicload(String newVersionedKey) throws Throwable {
  Data data = (Data) connection.get(newVersionedKey)
                 .orElseThrow(() -> {
                   return new ManifestComparatorKeyNotFoundException(
                                            "Missing versioned key "
                                                + newVersionedKey
                                                + " - likely data changed during read");
                 });
  logger.info("Loaded new data with date {} for key {}, versionedKey {}, versionedKey from data ",
        new Object[] { data.getDate(), key, newVersionedKey, data.getVersionedKey() });
  return data.getData();
}
origin: aol/micro-server

  @GET
  @Path("/put")
  public String put() {
    client.put("hello", "world");
    return "added";
  }
}
origin: aol/micro-server

@GET
@Path("/get")
public String bucket() {
  return client.get("hello")
         .toString();
}
origin: aol/micro-server

  @GET
  @Path("/put")
  public String put() {
    client.put("hello", "world");
    return "added";
  }
}
origin: aol/micro-server

@GET
@Path("/get")
public String bucket() {
  return client.get("hello")
         .toString();
}
origin: aol/micro-server

  @GET
  @Path("/put")
  public String put() {
    client.put("hello", "world");
    return "added";
  }
}
origin: aol/micro-server

@GET
@Path("/get")
public String bucket() {
  return client.get("hello").toString();
}
origin: aol/micro-server

  @GET
  @Path("/put")
  public String put() {
    client.put("hello", "world");
    return "added";
  }
}
origin: aol/micro-server

@GET
@Path("/get")
public String bucket() {
  return client.get("hello").toString();
}
origin: aol/micro-server

/**
 * Save provided data with the key this ManifestComparator manages bump the
 * versioned key version.
 * 
 * NB : To avoid race conditions - make sure only one service (an elected
 * leader) can write at a time (see micro-mysql for a mysql distributed
 * lock, or micro-curator for a curator / zookeeper distributed lock
 * implementation).
 * 
 * @param data
 *            to save
 */
@Override
public void saveAndIncrement(T data) {
  Either<Void, T> oldData = this.data;
  VersionedKey newVersionedKey = increment();
  logger.info("Saving data with key {}, new version is {}", key, newVersionedKey.toJson());
  connection.put(newVersionedKey.toJson(), new Data(
                           data, new Date(), newVersionedKey.toJson()));
  connection.put(key, newVersionedKey.toJson());
  try {
    this.data = Either.right(data);
    delete(versionedKey);
  } catch (Throwable t) {
    this.data = oldData;
  } finally {
    versionedKey = newVersionedKey.toJson();
  }
}
origin: aol/micro-server

@GET
@Path("/get")
public String bucket() {
  return client.get("hello")
         .toString();
}
origin: aol/micro-server

/**
 * Load data from remote store if stale
 */
@Override
public synchronized boolean load() {
  Either<Void, T> oldData = data;
  String oldKey = versionedKey;
  try {
    if (isOutOfDate()) {
      String newVersionedKey = (String) connection.get(key)
                            .get();
      data = Either.right((T) nonAtomicload(newVersionedKey));
      versionedKey = newVersionedKey;
    } else {
      return false;
    }
  } catch (Throwable e) {
    data = oldData;
    versionedKey = oldKey;
    logger.debug(e.getMessage(), e);
    throw ExceptionSoftener.throwSoftenedException(e);
  }
  return true;
}
origin: aol/micro-server

@Test
public void createDistributedCacheMemcachedOff() throws IOException, URISyntaxException {
  config.setCouchbaseClientEnabled(false);
  DistributedMap<Object> cache = config.simpleCouchbaseClient();
  assertThat(cache.get("hello"), is(Optional.empty()));
}
com.oath.micro.server.distributedDistributedMap

Most used methods

  • get
  • put
  • delete

Popular in Java

  • Parsing JSON documents to java classes using gson
  • addToBackStack (FragmentTransaction)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getExternalFilesDir (Context)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • String (java.lang)
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now