示例#1
0
  @SuppressWarnings("unchecked")
  public void cleanup() {
    long now = System.currentTimeMillis();
    ArrayList<K> keysToDelete = null;

    synchronized (cacheMap) {
      MapIterator itr = cacheMap.mapIterator();

      keysToDelete = new ArrayList<K>((cacheMap.size() / 2) + 1);
      K key = null;
      CachedObject c = null;

      while (itr.hasNext()) {
        key = (K) itr.next();
        c = (CachedObject) itr.getValue();

        if (c != null && (now > ((1000L * timeToLiveInSeconds) + c.lastAccessed))) {
          keysToDelete.add(key);
        }
      }
    }

    for (K key : keysToDelete) {
      synchronized (cacheMap) {
        cacheMap.remove(key);
      }
      Thread.yield();
    }
  }
  public void setPassword(
      Session session, final ITenant theTenant, final String userName, final String password)
      throws NotFoundException, RepositoryException {
    User jackrabbitUser = getJackrabbitUser(theTenant, userName, session);
    if ((jackrabbitUser == null)
        || !TenantUtils.isAccessibleTenant(
            theTenant == null
                ? tenantedUserNameUtils.getTenant(jackrabbitUser.getID())
                : theTenant)) {
      throw new NotFoundException(
          Messages.getInstance()
              .getString("AbstractJcrBackedUserRoleDao.ERROR_0003_USER_NOT_FOUND"));
    }
    jackrabbitUser.changePassword(password);

    /** BISERVER-9906 Clear cache after changing password */
    purgeUserFromCache(userName);
    userCache.remove(jackrabbitUser.getID());
  }
示例#3
0
 /** {@inheritDoc} */
 @Override
 public void delete(K key) {
   synchronized (cacheMap) {
     cacheMap.remove(key);
   }
 }