Interface SessionMap


  • public interface SessionMap
    A registry of tracked views, supporting cluster-wide state synchronization.
    Since:
    8.6.0
    • Method Detail

      • getInstance

        static SessionMap getInstance()
        Returns the singleton instance of this service.
        Returns:
        The singleton instance of this service.
        Since:
        8.6.0
      • register

        void register​(@NotNull
                      @NotNull TrackingId trackingId,
                      @NotNull
                      @NotNull ResourceKey resourceKey,
                      @NotNull
                      @NotNull UserInfo entry)
        Registers or refreshes one browser instance's presence for a resource.
        Parameters:
        trackingId - Identifies this specific browser instance (tab/iframe).
        resourceKey - The resource being edited, e.g. form_record:42.
        entry - The registration to store for this instance.
        Since:
        8.6.0
      • unregister

        UserInfo unregister​(@NotNull
                            @NotNull TrackingId trackingId)
        Removes the registration identified by its unique tracking ID, regardless of its resource.
        Parameters:
        trackingId - the browser instance whose registration is removed
        Returns:
        the removed user, or null if no registration exists
        Since:
        8.6.0
      • unregister

        UserInfo unregister​(@NotNull
                            @NotNull TrackingId trackingId,
                            @NotNull
                            @NotNull ResourceKey resourceKey)
        Removes the registration identified by its unique tracking ID and resource key. If the resource key does not match the registration, no action is taken.
        Parameters:
        trackingId - the browser instance whose registration is removed
        resourceKey - the resource being edited
        Returns:
        the removed user, or null if no registration exists
        Since:
        8.6.0
      • heartbeat

        boolean heartbeat​(@NotNull
                          @NotNull TrackingId trackingId)
        Refreshes the registration identified by its unique tracking ID, regardless of its resource. This method returns false if the registration does not exist. A stale registration can still be refreshed until it has been removed by the expiration sweep.
        Parameters:
        trackingId - the browser instance sending the heartbeat
        Returns:
        true if the heartbeat was successful, false otherwise.
        Since:
        8.6.0
      • getSnapshot

        Set<PresenceEntry> getSnapshot()
        Returns a detached snapshot of all registrations for cluster-wide state synchronization.
        Returns:
        a set containing one entry per tracked view
        Since:
        8.6.0
      • syncFromRemote

        void syncFromRemote()
        Replaces the local registrations with a snapshot from the master on a frontend server. Local changes made while the snapshot is being fetched may be overwritten. Does nothing on a master server.
        Since:
        8.6.0