本文整理了Java中io.vertx.ext.consul.KeyValue.getSession()
方法的一些代码示例,展示了KeyValue.getSession()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。KeyValue.getSession()
方法的具体详情如下:
包路径:io.vertx.ext.consul.KeyValue
类名称:KeyValue
方法名:getSession
[英]Get the session that owns the lock
[中]获取拥有锁的会话
代码示例来源:origin: io.vertx/vertx-consul-client
public static void toJson(KeyValue obj, java.util.Map<String, Object> json) {
json.put("createIndex", obj.getCreateIndex());
json.put("flags", obj.getFlags());
if (obj.getKey() != null) {
json.put("key", obj.getKey());
}
json.put("lockIndex", obj.getLockIndex());
json.put("modifyIndex", obj.getModifyIndex());
if (obj.getSession() != null) {
json.put("session", obj.getSession());
}
if (obj.getValue() != null) {
json.put("value", obj.getValue());
}
}
}
代码示例来源:origin: io.vertx/vertx-consul-client
private void checkKeyValue(KeyValue expected, KeyValue actual) {
assertEquals(expected, actual);
assertEquals(expected.hashCode(), actual.hashCode());
assertEquals(expected.getKey(), actual.getKey());
assertEquals(expected.getValue(), actual.getValue());
assertEquals(expected.getSession(), actual.getSession());
assertEquals(expected.getCreateIndex(), actual.getCreateIndex());
assertEquals(expected.getFlags(), actual.getFlags());
assertEquals(expected.getModifyIndex(), actual.getModifyIndex());
assertEquals(expected.getLockIndex(), actual.getLockIndex());
}
代码示例来源:origin: io.vertx/vertx-consul-client
@Test
public void deleteBehavior(TestContext tc) {
ctx.writeClient().createSessionWithOptions(new SessionOptions().setTtl(442).setBehavior(SessionBehavior.DELETE), tc.asyncAssertSuccess(id -> {
ctx.writeClient().putValueWithOptions("foo/bar", "value1", new KeyValueOptions().setAcquireSession(id), tc.asyncAssertSuccess(b -> {
tc.assertTrue(b);
ctx.writeClient().getValue("foo/bar", tc.asyncAssertSuccess(pair -> {
tc.assertEquals("value1", pair.getValue());
tc.assertEquals(id, pair.getSession());
ctx.writeClient().destroySession(id, tc.asyncAssertSuccess(v -> {
ctx.writeClient().getValue("foo/bar", tc.asyncAssertSuccess(notfound -> {
tc.assertFalse(notfound.isPresent());
}));
}));
}));
}));
}));
}
}
内容来源于网络,如有侵权,请联系作者删除!