Package org.jivesoftware.openfire.spi
Class ConnectionManagerImpl
java.lang.Object
org.jivesoftware.openfire.container.BasicModule
org.jivesoftware.openfire.spi.ConnectionManagerImpl
- All Implemented Interfaces:
ConnectionManager,Module,CertificateEventListener,PropertyEventListener
public class ConnectionManagerImpl
extends BasicModule
implements ConnectionManager, CertificateEventListener, PropertyEventListener
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SystemProperty<Duration>Duration that unused, surplus threads that once processed connection events are kept alive.static final SystemProperty<Integer>Number of threads used to process connection events.Fields inherited from interface org.jivesoftware.openfire.ConnectionManager
DEFAULT_COMPONENT_PORT, DEFAULT_COMPONENT_SSL_PORT, DEFAULT_MULTIPLEX_PORT, DEFAULT_MULTIPLEX_SSL_PORT, DEFAULT_PORT, DEFAULT_SERVER_PORT, DEFAULT_SERVER_SSL_PORT, DEFAULT_SSL_PORT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Destroys the module.voidenable(ConnectionType type, boolean startInDirectTlsMode, boolean enabled) Enables or disables a connection listener.Returns the specific network interface on which the Openfire administration console should be configured to listen, or null when no such preference has been configured.getConnectionAcceptor(ConnectionType type, boolean directTLS) Returns the connection acceptor for a particular connection type and configuration.Returns the specific network interface on which Openfire is configured to listen, or null when no such preference has been configured.getListener(ConnectionType type, boolean startInDirectTlsMode) Returns a connection listener.Returns all connection listeners.getListeners(ConnectionType type) Returns al connection listeners for the provided type.intgetPort(ConnectionType type, boolean startInDirectTlsMode) Retrieves the configured TCP port on which a listener accepts connections.voidinitialize(XMPPServer server) Initializes the basic module.booleanisEnabled(ConnectionType type, boolean startInDirectTlsMode) Return if the configuration allows this listener to be enabled (but does not verify that the listener is indeed active) The #startInSslMode parameter is used to distinguish between listeners that expect to receive TLS encrypted data immediately, as opposed to connections that initially accept plain text data (the latter are typically subject to StartTLS for in-band encryption configuration).voidpropertyDeleted(String property, Map<String, Object> params) A property was deleted.voidpropertySet(String property, Map<String, Object> params) A property was set.Executes the given task asynchronously using the connection event executor.voidsetPort(ConnectionType type, boolean startInDirectTlsMode, int port) Sets the TCP port on which a listener accepts connections.voidstart()Starts the basic module.voidstop()Stops the basic module.voidEvent triggered when the content of a certificate store was changed.<T> CompletableFuture<T>supplyConnectionEventTaskAsync(Supplier<T> task) Executes the given task asynchronously using the connection event executor.voidxmlPropertyDeleted(String property, Map<String, Object> params) An XML property was deleted.voidxmlPropertySet(String property, Map<String, Object> params) An XML property was set.Methods inherited from class org.jivesoftware.openfire.container.BasicModule
getName
-
Field Details
-
EVENTEXECUTOR_POOL_SIZE
Number of threads used to process connection events. -
EVENTEXECUTOR_POOL_KEEP_ALIVE
Duration that unused, surplus threads that once processed connection events are kept alive.
-
-
Constructor Details
-
ConnectionManagerImpl
Instantiates a new connection manager.- Throws:
IOException- if the identity or trust stores could not be loaded
-
-
Method Details
-
getListenAddress
Returns the specific network interface on which Openfire is configured to listen, or null when no such preference has been configured.- Returns:
- A network interface or null.
- Throws:
UnknownHostException- When the configured network name cannot be resolved.
-
getAdminConsoleListenAddress
Returns the specific network interface on which the Openfire administration console should be configured to listen, or null when no such preference has been configured.- Returns:
- A network interface or null.
- Throws:
UnknownHostException- When the configured network name cannot be resolved.
-
getListeners
Returns all connection listeners.- Specified by:
getListenersin interfaceConnectionManager- Returns:
- All connection listeners (never null).
-
getListener
Returns a connection listener. The #startInSslMode parameter is used to distinguish between listeners that expect to receive TLS encrypted data immediately, as opposed to connections that initially accept plain text data (the latter are typically subject to StartTLS for in-band encryption configuration). When for a particular connection type only one of these options is implemented, the parameter value is ignored.- Specified by:
getListenerin interfaceConnectionManager- Parameters:
type- The connection type for which a listener is to be configured.startInDirectTlsMode- true when the listener to be configured is in Direct TLS mode, otherwise false.- Returns:
- The connection listener (never null).
-
getListeners
Returns al connection listeners for the provided type.- Specified by:
getListenersin interfaceConnectionManager- Parameters:
type- The connection type for which a listener is to be configured.- Returns:
- The connection listener (never null).
-
getConnectionAcceptor
Returns the connection acceptor for a particular connection type and configuration.- Parameters:
type- The connection type for which to return the acceptordirectTLS- DirectTLS or StartTLS selector- Returns:
- The connection acceptor for the provided arguments.
-
isEnabled
Return if the configuration allows this listener to be enabled (but does not verify that the listener is indeed active) The #startInSslMode parameter is used to distinguish between listeners that expect to receive TLS encrypted data immediately, as opposed to connections that initially accept plain text data (the latter are typically subject to StartTLS for in-band encryption configuration). When for a particular connection type only one of these options is implemented, the parameter value is ignored.- Specified by:
isEnabledin interfaceConnectionManager- Parameters:
type- The connection type for which a listener is to be configured.startInDirectTlsMode- true when the listener to be configured is in Direct TLS mode, otherwise false.- Returns:
- true if configuration allows this listener to be enabled, otherwise false.
-
enable
Enables or disables a connection listener. Does nothing if the particular listener is already in the requested state. The #startInSslMode parameter is used to distinguish between listeners that expect to receive TLS encrypted data immediately, as opposed to connections that initially accept plain text data (the latter are typically subject to StartTLS for in-band encryption configuration). When for a particular connection type only one of these options is implemented, the parameter value is ignored.- Specified by:
enablein interfaceConnectionManager- Parameters:
type- The connection type for which a listener is to be configured.startInDirectTlsMode- true when the listener to be configured is in Direct TLS mode, otherwise false.enabled- true if the listener is to be enabled, otherwise false.
-
getPort
Retrieves the configured TCP port on which a listener accepts connections.- Specified by:
getPortin interfaceConnectionManager- Parameters:
type- The connection type for which a listener is to be configured.startInDirectTlsMode- true when the listener to be configured is in DirectTLS mode, otherwise false.- Returns:
- a port number.
-
setPort
Sets the TCP port on which a listener accepts connections.- Specified by:
setPortin interfaceConnectionManager- Parameters:
type- The connection type for which a listener is to be configured.startInDirectTlsMode- true when the listener to be configured is in Direct TLS mode, otherwise false.port- a port number.
-
runConnectionEventTaskAsync
Executes the given task asynchronously using the connection event executor. This method is intended for running non-blocking tasks related to connection events, such as session cleanup, route updates, or listener notifications. Any exceptions thrown by the task are logged and propagated as aCompletionExceptionin the returned future. All tasks submitted via this method are executed on the same thread pool used for connection event handling, ensuring consistent resource management and error handling.- Parameters:
task- The task to execute asynchronously- Returns:
- A CompletableFuture that completes when the task finishes, or exceptionally if the task throws an exception
-
supplyConnectionEventTaskAsync
Executes the given task asynchronously using the connection event executor. This method is intended for running non-blocking tasks related to connection events, such as session cleanup, route updates, or listener notifications. Any exceptions thrown by the task are logged and propagated as aCompletionExceptionin the returned future. All tasks submitted via this method are executed on the same thread pool used for connection event handling, ensuring consistent resource management and error handling.- Type Parameters:
T- The type of the value returned by the task- Parameters:
task- The task to execute asynchronously- Returns:
- A CompletableFuture that completes with the task's result, or exceptionally if the task throws an exception
-
storeContentChanged
Description copied from interface:CertificateEventListenerEvent triggered when the content of a certificate store was changed.- Specified by:
storeContentChangedin interfaceCertificateEventListener- Parameters:
store- The store for which the content was changed.
-
propertySet
Description copied from interface:PropertyEventListenerA property was set. The parameter mapparamswill contain the the value of the property under the keyvalue.- Specified by:
propertySetin interfacePropertyEventListener- Parameters:
property- the name of the property.params- event parameters.
-
propertyDeleted
Description copied from interface:PropertyEventListenerA property was deleted.- Specified by:
propertyDeletedin interfacePropertyEventListener- Parameters:
property- the name of the property deleted.params- event parameters.
-
xmlPropertySet
Description copied from interface:PropertyEventListenerAn XML property was set. The parameter mapparamswill contain the the value of the property under the keyvalue.- Specified by:
xmlPropertySetin interfacePropertyEventListener- Parameters:
property- the name of the property.params- event parameters.
-
xmlPropertyDeleted
Description copied from interface:PropertyEventListenerAn XML property was deleted.- Specified by:
xmlPropertyDeletedin interfacePropertyEventListener- Parameters:
property- the name of the property.params- event parameters.
-
initialize
Description copied from class:BasicModuleInitializes the basic module.
Inheriting classes that choose to override this method MUST call this initialize() method before accessing BasicModule resources.
- Specified by:
initializein interfaceModule- Overrides:
initializein classBasicModule- Parameters:
server- the server hosting this module.
-
start
public void start()Description copied from class:BasicModuleStarts the basic module.
Inheriting classes that choose to override this method MUST call this start() method before accessing BasicModule resources.
- Specified by:
startin interfaceModule- Overrides:
startin classBasicModule
-
stop
public void stop()Description copied from class:BasicModuleStops the basic module.
Inheriting classes that choose to override this method MUST call this stop() method before accessing BasicModule resources.
- Specified by:
stopin interfaceModule- Overrides:
stopin classBasicModule
-
destroy
public void destroy()Description copied from class:BasicModuleDestroys the module.
Does nothing in the basic module.
- Specified by:
destroyin interfaceModule- Overrides:
destroyin classBasicModule
-