Package org.newsclub.net.unix.jetty
Class AFSocketServerConnector
java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
org.eclipse.jetty.server.AbstractConnector
org.newsclub.net.unix.jetty.AFSocketServerConnector
- All Implemented Interfaces:
org.eclipse.jetty.server.Connector,org.eclipse.jetty.util.component.Container,org.eclipse.jetty.util.component.Destroyable,org.eclipse.jetty.util.component.Dumpable,org.eclipse.jetty.util.component.Dumpable.DumpableContainer,org.eclipse.jetty.util.component.Graceful,org.eclipse.jetty.util.component.LifeCycle
@ManagedObject
public class AFSocketServerConnector
extends org.eclipse.jetty.server.AbstractConnector
A
Connector implementation for junixsocket server socket channels (Unix domains etc.)
Based upon jetty's UnixDomainServerConnector.
This implementation should work with jetty version 9.4.12 or newer.-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener, org.eclipse.jetty.util.component.AbstractLifeCycle.StopExceptionNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
org.eclipse.jetty.util.component.Container.InheritedListener, org.eclipse.jetty.util.component.Container.ListenerNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
org.eclipse.jetty.util.component.Dumpable.DumpableContainerNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Graceful
org.eclipse.jetty.util.component.Graceful.Shutdown, org.eclipse.jetty.util.component.Graceful.ThrowingRunnableNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
org.eclipse.jetty.util.component.LifeCycle.Listener -
Field Summary
Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
FAILED, STARTED, STARTING, STOPPED, STOPPINGFields inherited from interface org.eclipse.jetty.util.component.Dumpable
KEY -
Constructor Summary
ConstructorsConstructorDescriptionAFSocketServerConnector(org.eclipse.jetty.server.Server server, int acceptors, int selectors, org.eclipse.jetty.server.ConnectionFactory... factories) Creates a newAFSocketServerConnector.AFSocketServerConnector(org.eclipse.jetty.server.Server server, Executor executor, org.eclipse.jetty.util.thread.Scheduler scheduler, org.eclipse.jetty.io.ByteBufferPool pool, int acceptors, int selectors, org.eclipse.jetty.server.ConnectionFactory... factories) Creates a newAFSocketServerConnector.AFSocketServerConnector(org.eclipse.jetty.server.Server server, org.eclipse.jetty.server.ConnectionFactory... factories) Creates a newAFSocketServerConnector. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaccept(int acceptorID) protected voidconfigure(SocketChannel channel) Configures an incomingSocketChannel, setting socket options such as receive and send buffer sizes.protected voiddoStart()protected voiddoStop()intReturns the SO_RCVBUF size for accepted sockets.intReturns the SO_SNDBUF size for accepted sockets.intReturns the accept queue size (backlog) for the server socket.org.newsclub.net.unix.AFSocketAddressReturns the socket address this connector listens to.Deprecated.booleanChecks whether this connector uses a server channel inherited from the JVM.booleanChecks if this connector may stop the server when it's no longer able to serve and no other connectors are available.booleanChecks if this connector may stop the server when it's no longer able to serve, even if other connectors are available.voidsetAcceptedReceiveBufferSize(int acceptedReceiveBufferSize) Sets the SO_RCVBUF size for accepted sockets.voidsetAcceptedSendBufferSize(int acceptedSendBufferSize) Sets the SO_SNDBUF size for accepted sockets.voidsetAccepting(boolean accepting) voidsetAcceptQueueSize(int acceptQueueSize) Sets the accept queue size (backlog) for the server socket.voidsetInheritChannel(boolean inheritChannel) Sets whether this connector uses a server channel inherited from the JVM.voidsetListenSocketAddress(org.newsclub.net.unix.AFSocketAddress addr) Sets the socket address this connector listens to.voidsetMayStopServer(boolean mayStopServer) Sets if this connector may stop the server when it's no longer able to serve and no other connectors are available.voidsetMayStopServerForce(boolean b) Sets if this connector may stop the server when it's no longer able to serve and no other connectors are available.voidsetUnixDomainPath(Path unixDomainPath) Deprecated.UsesetListenSocketAddress(AFSocketAddress)instead.toString()Methods inherited from class org.eclipse.jetty.server.AbstractConnector
addConnectionFactory, addFirstConnectionFactory, addIfAbsentConnectionFactory, clearConnectionFactories, getAcceptorPriorityDelta, getAcceptors, getByteBufferPool, getConnectedEndPoints, getConnectionFactories, getConnectionFactory, getConnectionFactory, getDefaultConnectionFactory, getDefaultProtocol, getExecutor, getIdleTimeout, getName, getProtocols, getScheduler, getServer, getShutdownIdleTimeout, handleAcceptFailure, interruptAcceptors, isAccepting, isShutdown, join, join, onEndPointClosed, onEndPointOpened, removeConnectionFactory, setAcceptorPriorityDelta, setConnectionFactories, setDefaultProtocol, setIdleTimeout, setName, setShutdownIdleTimeout, shutdownMethods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dumpObjects, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, installBean, installBean, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, start, stop, unmanage, updateBean, updateBean, updateBeans, updateBeansMethods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.jetty.util.component.Container
addBean, addBean, addEventListener, getBean, getBeans, getBeans, getCachedBeans, getContainedBeans, getEventListeners, isManaged, manage, removeBean, removeEventListener, unmanageMethods inherited from interface org.eclipse.jetty.util.component.Dumpable
dump, dump, dumpSelfMethods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer
isDumpableMethods inherited from interface org.eclipse.jetty.util.component.LifeCycle
addEventListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeEventListener, start, stop
-
Constructor Details
-
AFSocketServerConnector
public AFSocketServerConnector(org.eclipse.jetty.server.Server server, org.eclipse.jetty.server.ConnectionFactory... factories) Creates a newAFSocketServerConnector.- Parameters:
server- The server this connector will be added to. Must not be null.factories- The Connection Factories to use.
-
AFSocketServerConnector
public AFSocketServerConnector(org.eclipse.jetty.server.Server server, int acceptors, int selectors, org.eclipse.jetty.server.ConnectionFactory... factories) Creates a newAFSocketServerConnector.- Parameters:
server- The server this connector will be added to. Must not be null.acceptors- the number of acceptor threads to use, or -1 for a default value. If 0, then no acceptor threads will be launched and some other mechanism will need to be used to accept new connections.selectors- The number of selectors to use, or -1 for a default derivedfactories- The Connection Factories to use.
-
AFSocketServerConnector
public AFSocketServerConnector(org.eclipse.jetty.server.Server server, Executor executor, org.eclipse.jetty.util.thread.Scheduler scheduler, org.eclipse.jetty.io.ByteBufferPool pool, int acceptors, int selectors, org.eclipse.jetty.server.ConnectionFactory... factories) Creates a newAFSocketServerConnector.- Parameters:
server- The server this connector will be added to. Must not be null.executor- An executor for this connector or null to use the servers executorscheduler- A scheduler for this connector or null to either aSchedulerset as a server bean or if none set, then a newScheduledExecutorSchedulerinstance.pool- A buffer pool for this connector or null to either aByteBufferPoolset as a server bean or none set, the new {code ArrayByteBufferPool} instance.acceptors- the number of acceptor threads to use, or -1 for a default value. If 0, then no acceptor threads will be launched and some other mechanism will need to be used to accept new connections.selectors- The number of selectors to use, or -1 for a default derivedfactories- The Connection Factories to use.
-
-
Method Details
-
getUnixDomainPath
@ManagedAttribute("The Unix-Domain path this connector listens to") @Deprecated public Path getUnixDomainPath()Deprecated.UsegetListenSocketAddress()instead.Returns the Unix-Domain path this connector listens to. Added for compatibility with jetty'sUnixDomainServerConnector.- Returns:
- The Unix-Domain path this connector listens to.
- See Also:
-
setUnixDomainPath
Deprecated.UsesetListenSocketAddress(AFSocketAddress)instead.Sets the Unix-Domain path this connector listens to. Added for compatibility with jetty'sUnixDomainServerConnector.- Parameters:
unixDomainPath- The path.- See Also:
-
getListenSocketAddress
@ManagedAttribute("The socket address this connector listens to") public org.newsclub.net.unix.AFSocketAddress getListenSocketAddress()Returns the socket address this connector listens to.- Returns:
- The socket address, or
nullif none set.
-
setListenSocketAddress
public void setListenSocketAddress(org.newsclub.net.unix.AFSocketAddress addr) Sets the socket address this connector listens to.- Parameters:
addr- The socket address, ornull.
-
isInheritChannel
@ManagedAttribute("Whether this connector uses a server channel inherited from the JVM") public boolean isInheritChannel()Checks whether this connector uses a server channel inherited from the JVM.- Returns:
trueif so.
-
setInheritChannel
public void setInheritChannel(boolean inheritChannel) Sets whether this connector uses a server channel inherited from the JVM.- Parameters:
inheritChannel-trueif so.
-
getAcceptQueueSize
@ManagedAttribute("The accept queue size (backlog) for the server socket") public int getAcceptQueueSize()Returns the accept queue size (backlog) for the server socket.- Returns:
- The backlog.
-
setAcceptQueueSize
public void setAcceptQueueSize(int acceptQueueSize) Sets the accept queue size (backlog) for the server socket.- Parameters:
acceptQueueSize- The backlog.
-
getAcceptedReceiveBufferSize
@ManagedAttribute("The SO_RCVBUF option for accepted sockets") public int getAcceptedReceiveBufferSize()Returns the SO_RCVBUF size for accepted sockets.- Returns:
- The buffer size.
-
setAcceptedReceiveBufferSize
public void setAcceptedReceiveBufferSize(int acceptedReceiveBufferSize) Sets the SO_RCVBUF size for accepted sockets.- Parameters:
acceptedReceiveBufferSize- The buffer size.
-
getAcceptedSendBufferSize
@ManagedAttribute("The SO_SNDBUF option for accepted sockets") public int getAcceptedSendBufferSize()Returns the SO_SNDBUF size for accepted sockets.- Returns:
- The buffer size.
-
setAcceptedSendBufferSize
public void setAcceptedSendBufferSize(int acceptedSendBufferSize) Sets the SO_SNDBUF size for accepted sockets.- Parameters:
acceptedSendBufferSize- The buffer size.
-
doStart
-
doStop
-
accept
- Specified by:
acceptin classorg.eclipse.jetty.server.AbstractConnector- Throws:
IOException
-
configure
Configures an incomingSocketChannel, setting socket options such as receive and send buffer sizes.- Parameters:
channel- The socket channel to configure.- Throws:
IOException- on error.
-
getTransport
-
setAccepting
public void setAccepting(boolean accepting) - Overrides:
setAcceptingin classorg.eclipse.jetty.server.AbstractConnector
-
toString
- Overrides:
toStringin classorg.eclipse.jetty.server.AbstractConnector
-
isMayStopServer
@ManagedAttribute("Whether this connector may stop the server when it\'s no longer able to serve and no other connectors are available") public boolean isMayStopServer()Checks if this connector may stop the server when it's no longer able to serve and no other connectors are available.- Returns:
trueif so.
-
setMayStopServer
public void setMayStopServer(boolean mayStopServer) Sets if this connector may stop the server when it's no longer able to serve and no other connectors are available.- Parameters:
mayStopServer-trueif so.
-
isMayStopServerForce
@ManagedAttribute("Whether this connector may stop the server when it\'s no longer able to serve, even if other connectors are available") public boolean isMayStopServerForce()Checks if this connector may stop the server when it's no longer able to serve, even if other connectors are available.- Returns:
trueif so.
-
setMayStopServerForce
public void setMayStopServerForce(boolean b) Sets if this connector may stop the server when it's no longer able to serve and no other connectors are available.- Parameters:
b-trueif so (which then also impliessetMayStopServer(true)
-
getListenSocketAddress()instead.