本文整理汇总了Java中edu.uw.zookeeper.protocol.Operation.Request方法的典型用法代码示例。如果您正苦于以下问题:Java Operation.Request方法的具体用法?Java Operation.Request怎么用?Java Operation.Request使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.uw.zookeeper.protocol.Operation
的用法示例。
在下文中一共展示了Operation.Request方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDefaultConnectionClientExecutorsService
import edu.uw.zookeeper.protocol.Operation; //导入方法依赖的package包/类
@Override
protected ConnectionClientExecutorsService<Operation.Request, Session, OperationClientExecutor<?>> getDefaultConnectionClientExecutorsService() {
EnsembleView<ServerInetAddressView> ensemble = EnsembleViewConfiguration.get(getRuntimeModule().getConfiguration());
final EnsembleViewFactory<? extends ServerViewFactory<Session, ? extends OperationClientExecutor<?>>> ensembleFactory =
EnsembleViewFactory.fromSession(
getClientConnectionFactory(),
ensemble,
getConnectionBuilder().getTimeOut(),
getRuntimeModule().getExecutors().get(ScheduledExecutorService.class));
ConnectionClientExecutorsService<Operation.Request, Session, OperationClientExecutor<?>> service =
ConnectionClientExecutorsService.newInstance(
new DefaultsFactory<Session, ListenableFuture<? extends OperationClientExecutor<?>>>() {
@Override
public ListenableFuture<? extends OperationClientExecutor<?>> get(Session value) {
return ensembleFactory.get().get(value);
}
@Override
public ListenableFuture<? extends OperationClientExecutor<?>> get() {
return ensembleFactory.get().get();
}
});
return service;
}
示例2: randomCache
import edu.uw.zookeeper.protocol.Operation; //导入方法依赖的package包/类
public static <O extends Operation.ProtocolResponse<?>> LockableZNodeCache<ZNodeCache.SimpleCacheNode, Operation.Request, O> randomCache(
int iterations,
TimeValue timeOut,
ClientExecutor<Operation.Request,O,SessionListener> client,
Logger logger) throws KeeperException, InterruptedException, ExecutionException, TimeoutException {
LockableZNodeCache<ZNodeCache.SimpleCacheNode, Operation.Request, O> cache =
LockableZNodeCache.newInstance(
client);
Generator<Records.Request> requests = RandomRequestGenerator.fromCache(cache);
CountingGenerator<Pair<Records.Request, ListenableFuture<O>>> operations =
CountingGenerator.create(iterations, iterations,
SubmitGenerator.create(requests, cache), logger);
while (operations.hasNext()) {
Pair<Records.Request, ListenableFuture<O>> operation = operations.next();
Operations.unlessError(operation.second().get(timeOut.value(), timeOut.unit()).record());
}
return cache;
}
示例3: disconnect
import edu.uw.zookeeper.protocol.Operation; //导入方法依赖的package包/类
public static <I extends Operation.Request, T extends ConnectionClientExecutor<I,?,?,?>> void disconnect(T client) throws InterruptedException, ExecutionException, TimeoutException, KeeperException {
Disconnect<I,T> instance = Disconnect.create(client);
if (client.session().isDone()) {
instance.get(client.session().get().getTimeOut(), TimeUnit.MILLISECONDS);
} else {
instance.get();
}
}
示例4: newInstance
import edu.uw.zookeeper.protocol.Operation; //导入方法依赖的package包/类
protected Builder newInstance(
ClientConnectionFactoryBuilder connectionBuilder,
ClientConnectionFactory<? extends ProtocolConnection<Message.ClientSession, Message.ServerSession,?,?,?>> clientConnectionFactory,
ConnectionClientExecutorService<Operation.Request, Message.ServerResponse<?>> clientExecutor,
RuntimeModule runtime) {
return new Builder(connectionBuilder, clientConnectionFactory, clientExecutor, runtime);
}
示例5: create
import edu.uw.zookeeper.protocol.Operation; //导入方法依赖的package包/类
public static <I extends Operation.Request, O extends Operation.ProtocolResponse<?>, T extends SessionListener> ClientExecutor<? super I, O, T> create(
int limit,
ClientExecutor<? super I, O, T> client) {
if (limit == NO_LIMIT) {
return client;
} else if (limit < 0) {
throw new IllegalStateException(String.valueOf(limit));
} else {
return new LimitOutstandingClient<I,O,T>(limit, client);
}
}
示例6: testRandom
import edu.uw.zookeeper.protocol.Operation; //导入方法依赖的package包/类
@Test(timeout=30000)
public void testRandom() throws Exception {
SimpleServerAndClient client = SimpleServerAndClient.defaults().setDefaults();
ServiceMonitor monitor = client.getRuntimeModule().getServiceMonitor();
for (Service service: client.build()) {
monitor.add(service);
}
monitor.startAsync().awaitRunning();
LockableZNodeCache<ZNodeCache.SimpleCacheNode, Operation.Request, Message.ServerResponse<?>> cache =
RandomSingleClientTest.randomCache(
100,
TimeValue.milliseconds(5000),
client.getClientBuilder().getConnectionClientExecutor(),
logger);
Set<AbsoluteZNodePath> children = ImmutableSet.copyOf(
Iterables.transform(
cache.cache().root().keySet(),
new Function<ZNodeName,AbsoluteZNodePath>() {
@Override
public AbsoluteZNodePath apply(ZNodeName input) {
return (AbsoluteZNodePath) ZNodePath.root().join(input);
}
}));
assertEquals(children, ImmutableSet.copyOf(DeleteSubtree.deleteChildren(ZNodePath.root(), cache).get()));
assertTrue(cache.cache().isEmpty());
monitor.stopAsync().awaitTerminated();
}
示例7: TraceGeneratingCacheClientBuilder
import edu.uw.zookeeper.protocol.Operation; //导入方法依赖的package包/类
protected TraceGeneratingCacheClientBuilder(
LockableZNodeCache<ZNodeCache.SimpleCacheNode, Operation.Request, Message.ServerResponse<?>> cache,
ConnectionClientExecutorService.Builder clientBuilder,
TraceWriterBuilder writerBuilder,
TraceEventPublisherService tracePublisher,
ObjectMapper mapper,
RuntimeModule runtime) {
super(clientBuilder, writerBuilder, tracePublisher, mapper, runtime);
this.cache = cache;
}
示例8: submit
import edu.uw.zookeeper.protocol.Operation; //导入方法依赖的package包/类
public static <I extends Operation.Request, O extends Operation.ProtocolResponse<?>> SubmittedRequests<I,O> submit(TaskExecutor<? super I,? extends O> client, Iterable<? extends I> requests) {
final ImmutableList.Builder<ListenableFuture<? extends O>> futures = ImmutableList.builder();
for (I request: requests) {
futures.add(client.submit(request));
}
return new SubmittedRequests<I,O>(
ImmutableList.copyOf(requests),
Futures.allAsList(futures.build()));
}
示例9: Builder
import edu.uw.zookeeper.protocol.Operation; //导入方法依赖的package包/类
protected Builder(
ClientConnectionFactoryBuilder connectionBuilder,
ClientConnectionFactory<? extends ProtocolConnection<Message.ClientSession, Message.ServerSession,?,?,?>> clientConnectionFactory,
ConnectionClientExecutorService<Operation.Request, Message.ServerResponse<?>> clientExecutor,
RuntimeModule runtime) {
this.runtime = runtime;
this.connectionBuilder = connectionBuilder;
this.clientConnectionFactory = clientConnectionFactory;
this.clientExecutor = clientExecutor;
}
示例10: create
import edu.uw.zookeeper.protocol.Operation; //导入方法依赖的package包/类
public static <I extends Operation.Request> RequestErrorProcessor<I> create(
Processors.CheckedProcessor<? super I, ? extends Records.Response, KeeperException> processor) {
return new RequestErrorProcessor<I>(processor);
}
示例11: newInstance
import edu.uw.zookeeper.protocol.Operation; //导入方法依赖的package包/类
public static <I extends Operation.Request, O, V extends ProtocolCodec<?,?,?,?>, T extends CodecConnection<? super I, ? extends O, V, ?>> ClientProtocolConnection<I,O,V,T> newInstance(
T connection) {
return new ClientProtocolConnection<I,O,V,T>(connection);
}
示例12: create
import edu.uw.zookeeper.protocol.Operation; //导入方法依赖的package包/类
public static <I extends Operation.Request, T extends ConnectionClientExecutor<I,?,?,?>> Disconnect<I,T> create(
T client) {
Disconnect<I,T> instance = new Disconnect<I,T>(client, SettableFuturePromise.<Boolean>create());
instance.run();
return instance;
}
示例13: FetchCacheService
import edu.uw.zookeeper.protocol.Operation; //导入方法依赖的package包/类
public FetchCacheService(LockableZNodeCache<?, Operation.Request, Message.ServerResponse<?>> cache) {
this.cache = checkNotNull(cache);
}
示例14: create
import edu.uw.zookeeper.protocol.Operation; //导入方法依赖的package包/类
public static <I extends Operation.Request, O extends Operation.ProtocolResponse<?>> SubmitIterator<I,O> create(
Iterator<I> requests,
ClientExecutor<? super I, O, ?> client) {
return new SubmitIterator<I,O>(requests, client);
}
示例15: newInstance
import edu.uw.zookeeper.protocol.Operation; //导入方法依赖的package包/类
public static <E extends AbstractNameTrie.SimpleNode<E> & LockableZNodeCache.CacheNode<E,?>, I extends Operation.Request,O extends Operation.ProtocolResponse<?>> LockableZNodeCache<E,I,O> newInstance(
ClientExecutor<? super I,O,SessionListener> client, E root) {
return new LockableZNodeCache<E,I,O>(new ReentrantReadWriteLock(true), client, new CacheEvents(new StrongConcurrentSet<CacheListener>()), SimpleLabelTrie.forRoot(root));
}