本文整理汇总了Java中edu.uw.zookeeper.common.DefaultsFactory类的典型用法代码示例。如果您正苦于以下问题:Java DefaultsFactory类的具体用法?Java DefaultsFactory怎么用?Java DefaultsFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DefaultsFactory类属于edu.uw.zookeeper.common包,在下文中一共展示了DefaultsFactory类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: defaults
import edu.uw.zookeeper.common.DefaultsFactory; //导入依赖的package包/类
public static <C extends ProtocolConnection<? super Message.ClientSession, ? extends Operation.Response,?,?,?>> ServerViewFactory<Session, OperationClientExecutor<C>> defaults(
ClientConnectionFactory<C> connections,
ServerInetAddressView view,
TimeValue timeOut,
ScheduledExecutorService executor) {
ZxidTracker zxids = ZxidTracker.zero();
final DefaultsFactory<Session, ConnectMessage.Request> requestFactory = ConnectMessage.Request.factory(timeOut, zxids);
final FromRequestFactory<C> delegate =
FromRequestFactory.create(
FixedClientConnectionFactory.create(view.get(), connections),
executor);
return new ServerViewFactory<Session, OperationClientExecutor<C>>(
view,
new DefaultsFactory<Session, ListenableFuture<? extends OperationClientExecutor<C>>>() {
@Override
public ListenableFuture<OperationClientExecutor<C>> get() {
return delegate.get(requestFactory.get());
}
@Override
public ListenableFuture<OperationClientExecutor<C>> get(Session value) {
return delegate.get(requestFactory.get(value));
}
},
zxids);
}
示例2: getDefaultConnectionClientExecutorsService
import edu.uw.zookeeper.common.DefaultsFactory; //导入依赖的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;
}
示例3: main
import edu.uw.zookeeper.common.DefaultsFactory; //导入依赖的package包/类
/**
* Takes a JVM id as a command-line argument.
* Prints org.apache.ZooKeeperService MBeans.
*/
public static void main(String[] args) throws IOException {
DefaultsFactory<String, JMXServiceURL> urlFactory = SunAttachQueryJmx.getInstance();
JMXServiceURL url = (args.length > 0) ? urlFactory.get(args[0]) : urlFactory.get();
JMXConnector connector = JMXConnectorFactory.connect(url);
try {
MBeanServerConnection mbeans = connector.getMBeanServerConnection();
for (ServerSchema schema: ServerSchema.values()) {
NameTrie<JmxBeanNode> objectNames = schema.instantiate(mbeans);
if (! objectNames.isEmpty()) {
for (JmxBeanNode e: objectNames) {
System.out.printf("%s = %s%n", e.path(), e.getNames());
}
}
}
} finally {
connector.close();
}
}
示例4: ServerViewFactory
import edu.uw.zookeeper.common.DefaultsFactory; //导入依赖的package包/类
protected ServerViewFactory(
ServerInetAddressView view,
DefaultsFactory<V, ? extends ListenableFuture<? extends C>> delegate,
ZxidTracker zxids) {
super(view, zxids);
this.delegate = delegate;
}
示例5: main
import edu.uw.zookeeper.common.DefaultsFactory; //导入依赖的package包/类
/**
* Takes a JVM id as a command-line argument.
* Prints the server client network address if discovered.
* Prints the ensemble quorum addresses if discovered.
*/
public static void main(String[] args) throws Exception {
DefaultsFactory<String, JMXServiceURL> urlFactory = SunAttachQueryJmx.getInstance();
JMXServiceURL url = (args.length > 0) ? urlFactory.get(args[0]) : urlFactory.get();
JMXConnector connector = JMXConnectorFactory.connect(url);
StringBuilder output = new StringBuilder();
try {
MBeanServerConnection mbeans = connector.getMBeanServerConnection();
output.append("ClientAddress").append(' ');
ServerInetAddressView addressView = addressViewOf(mbeans);
if (addressView != null) {
output.append(addressView);
} else {
output.append("not found");
}
output.append('\n').append("Quorum").append(' ');
EnsembleView<ServerRoleView> ensembleView = ensembleViewOf(mbeans);
if (ensembleView != null) {
output.append(ensembleView);
} else {
output.append("not found");
}
output.append('\n');
} finally {
connector.close();
}
System.out.println(output.toString());
}
示例6: create
import edu.uw.zookeeper.common.DefaultsFactory; //导入依赖的package包/类
public static ProxyConnectExecutor create(
ConcurrentMap<Long, ProxySessionExecutor> sessions,
DefaultsFactory<ConnectMessage.Request, ? extends ListenableFuture<? extends MessageClientExecutor<?>>> clientFactory) {
return new ProxyConnectExecutor(
sessions,
clientFactory);
}
示例7: ProxyConnectExecutor
import edu.uw.zookeeper.common.DefaultsFactory; //导入依赖的package包/类
public ProxyConnectExecutor(
ConcurrentMap<Long, ProxySessionExecutor> executors,
DefaultsFactory<ConnectMessage.Request, ? extends ListenableFuture<? extends MessageClientExecutor<?>>> clientFactory) {
this.logger = LogManager.getLogger(this);
this.executors = executors;
this.clientFactory = clientFactory;
}
示例8: create
import edu.uw.zookeeper.common.DefaultsFactory; //导入依赖的package包/类
public static <V, C extends ConnectionClientExecutor<?,?,?,?>> ServerViewFactory<V,C> create(
ServerInetAddressView view,
DefaultsFactory<V, ? extends ListenableFuture<? extends C>> delegate,
ZxidTracker zxids) {
return new ServerViewFactory<V,C>(view, delegate, zxids);
}
示例9: newInstance
import edu.uw.zookeeper.common.DefaultsFactory; //导入依赖的package包/类
public static <I extends Operation.Request, T, C extends ConnectionClientExecutor<I,?,?,?>> ConnectionClientExecutorsService<I,T,C> newInstance(
DefaultsFactory<T, ? extends ListenableFuture<? extends C>> factory) {
return new ConnectionClientExecutorsService<I,T,C>(factory);
}
示例10: ConnectionClientExecutorsService
import edu.uw.zookeeper.common.DefaultsFactory; //导入依赖的package包/类
protected ConnectionClientExecutorsService(
DefaultsFactory<T, ? extends ListenableFuture<? extends C>> factory) {
this.executor = MoreExecutors.directExecutor();
this.factory = factory;
this.executors = Collections.synchronizedSet(Sets.<C>newHashSet());
}