Package com.vaadin.collaborationengine
Class SystemConnectionContext
java.lang.Object
com.vaadin.collaborationengine.SystemConnectionContext
- All Implemented Interfaces:
ConnectionContext,Serializable
A connection context that is always active. This context is intended to be
used in cases when Collaboration Engine is used in situations that aren't
directly associated with a UI, such as from a background thread or when
integrating with external services.
An instance can be acquired using getInstance() in any situation
where CollaborationEngine.getInstance() is available. Other
situations can use CollaborationEngine.getSystemContext() or create a
new context instance using the constructor.
- Author:
- Vaadin Ltd
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated, for removal: This API element is subject to removal in a future version.This constructor is not compatible with serializationCreates a new system connection context instance for the given Collaboration Engine instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic SystemConnectionContextGets the system connection context associated with the current Collaboration Engine instance.init(ActivationHandler activationHandler, Executor executor) Initializes the connection context with aActivationHandlerand anExecutor.
-
Constructor Details
-
SystemConnectionContext
Deprecated, for removal: This API element is subject to removal in a future version.This constructor is not compatible with serializationCreates a new system connection context instance for the given Collaboration Engine instance. It is typically recommended reusing an existing instance throughgetInstance()orCollaborationEngine.getSystemContext()rather than creating new instances.- Parameters:
ce- the collaboration engine instance to use, notnull
-
SystemConnectionContext
Creates a new system connection context instance for the given Collaboration Engine instance. It is typically recommended reusing an existing instance throughgetInstance()orCollaborationEngine.getSystemContext()rather than creating new instances.- Parameters:
ceSupplier- the collaboration engine instance to use, notnull
-
-
Method Details
-
getInstance
Gets the system connection context associated with the current Collaboration Engine instance. This method can be used only whenCollaborationEngine.getInstance()is available.- Returns:
- a system connection context instance, not
null - Throws:
IllegalStateException- in case no current collaboration engine instance is available
-
init
Description copied from interface:ConnectionContextInitializes the connection context with aActivationHandlerand anExecutor.The method
Consumer.accept(Object)from the providedActivationHandlershould be called with anActionDispatcherwhen this ConnectionContext is activated. When this ConnectionContext is deactivated, it should callConsumer.accept(Object)with a null parameter.The
ActionDispatchershould ensure synchronization within the context of this ConnectionContext.- Specified by:
initin interfaceConnectionContext- Parameters:
activationHandler- the handler for activation changesexecutor- executor that should be used by the handler to execute background tasks. Notnull- Returns:
- the registration for any logic that needs to be cleaned up if the
connection is closed permanently, or
nullif there is nothing to clean up
-