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


Java ServerInetAddressView类代码示例

本文整理汇总了Java中edu.uw.zookeeper.ServerInetAddressView的典型用法代码示例。如果您正苦于以下问题:Java ServerInetAddressView类的具体用法?Java ServerInetAddressView怎么用?Java ServerInetAddressView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ServerInetAddressView类属于edu.uw.zookeeper包,在下文中一共展示了ServerInetAddressView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: defaults

import edu.uw.zookeeper.ServerInetAddressView; //导入依赖的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.ServerInetAddressView; //导入依赖的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: getDefaultConnectionClientExecutorsService

import edu.uw.zookeeper.ServerInetAddressView; //导入依赖的package包/类
@Override
protected ConnectionClientExecutorsService<Message.ClientRequest<?>, ConnectMessage.Request, MessageClientExecutor<?>> getDefaultConnectionClientExecutorsService() {
    EnsembleView<ServerInetAddressView> ensemble = EnsembleViewConfiguration.get(getRuntimeModule().getConfiguration());
    final EnsembleViewFactory<? extends ServerViewFactory<ConnectMessage.Request, ? extends MessageClientExecutor<?>>> ensembleFactory = 
            EnsembleViewFactory.random(
                ensemble, 
                ServerViewFactories.newInstance(
                        clientConnectionFactory, 
                        getRuntimeModule().getExecutors().get(ScheduledExecutorService.class)));
    ConnectionClientExecutorsService<Message.ClientRequest<?>, ConnectMessage.Request, MessageClientExecutor<?>> service =
            ConnectionClientExecutorsService.newInstance(
                    new DefaultsFactory<ConnectMessage.Request, ListenableFuture<? extends MessageClientExecutor<?>>>() {
                        @Override
                        public ListenableFuture<? extends MessageClientExecutor<?>> get(ConnectMessage.Request value) {
                            return ensembleFactory.get().get(value);
                        }
                        @Override
                        public ListenableFuture<? extends MessageClientExecutor<?>> get() {
                            return ensembleFactory.get().get();
                        }
                    });
    return service;
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-proxy,代码行数:24,代码来源:ProxyServerExecutorBuilder.java

示例4: ServerConnectionFactoryBuilder

import edu.uw.zookeeper.ServerInetAddressView; //导入依赖的package包/类
public ServerConnectionFactoryBuilder(
        RuntimeModule runtime,
        NetServerModule serverModule,
        Factory<? extends ProtocolCodec<Message.Server, Message.Client, Message.Server, Message.Client>> codecFactory,
        ParameterizedFactory<CodecConnection<Message.Server,Message.Client,ProtocolCodec<Message.Server, Message.Client, Message.Server, Message.Client>,?>, ? extends ServerProtocolConnection<?,?>> connectionFactory,
        ServerInetAddressView address) {
    this.runtime = runtime;
    this.serverModule = serverModule;
    this.codecFactory = codecFactory;
    this.connectionFactory = connectionFactory;
    this.address = address;
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-lite,代码行数:13,代码来源:ServerConnectionFactoryBuilder.java

示例5: setAddress

import edu.uw.zookeeper.ServerInetAddressView; //导入依赖的package包/类
public ServerConnectionFactoryBuilder setAddress(ServerInetAddressView address) {
    if (this.address == address) {
        return this;
    } else {
        return newInstance(runtime, serverModule, codecFactory, connectionFactory, address);
    }
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-lite,代码行数:8,代码来源:ServerConnectionFactoryBuilder.java

示例6: newInstance

import edu.uw.zookeeper.ServerInetAddressView; //导入依赖的package包/类
protected ServerConnectionFactoryBuilder newInstance(
        RuntimeModule runtime,
        NetServerModule serverModule,
        Factory<? extends ProtocolCodec<Message.Server, Message.Client, Message.Server, Message.Client>> codecFactory,
        ParameterizedFactory<CodecConnection<Message.Server,Message.Client,ProtocolCodec<Message.Server, Message.Client, Message.Server, Message.Client>,?>, ? extends ServerProtocolConnection<?,?>> connectionFactory,
        ServerInetAddressView address) {
    return new ServerConnectionFactoryBuilder(runtime, serverModule, codecFactory, connectionFactory, address);
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-lite,代码行数:9,代码来源:ServerConnectionFactoryBuilder.java

示例7: get

import edu.uw.zookeeper.ServerInetAddressView; //导入依赖的package包/类
public static ServerInetAddressView get(Configuration configuration) {
    Configurable configurable = getConfigurable();
    String value = 
            configuration.withConfigurable(configurable)
            .getConfigOrEmpty(configurable.path())
                .getString(configurable.arg());
    try {
        return ServerInetAddressView.fromString(value);
    } catch (UnknownHostException e) {
        throw new IllegalArgumentException(value, e);
    }
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-lite,代码行数:13,代码来源:ClientAddressConfiguration.java

示例8: ServerViewFactory

import edu.uw.zookeeper.ServerInetAddressView; //导入依赖的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

示例9: handleConnectionState

import edu.uw.zookeeper.ServerInetAddressView; //导入依赖的package包/类
@Override
public synchronized void handleConnectionState(Automaton.Transition<Connection.State> event) {
    if (Connection.State.CONNECTION_CLOSED == event.to()) {
        ConnectionClientExecutor<I, V, SessionListener, ?> instance;
        try {
            instance = get();
        } catch (Exception e) {
            return;
        }
        if (instance != null) {
            instance.connection().unsubscribe(this);
            instance.unsubscribe(ConnectionClientExecutorService.this);
        }
        if (isRunning()) {
            logger.warn("Connection closed to {}", server.get());
            if (factory.view().size() > 1) {
                Optional<ServerInetAddressView> prevServer = server;
                do {
                    server = Optional.of(factory.select());
                } while (server.equals(prevServer));
                future = Optional.absent();
                run();
                return;
            } else {
                setException(new ClosedChannelException());
            }
        }
    }
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-lite,代码行数:30,代码来源:ConnectionClientExecutorService.java

示例10: get

import edu.uw.zookeeper.ServerInetAddressView; //导入依赖的package包/类
public static EnsembleView<ServerInetAddressView> get(Configuration configuration) {
    Configurable configurable = getConfigurable();
    String value = 
            configuration.withConfigurable(configurable)
            .getConfigOrEmpty(configurable.path())
                .getString(configurable.arg());
    return ServerInetAddressView.ensembleFromString(value);
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-lite,代码行数:9,代码来源:EnsembleViewConfiguration.java

示例11: fromSession

import edu.uw.zookeeper.ServerInetAddressView; //导入依赖的package包/类
public static <C extends ProtocolConnection<? super Message.ClientSession, ? extends Operation.Response,?,?,?>> EnsembleViewFactory<ServerViewFactory<Session, OperationClientExecutor<C>>> fromSession(
        ClientConnectionFactory<C> connections,
        EnsembleView<ServerInetAddressView> view, 
        TimeValue timeOut,
        ScheduledExecutorService executor) {
    return random(
            view,  
            ServerViewFactories.<C>newInstance(connections, timeOut, executor));
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-lite,代码行数:10,代码来源:EnsembleViewFactory.java

示例12: random

import edu.uw.zookeeper.ServerInetAddressView; //导入依赖的package包/类
public static <T> EnsembleViewFactory<T> random(
        EnsembleView<ServerInetAddressView> view,
        ParameterizedFactory<ServerInetAddressView, T> factory) {
    return newInstance(
            view, 
            RandomSelector.<ServerInetAddressView>newInstance(),
            factory);
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-lite,代码行数:9,代码来源:EnsembleViewFactory.java

示例13: newInstance

import edu.uw.zookeeper.ServerInetAddressView; //导入依赖的package包/类
public static <T> EnsembleViewFactory<T> newInstance(
        EnsembleView<ServerInetAddressView> view,
        Function<ServerInetAddressView[], ServerInetAddressView> selector,
        ParameterizedFactory<ServerInetAddressView, T> factory) {
    return new EnsembleViewFactory<T>(
            view, selector, 
            InstanceFactory.newInstance(factory));
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-lite,代码行数:9,代码来源:EnsembleViewFactory.java

示例14: EnsembleViewFactory

import edu.uw.zookeeper.ServerInetAddressView; //导入依赖的package包/类
protected EnsembleViewFactory(
        EnsembleView<ServerInetAddressView> view,
        Function<ServerInetAddressView[], ServerInetAddressView> selector,
        ParameterizedFactory<ServerInetAddressView,T> factory) {
    this.view = view;
    this.selector = selector;
    this.factory = factory;
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-lite,代码行数:9,代码来源:EnsembleViewFactory.java

示例15: get

import edu.uw.zookeeper.ServerInetAddressView; //导入依赖的package包/类
@Override
public T get(ServerInetAddressView server) {
    if (! view().contains(server)) {
        throw new IllegalArgumentException(server.toString());
    }
    return factory.get(server);
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-lite,代码行数:8,代码来源:EnsembleViewFactory.java


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