示例#1
0
  private ERXMutableInteger _decrementReferenceCounterForKey(String key) {
    ERXMutableInteger count = (ERXMutableInteger) _referenceCounters().objectForKey(key);
    if (count != null) count.decrement();

    if (log.isDebugEnabled())
      log.debug("_decrementReferenceCounterForKey() - count = " + count + ", key = " + key);
    return count;
  }
示例#2
0
 private ERXMutableInteger _incrementReferenceCounterForKey(String key) {
   ERXMutableInteger count = (ERXMutableInteger) _referenceCounters().objectForKey(key);
   if (count != null) count.increment();
   else {
     count = new ERXMutableInteger(1);
     _referenceCounters().setObjectForKey(count, key);
   }
   if (log.isDebugEnabled())
     log.debug("_incrementReferenceCounterForKey() - count = " + count + ", key = " + key);
   return count;
 }
示例#3
0
 /**
  * Decrements the retain count for a given browser object.
  *
  * @param browser to be released
  */
 public synchronized void releaseBrowser(ERXBrowser browser) {
   String key = _computeKey(browser);
   ERXMutableInteger count = _decrementReferenceCounterForKey(key);
   if (count == null) {
     // Perhaps forgot to call registerBrowser() but try to remove the browser for sure
     _browserPool().removeObjectForKey(key);
   } else if (count.intValue() <= 0) {
     _browserPool().removeObjectForKey(key);
     _referenceCounters().removeObjectForKey(key);
   }
 }