Class SessionLockReleasedEvent

All Implemented Interfaces:
Serializable

public class SessionLockReleasedEvent extends AbstractSessionLockEvent
Event fired through the service event bus when a Vaadin session lock has been released, for the outermost release only. It is fired in reverse registration order so that listeners nest: a listener added first is notified of the release last.

Listeners run on the thread that released the lock, after the release, so they do not hold the session lock and UI.getCurrent() returns null. A listener that needs a UI keeps its own reference to it.

Any session access a listener makes takes the lock again and fires the lock events again when it is released: on this thread if the lock is free, otherwise on the thread that holds it. This includes UI.access(Command), VaadinSession.access(Command) and changing a signal that a UI's effect depends on, since the effect then runs through UI.access(Command). A listener that accesses the session on every release therefore never stops: it must recognize the release caused by its own access and skip it.

Since:
25.3
See Also:
  • Constructor Details

    • SessionLockReleasedEvent

      public SessionLockReleasedEvent(VaadinService service)
      Creates a new event without a session and with a zero hold time.
      Parameters:
      service - the Vaadin service whose session lock is released, not null
    • SessionLockReleasedEvent

      public SessionLockReleasedEvent(VaadinService service, VaadinSession session, Duration holdTime)
      Creates a new event for the given session and hold time.
      Parameters:
      service - the Vaadin service whose session lock is released, not null
      session - the Vaadin session the lock belongs to, or null if it is not known
      holdTime - how long the thread held the lock, not null
      Since:
      25.4
  • Method Details

    • getHoldTime

      public Duration getHoldTime()
      Gets how long the thread held the lock, from the moment it acquired the lock until it released it. The time spent in listeners of SessionLockAcquiredEvent is included, since the lock is held while they run.
      Returns:
      the hold time, not null
      Since:
      25.4