Package org.opencms.ugc
Class CmsUgcSessionQueue
- java.lang.Object
-
- org.opencms.ugc.CmsUgcSessionQueue
-
public class CmsUgcSessionQueue extends java.lang.Object
A queue used to enforce a certain wait time between requests for sessions for the same form configuration.
-
-
Constructor Summary
Constructors Constructor Description CmsUgcSessionQueue(boolean enabled, long interval, int maxLength)
Creates a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CmsUgcSessionQueue
createQueue(CmsUgcConfiguration config)
Creates a session queue based on the given configuration.void
updateFromConfiguration(CmsUgcConfiguration config)
Updates the queue parameters from the configuration object.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.
-
-
-
Constructor Detail
-
CmsUgcSessionQueue
public CmsUgcSessionQueue(boolean enabled, long interval, int maxLength)
Creates a new instance.- Parameters:
enabled
- true if the queue should be enabledinterval
- the wait time to use between multiple session requestsmaxLength
- the maximum length of the queue
-
-
Method Detail
-
createQueue
public static CmsUgcSessionQueue createQueue(CmsUgcConfiguration config)
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
public void updateFromConfiguration(CmsUgcConfiguration config)
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
-
-