当前位置: 首页>>代码示例>>Java>>正文


Java DefaultsFactory类代码示例

本文整理汇总了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);
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-lite,代码行数:27,代码来源:ServerViewFactory.java

示例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;
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-lite,代码行数:24,代码来源:ConnectionClientExecutorsService.java

示例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();
    }
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-clients,代码行数:23,代码来源:Jmx.java

示例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;
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-lite,代码行数:8,代码来源:ServerViewFactory.java

示例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());
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-clients,代码行数:33,代码来源:ServerViewJmxQuery.java

示例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);
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-proxy,代码行数:8,代码来源:ProxyConnectExecutor.java

示例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;
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-proxy,代码行数:8,代码来源:ProxyConnectExecutor.java

示例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);
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-lite,代码行数:7,代码来源:ServerViewFactory.java

示例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);
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-lite,代码行数:5,代码来源:ConnectionClientExecutorsService.java

示例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());
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-lite,代码行数:7,代码来源:ConnectionClientExecutorsService.java


注:本文中的edu.uw.zookeeper.common.DefaultsFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。