List of usage examples for java.util.concurrent.locks ReentrantLock toString
public String toString()
From source file:org.broadleafcommerce.core.web.order.SessionOrderLockManager.java
@Override public void onApplicationEvent(HttpSessionDestroyedEvent event) { ReentrantLock lock = SESSION_LOCKS.remove(event.getSession().getId()); if (lock != null && LOG.isDebugEnabled()) { LOG.debug("Destroyed lock due to session invalidation: " + lock.toString()); }/*from ww w . j a v a2 s .co m*/ }
From source file:org.broadleafcommerce.core.web.order.SessionOrderLockManager.java
protected ReentrantLock getSessionLock() { if (!isActive()) { throw new IllegalStateException( "This is currently a sessionless environment and session cannot be used " + "to obtain a lock. Consider using a different implementation of OrderLockManager."); }//from w w w . j a v a2s . c o m HttpSession session = getRequest().getSession(); ReentrantLock lock = SESSION_LOCKS.get(session.getId()); if (lock == null) { // There was no session lock object. We'll need to create one. To do this, we have to synchronize the // creation globally, so that two threads don't create the session lock at the same time. synchronized (LOCK) { lock = SESSION_LOCKS.get(session.getId()); if (lock == null) { lock = new ReentrantLock(); SESSION_LOCKS.put(session.getId(), lock); } } if (LOG.isDebugEnabled()) { LOG.debug("Created new lock object: " + lock.toString()); } } else { if (LOG.isDebugEnabled()) { LOG.debug("Returning previously created lock object: " + lock.toString()); } } return lock; }