Class ContinuationManager

java.lang.Object
rife.continuations.ContinuationManager

public class ContinuationManager extends Object
Manages a collection of ContinuationContext instances.

A ContinuationManager instance is typically associated with a specific context, like for example a Site for RIFE2's web engine. It's up to you to provide an API to your users if you want them to be able to interact with the appropriate continuations manager.

Since:
1.0
See Also:
  • Constructor Details

    • ContinuationManager

      public ContinuationManager(ContinuationConfigRuntime config)
      Instantiates a new continuation manager and uses the default values for the continuations duration and purging.
      Parameters:
      config - the runtime configuration that will be used be this manager
      Since:
      1.0
  • Method Details

    • getConfigRuntime

      public ContinuationConfigRuntime getConfigRuntime()
      Retrieves the runtime configuration that was provided to the manager at instantiation.
      Returns:
      this manager's runtime configuration
      Since:
      1.0
    • isExpired

      public boolean isExpired(ContinuationContext context)
      Checks if a particular continuation context is expired.
      Parameters:
      context - the context that needs to be verified
      Returns:
      true if the continuation context is expired; and

      false otherwise

      Since:
      1.0
    • addContext

      public void addContext(ContinuationContext context)
      Adds a particular ContinuationContext to this manager.
      Parameters:
      context - the context that will be added
      Since:
      1.0
    • removeContext

      public void removeContext(String id)
      Removes a ContinuationContext instance from this continuation manager.
      Parameters:
      id - the unique string that identifies the ContinuationContext instance that will be removed
      Since:
      1.0
      See Also:
    • resumeContext

      public ContinuationContext resumeContext(String id) throws CloneNotSupportedException
      Creates a new ContinuationContext from an existing one so that the execution can be resumed.

      If the existing continuation context couldn't be found, no new one is created. However, if it could be found, the result of ContinuationConfigRuntime.cloneContinuations(java.lang.Object) will determine whether the existing continuation context will be cloned to create the new one, or if its state will be reused.

      The new continuation context will have its own unique ID.

      Parameters:
      id - the ID of the existing continuation context
      Returns:
      the new ContinuationContext; or

      null if the existing continuation context couldn't be found

      Throws:
      CloneNotSupportedException - when the continuable couldn't be cloned
      Since:
      1.0
    • getContext

      public ContinuationContext getContext(String id)
      Retrieves a ContinuationContext instance from this continuation manager.
      Parameters:
      id - the unique string that identifies the ContinuationContext instance that has to be retrieved
      Returns:
      the ContinuationContext instance that corresponds to the provided identifier; or

      null if the identifier isn't known by the continuation manager.

      Since:
      1.0
      See Also: