1 package org.mortbay.jetty.nio;
2
3 import java.io.IOException;
4 import java.nio.channels.Channel;
5 import java.nio.channels.ServerSocketChannel;
6
7 import org.mortbay.log.Log;
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 public class InheritedChannelConnector extends SelectChannelConnector
26 {
27
28 public void open() throws IOException
29 {
30 synchronized(this)
31 {
32 try
33 {
34 Channel channel = System.inheritedChannel();
35 if ( channel instanceof ServerSocketChannel )
36 _acceptChannel = (ServerSocketChannel)channel;
37 else
38 Log.warn("Unable to use System.inheritedChannel() [" +channel+ "]. Trying a new ServerSocketChannel at " + getHost() + ":" + getPort());
39
40 if ( _acceptChannel != null )
41 _acceptChannel.configureBlocking(false);
42 }
43 catch(NoSuchMethodError e)
44 {
45 Log.warn("Need at least Java 5 to use socket inherited from xinetd/inetd.");
46 }
47
48 if (_acceptChannel == null)
49 super.open();
50 }
51 }
52
53 }