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

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

本文整理了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

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

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

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

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

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

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

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

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

  1. @SuppressWarnings("unchecked")
  2. protected <T> T getSystemInheritedChannel(final Class<?> channelType)
  3. throws IOException {
  4. final Channel inheritedChannel = System.inheritedChannel();
  5. if (inheritedChannel == null) {
  6. throw new IOException("Inherited channel is not set");
  7. }
  8. if (!(channelType.isInstance(inheritedChannel))) {
  9. throw new IOException("Inherited channel is not "
  10. + channelType.getName()
  11. + ", but "
  12. + inheritedChannel.getClass().getName());
  13. }
  14. return (T) inheritedChannel;
  15. }

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

  1. @SuppressWarnings("unchecked")
  2. protected <T> T getSystemInheritedChannel(final Class<?> channelType)
  3. throws IOException {
  4. final Channel inheritedChannel = System.inheritedChannel();
  5. if (inheritedChannel == null) {
  6. throw new IOException("Inherited channel is not set");
  7. }
  8. if (!(channelType.isInstance(inheritedChannel))) {
  9. throw new IOException("Inherited channel is not "
  10. + channelType.getName()
  11. + ", but "
  12. + inheritedChannel.getClass().getName());
  13. }
  14. return (T) inheritedChannel;
  15. }

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

  1. @SuppressWarnings("unchecked")
  2. protected <T> T getSystemInheritedChannel(final Class<?> channelType)
  3. throws IOException {
  4. final Channel inheritedChannel = System.inheritedChannel();
  5. if (inheritedChannel == null) {
  6. throw new IOException("Inherited channel is not set");
  7. }
  8. if (!(channelType.isInstance(inheritedChannel))) {
  9. throw new IOException("Inherited channel is not "
  10. + channelType.getName()
  11. + ", but "
  12. + inheritedChannel.getClass().getName());
  13. }
  14. return (T) inheritedChannel;
  15. }

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

  1. @SuppressWarnings("unchecked")
  2. protected <T> T getSystemInheritedChannel(final Class<?> channelType)
  3. throws IOException {
  4. final Channel inheritedChannel = System.inheritedChannel();
  5. if (inheritedChannel == null) {
  6. throw new IOException("Inherited channel is not set");
  7. }
  8. if (!(channelType.isInstance(inheritedChannel))) {
  9. throw new IOException("Inherited channel is not "
  10. + channelType.getName()
  11. + ", but "
  12. + inheritedChannel.getClass().getName());
  13. }
  14. return (T) inheritedChannel;
  15. }

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

  1. @SuppressWarnings("unchecked")
  2. protected <T> T getSystemInheritedChannel(final Class<?> channelType)
  3. throws IOException {
  4. final Channel inheritedChannel = System.inheritedChannel();
  5. if (inheritedChannel == null) {
  6. throw new IOException("Inherited channel is not set");
  7. }
  8. if (!(channelType.isInstance(inheritedChannel))) {
  9. throw new IOException("Inherited channel is not "
  10. + channelType.getName()
  11. + ", but "
  12. + inheritedChannel.getClass().getName());
  13. }
  14. return (T) inheritedChannel;
  15. }

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

  1. @SuppressWarnings("unchecked")
  2. protected <T> T getSystemInheritedChannel(final Class<?> channelType)
  3. throws IOException {
  4. final Channel inheritedChannel = System.inheritedChannel();
  5. if (inheritedChannel == null) {
  6. throw new IOException("Inherited channel is not set");
  7. }
  8. if (!(channelType.isInstance(inheritedChannel))) {
  9. throw new IOException("Inherited channel is not "
  10. + channelType.getName()
  11. + ", but "
  12. + inheritedChannel.getClass().getName());
  13. }
  14. return (T) inheritedChannel;
  15. }

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

  1. @SuppressWarnings("unchecked")
  2. protected <T> T getSystemInheritedChannel(final Class<?> channelType)
  3. throws IOException {
  4. final Channel inheritedChannel = System.inheritedChannel();
  5. if (inheritedChannel == null) {
  6. throw new IOException("Inherited channel is not set");
  7. }
  8. if (!(channelType.isInstance(inheritedChannel))) {
  9. throw new IOException("Inherited channel is not "
  10. + channelType.getName()
  11. + ", but "
  12. + inheritedChannel.getClass().getName());
  13. }
  14. return (T) inheritedChannel;
  15. }

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

  1. @SuppressWarnings("unchecked")
  2. protected <T> T getSystemInheritedChannel(final Class<?> channelType)
  3. throws IOException {
  4. final Channel inheritedChannel = System.inheritedChannel();
  5. if (inheritedChannel == null) {
  6. throw new IOException("Inherited channel is not set");
  7. }
  8. if (!(channelType.isInstance(inheritedChannel))) {
  9. throw new IOException("Inherited channel is not "
  10. + channelType.getName()
  11. + ", but "
  12. + inheritedChannel.getClass().getName());
  13. }
  14. return (T) inheritedChannel;
  15. }

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

  1. @SuppressWarnings("unchecked")
  2. protected <T> T getSystemInheritedChannel(final Class<?> channelType)
  3. throws IOException {
  4. final Channel inheritedChannel = System.inheritedChannel();
  5. if (inheritedChannel == null) {
  6. throw new IOException("Inherited channel is not set");
  7. }
  8. if (!(channelType.isInstance(inheritedChannel))) {
  9. throw new IOException("Inherited channel is not "
  10. + channelType.getName()
  11. + ", but "
  12. + inheritedChannel.getClass().getName());
  13. }
  14. return (T) inheritedChannel;
  15. }

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

  1. @SuppressWarnings("unchecked")
  2. protected <T> T getSystemInheritedChannel(final Class<?> channelType)
  3. throws IOException {
  4. final Channel inheritedChannel = System.inheritedChannel();
  5. if (inheritedChannel == null) {
  6. throw new IOException("Inherited channel is not set");
  7. }
  8. if (!(channelType.isInstance(inheritedChannel))) {
  9. throw new IOException("Inherited channel is not "
  10. + channelType.getName()
  11. + ", but "
  12. + inheritedChannel.getClass().getName());
  13. }
  14. return (T) inheritedChannel;
  15. }

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

  1. @SuppressWarnings("unchecked")
  2. protected <T> T getSystemInheritedChannel(final Class<?> channelType)
  3. throws IOException {
  4. final Channel inheritedChannel = System.inheritedChannel();
  5. if (inheritedChannel == null) {
  6. throw new IOException("Inherited channel is not set");
  7. }
  8. if (!(channelType.isInstance(inheritedChannel))) {
  9. throw new IOException("Inherited channel is not "
  10. + channelType.getName()
  11. + ", but "
  12. + inheritedChannel.getClass().getName());
  13. }
  14. return (T) inheritedChannel;
  15. }

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

  1. @SuppressWarnings("unchecked")
  2. protected <T> T getSystemInheritedChannel(final Class<?> channelType)
  3. throws IOException {
  4. final Channel inheritedChannel = System.inheritedChannel();
  5. if (inheritedChannel == null) {
  6. throw new IOException("Inherited channel is not set");
  7. }
  8. if (!(channelType.isInstance(inheritedChannel))) {
  9. throw new IOException("Inherited channel is not "
  10. + channelType.getName()
  11. + ", but "
  12. + inheritedChannel.getClass().getName());
  13. }
  14. return (T) inheritedChannel;
  15. }

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

  1. protected void initServerSocket() throws Exception {
  2. if (!getUseInheritedChannel()) {
  3. serverSock = ServerSocketChannel.open();
  4. socketProperties.setProperties(serverSock.socket());
  5. InetSocketAddress addr = (getAddress()!=null?new InetSocketAddress(getAddress(),getPort()):new InetSocketAddress(getPort()));
  6. serverSock.socket().bind(addr,getAcceptCount());
  7. } else {
  8. // Retrieve the channel provided by the OS
  9. Channel ic = System.inheritedChannel();
  10. if (ic instanceof ServerSocketChannel) {
  11. serverSock = (ServerSocketChannel) ic;
  12. }
  13. if (serverSock == null) {
  14. throw new IllegalArgumentException(sm.getString("endpoint.init.bind.inherited"));
  15. }
  16. }
  17. serverSock.configureBlocking(true); //mimic APR behavior
  18. }

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

  1. @Override
  2. public void open() throws IOException
  3. {
  4. synchronized(this)
  5. {
  6. try
  7. {
  8. Channel channel = System.inheritedChannel();
  9. if ( channel instanceof ServerSocketChannel )
  10. _acceptChannel = (ServerSocketChannel)channel;
  11. else
  12. LOG.warn("Unable to use System.inheritedChannel() [" +channel+ "]. Trying a new ServerSocketChannel at " + getHost() + ":" + getPort());
  13. if ( _acceptChannel != null )
  14. _acceptChannel.configureBlocking(true);
  15. }
  16. catch(NoSuchMethodError e)
  17. {
  18. LOG.warn("Need at least Java 5 to use socket inherited from xinetd/inetd.");
  19. }
  20. if (_acceptChannel == null)
  21. super.open();
  22. }
  23. }

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

  1. @Override
  2. public void open() throws IOException
  3. {
  4. synchronized(this)
  5. {
  6. try
  7. {
  8. Channel channel = System.inheritedChannel();
  9. if ( channel instanceof ServerSocketChannel )
  10. _acceptChannel = (ServerSocketChannel)channel;
  11. else
  12. LOG.warn("Unable to use System.inheritedChannel() [" +channel+ "]. Trying a new ServerSocketChannel at " + getHost() + ":" + getPort());
  13. if ( _acceptChannel != null )
  14. _acceptChannel.configureBlocking(true);
  15. }
  16. catch(NoSuchMethodError e)
  17. {
  18. LOG.warn("Need at least Java 5 to use socket inherited from xinetd/inetd.");
  19. }
  20. if (_acceptChannel == null)
  21. super.open();
  22. }
  23. }

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

  1. @Override
  2. public void open() throws IOException
  3. {
  4. synchronized(this)
  5. {
  6. try
  7. {
  8. Channel channel = System.inheritedChannel();
  9. if ( channel instanceof ServerSocketChannel )
  10. _acceptChannel = (ServerSocketChannel)channel;
  11. else
  12. LOG.warn("Unable to use System.inheritedChannel() [" +channel+ "]. Trying a new ServerSocketChannel at " + getHost() + ":" + getPort());
  13. if ( _acceptChannel != null )
  14. _acceptChannel.configureBlocking(true);
  15. }
  16. catch(NoSuchMethodError e)
  17. {
  18. LOG.warn("Need at least Java 5 to use socket inherited from xinetd/inetd.");
  19. }
  20. if (_acceptChannel == null)
  21. super.open();
  22. }
  23. }

相关文章