java.lang.System.inheritedChannel()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(9.6k)|赞(0)|评价(0)|浏览(232)

本文整理了Java中java.lang.System.inheritedChannel()方法的一些代码示例,展示了System.inheritedChannel()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。System.inheritedChannel()方法的具体详情如下:
包路径:java.lang.System
类名称:System
方法名:inheritedChannel

System.inheritedChannel介绍

[英]Returns the inherited channel from the creator of the current virtual machine.
[中]返回从当前虚拟机的创建者继承的通道。

代码示例

代码示例来源:origin: fengjiachun/Jupiter

public static Channel inheritedChannel() throws IOException {
  return System.inheritedChannel();
}

代码示例来源:origin: fengjiachun/Jupiter

public static Channel inheritedChannel() throws IOException {
  return System.inheritedChannel();
}

代码示例来源:origin: org.jupiter-rpc/jupiter-all

public static Channel inheritedChannel() throws IOException {
  return System.inheritedChannel();
}

代码示例来源:origin: org.jupiter-rpc/jupiter-flightexec

public static Channel inheritedChannel() throws IOException {
  return System.inheritedChannel();
}

代码示例来源:origin: javaee/grizzly

@SuppressWarnings("unchecked")
protected <T> T getSystemInheritedChannel(final Class<?> channelType)
throws IOException {
  final Channel inheritedChannel = System.inheritedChannel();
  if (inheritedChannel == null) {
    throw new IOException("Inherited channel is not set");
  }
  if (!(channelType.isInstance(inheritedChannel))) {
    throw new IOException("Inherited channel is not "
        + channelType.getName()
        + ", but "
        + inheritedChannel.getClass().getName());
  }
  return (T) inheritedChannel;
}

代码示例来源:origin: javaee/grizzly

@SuppressWarnings("unchecked")
protected <T> T getSystemInheritedChannel(final Class<?> channelType)
throws IOException {
  final Channel inheritedChannel = System.inheritedChannel();
  if (inheritedChannel == null) {
    throw new IOException("Inherited channel is not set");
  }
  if (!(channelType.isInstance(inheritedChannel))) {
    throw new IOException("Inherited channel is not "
        + channelType.getName()
        + ", but "
        + inheritedChannel.getClass().getName());
  }
  return (T) inheritedChannel;
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server

@SuppressWarnings("unchecked")
protected <T> T getSystemInheritedChannel(final Class<?> channelType)
throws IOException {
  final Channel inheritedChannel = System.inheritedChannel();
  if (inheritedChannel == null) {
    throw new IOException("Inherited channel is not set");
  }
  if (!(channelType.isInstance(inheritedChannel))) {
    throw new IOException("Inherited channel is not "
        + channelType.getName()
        + ", but "
        + inheritedChannel.getClass().getName());
  }
  return (T) inheritedChannel;
}

代码示例来源:origin: javaee/grizzly

@SuppressWarnings("unchecked")
protected <T> T getSystemInheritedChannel(final Class<?> channelType)
throws IOException {
  final Channel inheritedChannel = System.inheritedChannel();
  if (inheritedChannel == null) {
    throw new IOException("Inherited channel is not set");
  }
  if (!(channelType.isInstance(inheritedChannel))) {
    throw new IOException("Inherited channel is not "
        + channelType.getName()
        + ", but "
        + inheritedChannel.getClass().getName());
  }
  return (T) inheritedChannel;
}

代码示例来源:origin: javaee/grizzly

@SuppressWarnings("unchecked")
protected <T> T getSystemInheritedChannel(final Class<?> channelType)
throws IOException {
  final Channel inheritedChannel = System.inheritedChannel();
  if (inheritedChannel == null) {
    throw new IOException("Inherited channel is not set");
  }
  if (!(channelType.isInstance(inheritedChannel))) {
    throw new IOException("Inherited channel is not "
        + channelType.getName()
        + ", but "
        + inheritedChannel.getClass().getName());
  }
  return (T) inheritedChannel;
}

代码示例来源:origin: javaee/grizzly

@SuppressWarnings("unchecked")
protected <T> T getSystemInheritedChannel(final Class<?> channelType)
throws IOException {
  final Channel inheritedChannel = System.inheritedChannel();
  if (inheritedChannel == null) {
    throw new IOException("Inherited channel is not set");
  }
  if (!(channelType.isInstance(inheritedChannel))) {
    throw new IOException("Inherited channel is not "
        + channelType.getName()
        + ", but "
        + inheritedChannel.getClass().getName());
  }
  return (T) inheritedChannel;
}

代码示例来源:origin: javaee/grizzly

@SuppressWarnings("unchecked")
protected <T> T getSystemInheritedChannel(final Class<?> channelType)
throws IOException {
  final Channel inheritedChannel = System.inheritedChannel();
  if (inheritedChannel == null) {
    throw new IOException("Inherited channel is not set");
  }
  if (!(channelType.isInstance(inheritedChannel))) {
    throw new IOException("Inherited channel is not "
        + channelType.getName()
        + ", but "
        + inheritedChannel.getClass().getName());
  }
  return (T) inheritedChannel;
}

代码示例来源:origin: javaee/grizzly

@SuppressWarnings("unchecked")
protected <T> T getSystemInheritedChannel(final Class<?> channelType)
throws IOException {
  final Channel inheritedChannel = System.inheritedChannel();
  if (inheritedChannel == null) {
    throw new IOException("Inherited channel is not set");
  }
  if (!(channelType.isInstance(inheritedChannel))) {
    throw new IOException("Inherited channel is not "
        + channelType.getName()
        + ", but "
        + inheritedChannel.getClass().getName());
  }
  return (T) inheritedChannel;
}

代码示例来源:origin: javaee/grizzly

@SuppressWarnings("unchecked")
protected <T> T getSystemInheritedChannel(final Class<?> channelType)
throws IOException {
  final Channel inheritedChannel = System.inheritedChannel();
  if (inheritedChannel == null) {
    throw new IOException("Inherited channel is not set");
  }
  if (!(channelType.isInstance(inheritedChannel))) {
    throw new IOException("Inherited channel is not "
        + channelType.getName()
        + ", but "
        + inheritedChannel.getClass().getName());
  }
  return (T) inheritedChannel;
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-core

@SuppressWarnings("unchecked")
protected <T> T getSystemInheritedChannel(final Class<?> channelType)
throws IOException {
  final Channel inheritedChannel = System.inheritedChannel();
  if (inheritedChannel == null) {
    throw new IOException("Inherited channel is not set");
  }
  if (!(channelType.isInstance(inheritedChannel))) {
    throw new IOException("Inherited channel is not "
        + channelType.getName()
        + ", but "
        + inheritedChannel.getClass().getName());
  }
  return (T) inheritedChannel;
}

代码示例来源:origin: org.mule.glassfish.grizzly/grizzly-framework

@SuppressWarnings("unchecked")
protected <T> T getSystemInheritedChannel(final Class<?> channelType)
throws IOException {
  final Channel inheritedChannel = System.inheritedChannel();
  if (inheritedChannel == null) {
    throw new IOException("Inherited channel is not set");
  }
  if (!(channelType.isInstance(inheritedChannel))) {
    throw new IOException("Inherited channel is not "
        + channelType.getName()
        + ", but "
        + inheritedChannel.getClass().getName());
  }
  return (T) inheritedChannel;
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server-core

@SuppressWarnings("unchecked")
protected <T> T getSystemInheritedChannel(final Class<?> channelType)
throws IOException {
  final Channel inheritedChannel = System.inheritedChannel();
  if (inheritedChannel == null) {
    throw new IOException("Inherited channel is not set");
  }
  if (!(channelType.isInstance(inheritedChannel))) {
    throw new IOException("Inherited channel is not "
        + channelType.getName()
        + ", but "
        + inheritedChannel.getClass().getName());
  }
  return (T) inheritedChannel;
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

protected void initServerSocket() throws Exception {
  if (!getUseInheritedChannel()) {
    serverSock = ServerSocketChannel.open();
    socketProperties.setProperties(serverSock.socket());
    InetSocketAddress addr = (getAddress()!=null?new InetSocketAddress(getAddress(),getPort()):new InetSocketAddress(getPort()));
    serverSock.socket().bind(addr,getAcceptCount());
  } else {
    // Retrieve the channel provided by the OS
    Channel ic = System.inheritedChannel();
    if (ic instanceof ServerSocketChannel) {
      serverSock = (ServerSocketChannel) ic;
    }
    if (serverSock == null) {
      throw new IllegalArgumentException(sm.getString("endpoint.init.bind.inherited"));
    }
  }
  serverSock.configureBlocking(true); //mimic APR behavior
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

@Override
public void open() throws IOException
{
  synchronized(this)
  {
    try 
    {
      Channel channel = System.inheritedChannel();
      if ( channel instanceof ServerSocketChannel )
        _acceptChannel = (ServerSocketChannel)channel;
      else
        LOG.warn("Unable to use System.inheritedChannel() [" +channel+ "]. Trying a new ServerSocketChannel at " + getHost() + ":" + getPort());
      
      if ( _acceptChannel != null )
        _acceptChannel.configureBlocking(true);
    }
    catch(NoSuchMethodError e)
    {
      LOG.warn("Need at least Java 5 to use socket inherited from xinetd/inetd.");
    }
    if (_acceptChannel == null)
      super.open();
  }
}

代码示例来源:origin: org.eclipse.jetty/server

@Override
public void open() throws IOException
{
  synchronized(this)
  {
    try 
    {
      Channel channel = System.inheritedChannel();
      if ( channel instanceof ServerSocketChannel )
        _acceptChannel = (ServerSocketChannel)channel;
      else
        LOG.warn("Unable to use System.inheritedChannel() [" +channel+ "]. Trying a new ServerSocketChannel at " + getHost() + ":" + getPort());
      
      if ( _acceptChannel != null )
        _acceptChannel.configureBlocking(true);
    }
    catch(NoSuchMethodError e)
    {
      LOG.warn("Need at least Java 5 to use socket inherited from xinetd/inetd.");
    }
    if (_acceptChannel == null)
      super.open();
  }
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-webapp

@Override
public void open() throws IOException
{
  synchronized(this)
  {
    try 
    {
      Channel channel = System.inheritedChannel();
      if ( channel instanceof ServerSocketChannel )
        _acceptChannel = (ServerSocketChannel)channel;
      else
        LOG.warn("Unable to use System.inheritedChannel() [" +channel+ "]. Trying a new ServerSocketChannel at " + getHost() + ":" + getPort());
      
      if ( _acceptChannel != null )
        _acceptChannel.configureBlocking(true);
    }
    catch(NoSuchMethodError e)
    {
      LOG.warn("Need at least Java 5 to use socket inherited from xinetd/inetd.");
    }
    if (_acceptChannel == null)
      super.open();
  }
}

相关文章