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)
This method differs from
OrderLockManager.acquireLock(Order) in that it will not block if the lock is currently
held by a different caller. |
protected javax.servlet.http.HttpServletRequest |
getRequest() |
protected ReentrantLock |
getSessionLock() |
boolean |
isActive()
This method indicates if the lock manager is active.
|
void |
onApplicationEvent(org.springframework.security.web.session.HttpSessionDestroyedEvent event) |
void |
releaseLock(Object lockObject)
Releases the given lockObject and notifies any threads that are waiting on that object that they are able to
attempt to acquire the lock.
|
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 OrderLockManagerOrderLockManager.releaseLock(Object) once
the operation that required a lock has completed.public Object acquireLockIfAvailable(Order order)
OrderLockManagerOrderLockManager.acquireLock(Order) in that it will not block if the lock is currently
held by a different caller. In the case that the lock was not able to be immediately acquired, this method
will return null.acquireLockIfAvailable in interface OrderLockManagerOrderLockManager.acquireLock(Order)public void releaseLock(Object lockObject)
OrderLockManagerreleaseLock 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()
OrderLockManagerisActive in interface OrderLockManagerCopyright © 2015. All rights reserved.