@GET @Path("/put") public String put() { client.put("hello", "world"); return "added"; } }
@GET @Path("/put") public String put() { client.put("hello", "world"); return "added"; } }
@GET @Path("/put") public String put() { client.put("hello", "world"); return "added"; } }
@GET @Path("/put") public String put() { client.put("hello", "world"); return "added"; } }
@GET @Path("/put") public String put() { client.put("hello", "world"); return "added"; } }
/** * 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(); } }