public interface ConnectionContext
ComponentConnectionContext
is used internally by all high-level
components such as CollaborationAvatarGroup
and by shorthand methods
such as
CollaborationEngine.openTopicConnection(com.vaadin.flow.component.Component, String, UserInfo, com.vaadin.flow.function.SerializableFunction)
that take a component instance as the context. This implementation activates
the topic connection whenever the target component is attached and
deactivates it when the component is detached.
UI.access(com.vaadin.flow.server.Command)
is used for
synchronization.
SystemConnectionContext
is intended for application logic that
integrates with external services that are not directly related to UI
components. This context implementation is immediately active and remains
active until the application is shut down (based on
VaadinService.addServiceDestroyListener(com.vaadin.flow.server.ServiceDestroyListener)
.
Each use site (for instance each individual topic connection) gets its own
synchronization to ensure events are delivered in the expected order, but
still avoiding contention between other use sites.
Modifier and Type | Method and Description |
---|---|
Registration |
init(ActivationHandler activationHandler,
Executor executor)
Initializes the connection context with a
ActivationHandler and
an Executor . |
Registration init(ActivationHandler activationHandler, Executor executor)
ActivationHandler
and
an Executor
.
The method Consumer.accept(Object)
from the provided
ActivationHandler
should be called with an
ActionDispatcher
when this ConnectionContext is activated. When
this ConnectionContext is deactivated, it should call
Consumer.accept(Object)
with a null parameter.
The ActionDispatcher
should ensure synchronization within the
context of this ConnectionContext.
activationHandler
- the handler for activation changesexecutor
- executor that should be used by the handler to execute
background tasks. Not null
null
if there
is nothing to clean upCopyright © 2022. All rights reserved.