public class SessionOrderLockManager extends Object implements OrderLockManager, org.springframework.context.ApplicationListener<org.springframework.security.web.session.HttpSessionDestroyedEvent>
HttpSession based OrderLockManager. This implementation is less concerned with the given Order
and instead will lock on the user's session to serialize order modification requests.| Constructor and Description |
|---|
SessionOrderLockManager() |
| Modifier and Type | Method and Description |
|---|---|
Object |
acquireLock(Order order)
Note that although this method accepts an
Order parameter, it does not use it in any way. |
Object |
acquireLockIfAvailable(Order order) |
protected javax.servlet.http.HttpServletRequest |
getRequest() |
protected ReentrantLock |
getSessionLock() |
boolean |
isActive() |
void |
onApplicationEvent(org.springframework.security.web.session.HttpSessionDestroyedEvent event) |
void |
releaseLock(Object lockObject) |
public Object acquireLock(Order order)
Order parameter, it does not use it in any way. This
session-based lock manager implementation will prevent all operations that are identified as requiring a
lock from happening in parallel. Instead, it will execute them sequentially as locks are released from
previous implementations.acquireLock in interface OrderLockManagerpublic Object acquireLockIfAvailable(Order order)
acquireLockIfAvailable in interface OrderLockManagerpublic void releaseLock(Object lockObject)
releaseLock in interface OrderLockManagerpublic void onApplicationEvent(org.springframework.security.web.session.HttpSessionDestroyedEvent event)
onApplicationEvent in interface org.springframework.context.ApplicationListener<org.springframework.security.web.session.HttpSessionDestroyedEvent>protected javax.servlet.http.HttpServletRequest getRequest()
protected ReentrantLock getSessionLock()
public boolean isActive()
isActive in interface OrderLockManagerCopyright © 2014. All Rights Reserved.