[jboss-user] [Security & JAAS/JBoss] - Re: TimedCachedPolicy never removes entries from cache

ramazanyich do-not-reply at jboss.com
Mon Jan 15 05:16:03 EST 2007


Still have exactly the same issue in jboss4.0.4GA (probably JBOSS4.0.5.GA as sources of this part are not changed).
We also have thousands of users. 
For a moment only possible solution is to extend TimedCachePolicy class and reiplement run() method. Currently this method only changes current time.
But expired objects can be removed at this time.

public void run() {
		super.run();
		synchronized (entryMap) {
			Iterator iter = entryMap.entrySet().iterator();
			List removeentries = new ArrayList();
			while (iter.hasNext()) {
				Map.Entry entry = (Map.Entry) iter.next();
				TimedEntry value = (TimedEntry) entry.getValue();

				if (value.isCurrent(now) == false) {
					if(log.isDebugEnabled()){
						log.debug("destroying object:"+value);
					}
						
					value.destroy();
					removeentries.add(entry.getKey());
				}

			}
			for (Object object : removeentries) {
				if(log.isDebugEnabled()){
					log.debug("removing object from Map:"+object);
				}

				entryMap.remove(object);
			}
		}

	}

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4001715#4001715

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4001715



More information about the jboss-user mailing list