本文整理汇总了Java中io.atomix.primitive.Persistence类的典型用法代码示例。如果您正苦于以下问题:Java Persistence类的具体用法?Java Persistence怎么用?Java Persistence使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Persistence类属于io.atomix.primitive包,在下文中一共展示了Persistence类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sayHello
import io.atomix.primitive.Persistence; //导入依赖的package包/类
@GET
@Timed
@Path("/hello-world")
public Saying sayHello(@QueryParam("name") Optional<String> name) {
final AtomicCounter counter = atomix.atomicCounterBuilder("counter")
.withPersistence(Persistence.EPHEMERAL).build();
final String value = String.format(template, name.orElse(defaultName));
return new Saying(counter.incrementAndGet(), value);
}
示例2: getAsyncMultiMap
import io.atomix.primitive.Persistence; //导入依赖的package包/类
@Override
public <K, V> void getAsyncMultiMap(String name, Handler<AsyncResult<AsyncMultiMap<K, V>>> handler) {
atomix.<K, V>consistentMultimapBuilder(name)
.withSerializer(createSerializer())
.withConsistency(Consistency.LINEARIZABLE)
.withPersistence(Persistence.PERSISTENT)
.withReplication(Replication.SYNCHRONOUS)
.withRecovery(Recovery.RECOVER)
.withMaxRetries(5)
.buildAsync()
.whenComplete(VertxFutures.convertHandler(
handler, map -> new AtomixAsyncMultiMap<>(vertx, map.async()), vertx.getOrCreateContext()));
}
示例3: getAsyncMap
import io.atomix.primitive.Persistence; //导入依赖的package包/类
@Override
public <K, V> void getAsyncMap(String name, Handler<AsyncResult<AsyncMap<K, V>>> handler) {
atomix.<K, V>consistentMapBuilder(name)
.withSerializer(createSerializer())
.withConsistency(Consistency.LINEARIZABLE)
.withPersistence(Persistence.PERSISTENT)
.withReplication(Replication.SYNCHRONOUS)
.withRecovery(Recovery.RECOVER)
.withMaxRetries(5)
.buildAsync()
.whenComplete(VertxFutures.convertHandler(
handler, map -> new AtomixAsyncMap<>(vertx, map.async()), vertx.getOrCreateContext()));
}
示例4: getSyncMap
import io.atomix.primitive.Persistence; //导入依赖的package包/类
@Override
public <K, V> Map<K, V> getSyncMap(String name) {
return new AtomixMap<>(vertx, atomix.<K, V>consistentMapBuilder(name)
.withSerializer(createSerializer())
.withConsistency(Consistency.LINEARIZABLE)
.withPersistence(Persistence.PERSISTENT)
.withReplication(Replication.SYNCHRONOUS)
.withRecovery(Recovery.RECOVER)
.withMaxRetries(5)
.build());
}
示例5: defaultPersistence
import io.atomix.primitive.Persistence; //导入依赖的package包/类
@Override
protected Persistence defaultPersistence() {
return Persistence.PERSISTENT;
}
示例6: defaultPersistence
import io.atomix.primitive.Persistence; //导入依赖的package包/类
@Override
protected Persistence defaultPersistence() {
return Persistence.EPHEMERAL;
}
示例7: withPersistence
import io.atomix.primitive.Persistence; //导入依赖的package包/类
@Override
public DistributedSetBuilder<E> withPersistence(Persistence persistence) {
mapBuilder.withPersistence(persistence);
return this;
}
示例8: persistence
import io.atomix.primitive.Persistence; //导入依赖的package包/类
@Override
public Persistence persistence() {
return mapBuilder.persistence();
}