mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

abobrov
20.28.2007 0ce8111bcd7c23226fa1fe7469baae9b1840eae4
opends/src/server/org/opends/server/extensions/SoftReferenceEntryCache.java
@@ -282,6 +282,7 @@
    {
      map = new ConcurrentHashMap<Long,SoftReference<CacheEntry>>();
      map.put(entryID, ref);
      idMap.put(backend, map);
    }
    else
    {
@@ -361,6 +362,12 @@
          {
            ref.clear();
          }
          // If this backend becomes empty now remove
          // it from the idMap map.
          if (map.isEmpty())
          {
            idMap.remove(backend);
          }
        }
      }
    }
@@ -441,6 +448,28 @@
  /**
   * {@inheritDoc}
   */
  public String toVerboseString()
  {
    String verboseString = new String();
    // There're no locks in this cache to keep dnMap and idMap in
    // sync. Examine dnMap only since its more likely to be up to
    // date than idMap. Dont bother with copies either since this
    // is SoftReference based implementation.
    for(SoftReference<CacheEntry> ce : dnMap.values()) {
      verboseString = verboseString + ce.get().getDN().toString() +
        ":" + Long.toString(ce.get().getEntryID()) + ":" +
        ce.get().getBackend().getBackendID() + "\n";
    }
    return (verboseString.length() > 0 ? verboseString : null);
  }
  /**
   * {@inheritDoc}
   */
  @Override()
  public boolean isConfigurationAcceptable(EntryCacheCfg configuration,
                                           List<Message> unacceptableReasons)
@@ -611,8 +640,9 @@
            {
              ref.clear();
              Backend backend = freedEntry.getBackend();
              ConcurrentHashMap<Long,SoftReference<CacheEntry>> map =
                   idMap.get(freedEntry.getBackend());
                   idMap.get(backend);
              if (map != null)
              {
                ref = map.remove(freedEntry.getEntryID());
@@ -620,6 +650,11 @@
                {
                  ref.clear();
                }
                // If this backend becomes empty now remove
                // it from the idMap map.
                if (map.isEmpty()) {
                  idMap.remove(backend);
                }
              }
            }
          }