Class CmsUgcSessionQueue

java.lang.Object
org.opencms.ugc.CmsUgcSessionQueue

public class CmsUgcSessionQueue extends Object
A queue used to enforce a certain wait time between requests for sessions for the same form configuration.

  • Constructor Details

    • CmsUgcSessionQueue

      public CmsUgcSessionQueue(boolean enabled, long interval, int maxLength)
      Creates a new instance.

      Parameters:
      enabled - true if the queue should be enabled
      interval - the wait time to use between multiple session requests
      maxLength - the maximum length of the queue
  • Method Details

    • createQueue

      Creates a session queue based on the given configuration.

      Parameters:
      config - the configuration for which to create the session queue
      Returns:
      the newly created session queue
    • updateFromConfiguration

      Updates the queue parameters from the configuration object.

      Parameters:
      config - the form configuration
    • waitForSlot

      public boolean waitForSlot()
      If there are currently any threads waiting on this queue, wait for the interval given on construction after the currenly last thread stops waiting.

      Returns:
      false if the queue was too long to wait, true otherwise