Package org.eclipse.jetty.unixsocket
Class UnixSocketConnector
- java.lang.Object
-
- org.eclipse.jetty.util.component.AbstractLifeCycle
-
- org.eclipse.jetty.util.component.ContainerLifeCycle
-
- org.eclipse.jetty.server.AbstractConnector
-
- org.eclipse.jetty.unixsocket.UnixSocketConnector
-
- All Implemented Interfaces:
Connector
,Container
,Destroyable
,Dumpable
,Dumpable.DumpableContainer
,Graceful
,LifeCycle
@ManagedObject("Connector using UNIX Socket") public class UnixSocketConnector extends AbstractConnector
A server-side connector for UNIX sockets.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
UnixSocketConnector.UnixSocketConnectorManager
-
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
Container.InheritedListener, Container.Listener
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainer
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Graceful
Graceful.Shutdown
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
-
-
Field Summary
Fields Modifier and Type Field Description static int
MAX_UNIX_SOCKET_PATH_LENGTH
-
Constructor Summary
Constructors Constructor Description UnixSocketConnector(Server server)
Constructs a UnixSocketConnector with the default configuration.UnixSocketConnector(Server server, int selectors)
Constructs a UnixSocketConnector with the given number of selectorsUnixSocketConnector(Server server, int selectors, ConnectionFactory... factories)
Constructs a UnixSocketConnector with the given selectors and ConnectionFactories.UnixSocketConnector(Server server, int selectors, SslContextFactory sslContextFactory)
Constructs a UnixSocketConnector with the given selectors and SslContextFactory.UnixSocketConnector(Server server, java.util.concurrent.Executor executor, Scheduler scheduler, ByteBufferPool bufferPool, int selectors, ConnectionFactory... factories)
Constructs a UnixSocketConnector with the given parameters.UnixSocketConnector(Server server, ConnectionFactory... factories)
Constructs a UnixSocketConnector with the given ConnectionFactories.UnixSocketConnector(Server server, SslContextFactory sslContextFactory)
Constructs a UnixSocketConnector with the given SslContextFactory.UnixSocketConnector(Server server, SslContextFactory sslContextFactory, ConnectionFactory... factories)
Constructs a UnixSocketConnector with the given SslContextFactory and ConnectionFactories.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(int acceptorID)
protected void
accepted(jnr.unixsocket.UnixSocketChannel channel)
void
close()
protected void
doStart()
Starts the managed lifecycle beans in the order they were added.protected void
doStop()
Stops the managed lifecycle beans in the reverse order they were added.int
getAcceptQueueSize()
boolean
getReuseAddress()
SelectorManager
getSelectorManager()
java.lang.Object
getTransport()
java.lang.String
getUnixSocket()
boolean
isOpen()
protected UnixSocketEndPoint
newEndPoint(java.nio.channels.SelectableChannel channel, ManagedSelector selector, java.nio.channels.SelectionKey key)
protected SelectorManager
newSelectorManager(java.util.concurrent.Executor executor, Scheduler scheduler, int selectors)
void
open()
void
setAcceptQueueSize(int acceptQueueSize)
void
setReuseAddress(boolean reuseAddress)
void
setUnixSocket(java.lang.String filename)
java.lang.String
toString()
-
Methods inherited from class org.eclipse.jetty.server.AbstractConnector
addConnectionFactory, addFirstConnectionFactory, addIfAbsentConnectionFactory, clearConnectionFactories, getAcceptorPriorityDelta, getAcceptors, getByteBufferPool, getConnectedEndPoints, getConnectionFactories, getConnectionFactory, getConnectionFactory, getDefaultConnectionFactory, getDefaultProtocol, getExecutor, getHttpChannelListeners, getIdleTimeout, getName, getProtocols, getScheduler, getServer, handleAcceptFailure, interruptAcceptors, isAccepting, isShutdown, join, join, onEndPointClosed, onEndPointOpened, removeConnectionFactory, setAccepting, setAcceptorPriorityDelta, setConnectionFactories, setDefaultProtocol, setIdleTimeout, setName, shutdown
-
Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dump, dump, dumpBeans, dumpObject, dumpObjects, dumpStdErr, dumpThis, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeans
-
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.jetty.util.component.Container
addBean, addBean, addEventListener, getBean, getBeans, getBeans, getContainedBeans, isManaged, manage, removeBean, removeEventListener, unmanage
-
Methods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer
isDumpable
-
Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
-
-
-
-
Field Detail
-
MAX_UNIX_SOCKET_PATH_LENGTH
public static final int MAX_UNIX_SOCKET_PATH_LENGTH
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
UnixSocketConnector
public UnixSocketConnector(@Name("server") Server server)
Constructs a UnixSocketConnector with the default configuration.
- Parameters:
server
- theServer
this connector will accept connections for.
-
UnixSocketConnector
public UnixSocketConnector(@Name("server") Server server, @Name("selectors") int selectors)
Constructs a UnixSocketConnector with the given number of selectors
- Parameters:
server
- theServer
this connector will accept connections for.selectors
- the number of selectors, or <=0 for a default value.
-
UnixSocketConnector
public UnixSocketConnector(@Name("server") Server server, @Name("factories") ConnectionFactory... factories)
Constructs a UnixSocketConnector with the given ConnectionFactories.
- Parameters:
server
- theServer
this connector will accept connections for.factories
- zero or moreConnectionFactory
instances used to create and configure connections.
-
UnixSocketConnector
public UnixSocketConnector(@Name("server") Server server, @Name("selectors") int selectors, @Name("factories") ConnectionFactory... factories)
Constructs a UnixSocketConnector with the given selectors and ConnectionFactories.
- Parameters:
server
- theServer
this connector will accept connections for.selectors
- the number of selectors, or <=0 for a default value.factories
- zero or moreConnectionFactory
instances used to create and configure connections.
-
UnixSocketConnector
public UnixSocketConnector(@Name("server") Server server, @Name("sslContextFactory") SslContextFactory sslContextFactory)
Constructs a UnixSocketConnector with the given SslContextFactory.
- Parameters:
server
- theServer
this connector will accept connections for.sslContextFactory
- when non null aSslConnectionFactory
prepended to the other ConnectionFactories
-
UnixSocketConnector
public UnixSocketConnector(@Name("server") Server server, @Name("selectors") int selectors, @Name("sslContextFactory") SslContextFactory sslContextFactory)
Constructs a UnixSocketConnector with the given selectors and SslContextFactory.
.- Parameters:
server
- theServer
this connector will accept connections for.sslContextFactory
- when non null aSslConnectionFactory
prepended to the other ConnectionFactoriesselectors
- the number of selectors, or <=0 for a default value.
-
UnixSocketConnector
public UnixSocketConnector(@Name("server") Server server, @Name("sslContextFactory") SslContextFactory sslContextFactory, @Name("factories") ConnectionFactory... factories)
Constructs a UnixSocketConnector with the given SslContextFactory and ConnectionFactories.
.- Parameters:
server
- theServer
this connector will accept connections for.sslContextFactory
- when non null aSslConnectionFactory
prepended to the other ConnectionFactoriesfactories
- zero or moreConnectionFactory
instances used to create and configure connections.
-
UnixSocketConnector
public UnixSocketConnector(@Name("server") Server server, @Name("executor") java.util.concurrent.Executor executor, @Name("scheduler") Scheduler scheduler, @Name("bufferPool") ByteBufferPool bufferPool, @Name("selectors") int selectors, @Name("factories") ConnectionFactory... factories)
Constructs a UnixSocketConnector with the given parameters.
.- Parameters:
server
- theServer
this connector will accept connections for.executor
- the executor that runs tasks for handling requests, acceptors and selectors.scheduler
- the scheduler used to schedule timed tasks.bufferPool
- the ByteBufferPool used to allocate buffers.selectors
- the number of selectors, or <=0 for a default value.factories
- zero or moreConnectionFactory
instances used to create and configure connections.
-
-
Method Detail
-
getUnixSocket
@ManagedAttribute("The UNIX socket file name") public java.lang.String getUnixSocket()
-
setUnixSocket
public void setUnixSocket(java.lang.String filename)
-
newSelectorManager
protected SelectorManager newSelectorManager(java.util.concurrent.Executor executor, Scheduler scheduler, int selectors)
-
doStart
protected void doStart() throws java.lang.Exception
Description copied from class:ContainerLifeCycle
Starts the managed lifecycle beans in the order they were added.- Overrides:
doStart
in classAbstractConnector
- Throws:
java.lang.Exception
-
doStop
protected void doStop() throws java.lang.Exception
Description copied from class:ContainerLifeCycle
Stops the managed lifecycle beans in the reverse order they were added.- Overrides:
doStop
in classAbstractConnector
- Throws:
java.lang.Exception
-
isOpen
public boolean isOpen()
-
open
public void open() throws java.io.IOException
- Throws:
java.io.IOException
-
close
public void close()
-
accept
public void accept(int acceptorID) throws java.io.IOException
- Specified by:
accept
in classAbstractConnector
- Throws:
java.io.IOException
-
accepted
protected void accepted(jnr.unixsocket.UnixSocketChannel channel) throws java.io.IOException
- Throws:
java.io.IOException
-
getSelectorManager
public SelectorManager getSelectorManager()
-
getTransport
public java.lang.Object getTransport()
- Returns:
- the underlying socket, channel, buffer etc. for the connector.
-
newEndPoint
protected UnixSocketEndPoint newEndPoint(java.nio.channels.SelectableChannel channel, ManagedSelector selector, java.nio.channels.SelectionKey key)
-
getAcceptQueueSize
@ManagedAttribute("Accept Queue size") public int getAcceptQueueSize()
- Returns:
- the accept queue size
-
setAcceptQueueSize
public void setAcceptQueueSize(int acceptQueueSize)
- Parameters:
acceptQueueSize
- the accept queue size (also known as accept backlog)
-
getReuseAddress
@ManagedAttribute("Whether the server socket reuses addresses") public boolean getReuseAddress()
- Returns:
- whether the server socket reuses addresses
- See Also:
ServerSocket.getReuseAddress()
-
setReuseAddress
public void setReuseAddress(boolean reuseAddress)
- Parameters:
reuseAddress
- whether the server socket reuses addresses- See Also:
ServerSocket.setReuseAddress(boolean)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classAbstractConnector
-
-