Package org.opencms.ugc
Class CmsUgcSessionQueue
java.lang.Object
org.opencms.ugc.CmsUgcSessionQueue
A queue used to enforce a certain wait time between requests for sessions for the same form configuration.
-
Constructor Summary
ConstructorDescriptionCmsUgcSessionQueue
(boolean enabled, long interval, int maxLength) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic CmsUgcSessionQueue
createQueue
(CmsUgcConfiguration config) Creates a session queue based on the given configuration.void
Updates the queue parameters from the configuration object.boolean
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 Details
-
CmsUgcSessionQueue
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 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
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
-