本文整理汇总了Java中org.xnio.channels.AcceptingChannel类的典型用法代码示例。如果您正苦于以下问题:Java AcceptingChannel类的具体用法?Java AcceptingChannel怎么用?Java AcceptingChannel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AcceptingChannel类属于org.xnio.channels包,在下文中一共展示了AcceptingChannel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: installConnectorServicesForNetworkInterfaceBinding
import org.xnio.channels.AcceptingChannel; //导入依赖的package包/类
@Deprecated
public static void installConnectorServicesForNetworkInterfaceBinding(ServiceTarget serviceTarget,
final ServiceName endpointName,
final String connectorName,
final ServiceName networkInterfaceBindingName,
final int port,
final OptionMap connectorPropertiesOptionMap,
final ServiceName securityRealm,
final ServiceName saslAuthenticationFactory,
final ServiceName sslContext,
final ServiceName socketBindingManager) {
final InjectedNetworkBindingStreamServerService streamServerService = new InjectedNetworkBindingStreamServerService(connectorPropertiesOptionMap, port);
final ServiceBuilder<AcceptingChannel<StreamConnection>> serviceBuilder = serviceTarget.addService(serverServiceName(connectorName), streamServerService)
.addDependency(networkInterfaceBindingName, NetworkInterfaceBinding.class, streamServerService.getInterfaceBindingInjector());
if (socketBindingManager != null) {
serviceBuilder.addDependency(socketBindingManager, SocketBindingManager.class, streamServerService.getSocketBindingManagerInjector());
}
installConnectorServices(serviceBuilder, streamServerService, endpointName, securityRealm, saslAuthenticationFactory, sslContext);
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:21,代码来源:RemotingServices.java
示例2: installConnectorServicesForSocketBinding
import org.xnio.channels.AcceptingChannel; //导入依赖的package包/类
public static void installConnectorServicesForSocketBinding(ServiceTarget serviceTarget,
final ServiceName endpointName,
final String connectorName,
final ServiceName socketBindingName,
final OptionMap connectorPropertiesOptionMap,
final ServiceName securityRealm,
final ServiceName saslAuthenticationFactory,
final ServiceName sslContext,
final ServiceName socketBindingManager) {
final InjectedSocketBindingStreamServerService streamServerService = new InjectedSocketBindingStreamServerService(connectorPropertiesOptionMap);
final ServiceBuilder<AcceptingChannel<StreamConnection>> serviceBuilder = serviceTarget.addService(serverServiceName(connectorName), streamServerService)
.addDependency(socketBindingName, SocketBinding.class, streamServerService.getSocketBindingInjector())
.addDependency(socketBindingManager, SocketBindingManager.class, streamServerService.getSocketBindingManagerInjector());
installConnectorServices(serviceBuilder, streamServerService, endpointName, securityRealm, saslAuthenticationFactory, sslContext);
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:17,代码来源:RemotingServices.java
示例3: installConnectorServices
import org.xnio.channels.AcceptingChannel; //导入依赖的package包/类
private static void installConnectorServices(final ServiceBuilder<AcceptingChannel<StreamConnection>> serviceBuilder,
final AbstractStreamServerService service,
final ServiceName endpointName,
final ServiceName securityRealm,
final ServiceName saslAuthenticationFactory,
final ServiceName sslContext) {
serviceBuilder.addDependency(endpointName, Endpoint.class, service.getEndpointInjector());
if (securityRealm != null) {
serviceBuilder.addDependency(securityRealm, SecurityRealm.class, service.getSecurityRealmInjector());
}
if (saslAuthenticationFactory != null) {
serviceBuilder.addDependency(saslAuthenticationFactory, SaslAuthenticationFactory.class, service.getSaslAuthenticationFactoryInjector());
}
if (sslContext != null) {
serviceBuilder.addDependency(sslContext, SSLContext.class, service.getSSLContextInjector());
}
serviceBuilder.install();
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:20,代码来源:RemotingServices.java
示例4: createServer
import org.xnio.channels.AcceptingChannel; //导入依赖的package包/类
private AcceptingChannel<? extends StreamConnection> createServer(int sourcePort, int targetPort)
throws IllegalArgumentException, IOException {
OptionMap socketOptions = OptionMap.builder()
.set(Options.WORKER_IO_THREADS, 16)
.set(Options.TCP_NODELAY, true)
.set(Options.REUSE_ADDRESSES, true)
.getMap();
ChannelListener<AcceptingChannel<StreamConnection>> acceptListener = ChannelListeners.openListenerAdapter(
new PortForwardOpenListener(connection, portForwardURI.getPath(), targetPort, requestId, bufferPoolSlice,
OptionMap.EMPTY));
AcceptingChannel<? extends StreamConnection> server =
xnioWorker.createStreamConnectionServer(new InetSocketAddress(portForwardBindAddress, sourcePort),
acceptListener, socketOptions);
server.resumeAccepts();
return server;
}
开发者ID:arquillian,项目名称:arquillian-cube,代码行数:18,代码来源:PortForwarder.java
示例5: stop
import org.xnio.channels.AcceptingChannel; //导入依赖的package包/类
public synchronized void stop() {
for (AcceptingChannel<? extends StreamConnection> channel : channels) {
IoUtils.safeClose(channel);
}
channels = null;
worker.shutdownNow();
worker = null;
xnio = null;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:Undertow.java
示例6: close
import org.xnio.channels.AcceptingChannel; //导入依赖的package包/类
@Override
protected void close() {
if (null == channels) {
// not booted yet
return;
}
for (AcceptingChannel<? extends StreamConnection> channel : channels) {
IO.close(channel);
}
channels.clear();
worker.shutdownNow();
}
开发者ID:actframework,项目名称:actframework,代码行数:13,代码来源:UndertowNetwork.java
示例7: ChannelServer
import org.xnio.channels.AcceptingChannel; //导入依赖的package包/类
private ChannelServer(final Endpoint endpoint,
final Registration registration,
final AcceptingChannel<StreamConnection> streamServer) {
this.endpoint = endpoint;
this.registration = registration;
this.streamServer = streamServer;
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:8,代码来源:ChannelServer.java
示例8: create
import org.xnio.channels.AcceptingChannel; //导入依赖的package包/类
public static ChannelServer create(final Configuration configuration) throws IOException {
if (configuration == null) {
throw new IllegalArgumentException("Null configuration");
}
configuration.validate();
// Hack WFCORE-3302/REM3-303 workaround
if (firstCreate) {
firstCreate = false;
} else {
try {
// wait in case the previous socket has not closed
Thread.sleep(100);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RuntimeException(e);
}
}
// TODO WFCORE-3302 -- Endpoint.getCurrent() should be ok
final Endpoint endpoint = Endpoint.builder().setEndpointName(configuration.getEndpointName()).build();
final NetworkServerProvider networkServerProvider = endpoint.getConnectionProviderInterface(configuration.getUriScheme(), NetworkServerProvider.class);
final SecurityDomain.Builder domainBuilder = SecurityDomain.builder();
final SimpleMapBackedSecurityRealm realm = new SimpleMapBackedSecurityRealm();
domainBuilder.addRealm("default", realm).build();
domainBuilder.setDefaultRealmName("default");
domainBuilder.setPermissionMapper((permissionMappable, roles) -> PermissionVerifier.ALL);
SecurityDomain testDomain = domainBuilder.build();
SaslAuthenticationFactory saslAuthenticationFactory = SaslAuthenticationFactory.builder()
.setSecurityDomain(testDomain)
.setMechanismConfigurationSelector(mechanismInformation -> "ANONYMOUS".equals(mechanismInformation.getMechanismName()) ? MechanismConfiguration.EMPTY : null)
.setFactory(new AnonymousServerFactory())
.build();
System.out.println(configuration.getBindAddress());
AcceptingChannel<StreamConnection> streamServer = networkServerProvider.createServer(configuration.getBindAddress(), OptionMap.EMPTY, saslAuthenticationFactory, null);
return new ChannelServer(endpoint, null, streamServer);
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:40,代码来源:ChannelServer.java
示例9: getJaxrsPort
import org.xnio.channels.AcceptingChannel; //导入依赖的package包/类
public int getJaxrsPort() {
try {
Field channelsField = server.getClass().getDeclaredField("channels");
List<AcceptingChannel<? extends StreamConnection>> channels = InjectionUtils.readObjectFromField(server, channelsField);
return ((InetSocketAddress)channels.get(0).getLocalAddress()).getPort();
} catch (NoSuchFieldException e) {
throw new JaxRsException("Failed getting listener port", e);
}
}
开发者ID:michaelyaakoby,项目名称:testfun,代码行数:11,代码来源:JaxRsServer.java
示例10: WrappingXnioSocketChannel
import org.xnio.channels.AcceptingChannel; //导入依赖的package包/类
/**
* Create a new {@link WrappingXnioSocketChannel} which was created via the given {@link AcceptingChannel} and uses
* the given {@link StreamConnection} under the covers.
*/
public WrappingXnioSocketChannel(AcceptingChannel<StreamConnection> parent, StreamConnection channel) {
this(new WrappingXnioServerSocketChannel(parent), channel);
// register a EventLoop and start read
unsafe().register(new XnioEventLoop(thread), unsafe().voidPromise());
read();
}
开发者ID:xnio,项目名称:netty-xnio-transport,代码行数:11,代码来源:WrappingXnioSocketChannel.java
示例11: WrappingXnioServerSocketChannel
import org.xnio.channels.AcceptingChannel; //导入依赖的package包/类
/**
* Create a new instance wrapping the given {@link AcceptingChannel}
*/
@SuppressWarnings("unchecked")
public WrappingXnioServerSocketChannel(AcceptingChannel channel) {
if (channel == null) {
throw new NullPointerException("channel");
}
this.channel = channel;
thread = channel.getIoThread();
channel.getAcceptSetter().set(new AcceptListener());
// register a EventLoop and start read
unsafe().register(new XnioEventLoop(channel.getWorker().getIoThread()), unsafe().voidPromise());
read();
}
开发者ID:xnio,项目名称:netty-xnio-transport,代码行数:16,代码来源:WrappingXnioServerSocketChannel.java
示例12: localAddress0
import org.xnio.channels.AcceptingChannel; //导入依赖的package包/类
@Override
protected SocketAddress localAddress0() {
AcceptingChannel channel = xnioChannel();
if (channel == null) {
return null;
}
return channel.getLocalAddress();
}
开发者ID:xnio,项目名称:netty-xnio-transport,代码行数:9,代码来源:AbstractXnioServerSocketChannel.java
示例13: doClose
import org.xnio.channels.AcceptingChannel; //导入依赖的package包/类
@Override
protected void doClose() throws Exception {
AcceptingChannel channel = xnioChannel();
if (channel == null) {
return;
}
channel.suspendAccepts();
channel.close();
}
开发者ID:xnio,项目名称:netty-xnio-transport,代码行数:10,代码来源:AbstractXnioServerSocketChannel.java
示例14: doBeginRead
import org.xnio.channels.AcceptingChannel; //导入依赖的package包/类
@Override
protected void doBeginRead() throws Exception {
AcceptingChannel channel = xnioChannel();
if (channel == null) {
return;
}
channel.resumeAccepts();
}
开发者ID:xnio,项目名称:netty-xnio-transport,代码行数:9,代码来源:AbstractXnioServerSocketChannel.java
示例15: getValue
import org.xnio.channels.AcceptingChannel; //导入依赖的package包/类
@Override
public AcceptingChannel<StreamConnection> getValue() throws IllegalStateException, IllegalArgumentException {
return streamServer;
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:5,代码来源:AbstractStreamServerService.java
示例16: ChannelServer
import org.xnio.channels.AcceptingChannel; //导入依赖的package包/类
private ChannelServer(final Endpoint endpoint,
final AcceptingChannel<StreamConnection> streamServer) {
this.endpoint = endpoint;
this.streamServer = streamServer;
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:6,代码来源:ChannelServer.java
示例17: create
import org.xnio.channels.AcceptingChannel; //导入依赖的package包/类
public static ChannelServer create(final Configuration configuration) throws IOException {
if (configuration == null) {
throw new IllegalArgumentException("Null configuration");
}
configuration.validate();
// Hack WFCORE-3302/REM3-303 workaround
if (firstCreate) {
firstCreate = false;
} else {
try {
// wait in case the previous socket has not closed
Thread.sleep(100);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RuntimeException(e);
}
}
// TODO WFCORE-3302 -- Endpoint.getCurrent() should be ok
final Endpoint endpoint = Endpoint.builder().setEndpointName(configuration.getEndpointName()).build();
final NetworkServerProvider networkServerProvider = endpoint.getConnectionProviderInterface(configuration.getUriScheme(), NetworkServerProvider.class);
final SecurityDomain.Builder domainBuilder = SecurityDomain.builder();
final SimpleMapBackedSecurityRealm realm = new SimpleMapBackedSecurityRealm();
realm.setPasswordMap("bob", ClearPassword.createRaw(ClearPassword.ALGORITHM_CLEAR, "pass".toCharArray()));
domainBuilder.addRealm("default", realm).build();
domainBuilder.setDefaultRealmName("default");
domainBuilder.setPermissionMapper((permissionMappable, roles) -> PermissionVerifier.ALL);
SecurityDomain testDomain = domainBuilder.build();
SaslAuthenticationFactory saslAuthenticationFactory = SaslAuthenticationFactory.builder()
.setSecurityDomain(testDomain)
.setMechanismConfigurationSelector(mechanismInformation -> {
switch (mechanismInformation.getMechanismName()) {
case "ANONYMOUS":
case "PLAIN": {
return MechanismConfiguration.EMPTY;
}
default: return null;
}
})
.setFactory(SaslFactories.getElytronSaslServerFactory())
.build();
AcceptingChannel<StreamConnection> streamServer = networkServerProvider.createServer(configuration.getBindAddress(), OptionMap.EMPTY, saslAuthenticationFactory, null);
return new ChannelServer(endpoint, streamServer);
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:48,代码来源:ChannelServer.java
示例18: PortForwardServer
import org.xnio.channels.AcceptingChannel; //导入依赖的package包/类
private PortForwardServer(AcceptingChannel<? extends StreamConnection> server, int targetPort) {
this.server = server;
this.targetPort = targetPort;
}
开发者ID:arquillian,项目名称:arquillian-cube,代码行数:5,代码来源:PortForwarder.java
示例19: xnioChannel
import org.xnio.channels.AcceptingChannel; //导入依赖的package包/类
@Override
protected AcceptingChannel xnioChannel() {
return channel;
}
开发者ID:xnio,项目名称:netty-xnio-transport,代码行数:5,代码来源:XnioServerSocketChannel.java
示例20: isOpen
import org.xnio.channels.AcceptingChannel; //导入依赖的package包/类
@Override
public boolean isOpen() {
AcceptingChannel channel = xnioChannel();
return channel == null || channel.isOpen();
}
开发者ID:xnio,项目名称:netty-xnio-transport,代码行数:6,代码来源:AbstractXnioServerSocketChannel.java
注:本文中的org.xnio.channels.AcceptingChannel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论