portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 綠羽毛 <sam56...@ms2.hinet.net>
Subject Re: Refreshing a psml reference
Date Fri, 03 Dec 2004 10:15:51 GMT
hellow all
I have the same problem on this issue, but I solved it.
Here is my solution:

1.add following method in CastorPsmlManagerService.java

public FileCache getDocuments() {
 	return documents;
}

2.add following method in FileCache.java

	public void evictAll() {
			synchronized (cache) {			

				List list = new LinkedList(cache.values());
				Collections.sort(list, this);

		

				for (Iterator it = list.iterator(); it.hasNext();) {		

					FileCacheEntry entry = (FileCacheEntry) it.next();
					String key = null;
					try {
						key = entry.getFile().getCanonicalPath();
					} catch (java.io.IOException e) {
						logger.error("Exception getting file path: ", e);
					}
					// notify that eviction will soon take place
					for (Iterator lit = this.listeners.iterator();
						lit.hasNext();
						) {
						FileCacheEventListener listener =
							(FileCacheEventListener) lit.next();
						listener.evict(entry);
					}
					cache.remove(key);		
				}
			}
		}

3.When you change source PSML which will be referenced by other
PSML,run following method in any action. PSML cache will be evictd, and
PSML will all refresh. The PSML cache is still working.

CastorPsmlManagerService cs =
	(CastorPsmlManagerService)TurbineServices.getInstance().getService("PsmlManager");
FileCache fc =cs.getDocuments();
System.out.println("before evictting Cach Size:" + fc.getSize());
	fc.evictAll();
System.out.println("after evictting Cach Size:" + fc.getSize());


Hope it will userful for you.

Regards,

Sam Fan 
From: Andy.Sun@cexp.com <Andy.Sun@cexp.com>
Subject: Refreshing a psml reference
Date: Wed, 17 Nov 2004 14:14:58 -0700
Content-Type: text/plain;
	charset="iso-8859-1"

I am looking into the getDocument method in the PsmlManagerService. The
refresh method call getDocument() with the getCached set to false. I believe
the tricky part is when and where to do refresh. When using a reference, the
psml manager doesn't know if the referenced psml is changed or not. I am
still digging and hopefully will find a good resolution.
This happened in a user by user basis because one user has psml cached but
the other one doesn't. 
Andy

-----Original Message-----
From: Dan Moore [mailto:moore234@yahoo.com]
Sent: Wednesday, November 17, 2004 2:05 PM
To: Jetspeed Users List
Subject: RE: Refreshing a psml reference


I'd think bypassing the cache would be a bad thing in the future.  You
might want to look at the 'refresh' method on the PSMLManager service
interface:

http://portals.apache.org/jetspeed-1/apidocs/org/apache/jetspeed/services/ps
mlmanager/PsmlManagerService.html#refresh(org.apache.jetspeed.om.profile.Pro
fileLocator)

I'd dig into that class to gain a better understanding of how caching
of psml documents actually happens.  What you're experiencing implies
that it happens on a user by user basis, which does not make a whole
lot of sense to me, at least for group and role based psml documents.

Dan

--- Andy.Sun@cexp.com wrote:

> After a little more research, we discovered one more way to get
> around this
> issue. There is a setting in JetspeedResource.properties file,
> services.PsmlManager.cacheSize. It is default to 100, meaning maximum
> 100
> psml pages will be cached. We change that to 0 and it fixed this psml
> reference refresh issue.
> Is this change recommended? It is obviously for a performance reason
> (probably save time on File I/O). With only limited users(<500)using
> the
> site now, we didn't notice a obvious impact. However, we will have
> more
> users in the future and the psml cache will be a good thing to have.
> Without
> turning it off, is there a setting to control the expiration of the
> psml
> cache? 
> Andy 
> 
> -----Original Message-----
> From: Andy.Sun@cexp.com [mailto:Andy.Sun@cexp.com]
> Sent: Wednesday, November 17, 2004 11:05 AM
> To: jetspeed-user@jakarta.apache.org
> Subject: Refreshing a psml reference
> 
> 
> We just implemented a Jetspeed 1.5 portal site with tomcat 4.1.18.
> The psml
> reference is used so that different users can share a group or role
> psml
> file. When we make a change to the group psml (e.g. adding a portlet
> to the
> page), the users who have previously login to the site won't see the
> change
> if they login again (even after a while). However, if the user login
> as the
> first time, they could see the change. Of course, the change will be
> visible
> to everyone after bouncing the tomcat. The sequence is like this.
> -login as user1 then logout
> -change the group psml that is referenced by user1's psml
> -login as user2 to verify the referenced psml is changed.
> -if yes from pervious step, login as user1
> -too bad, the user1 still don't see the change.
> It seems that there is caching happened for user1. However we are not
> sure
> which setting could affect this. We also waited overnight expecting
> the
> cache will expire. That did not happen either. 
> Has anyone actively using reference? Any experience with this issue?
> Thanks!
> Andy
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> jetspeed-user-help@jakarta.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> jetspeed-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org




--------------------------------------------- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean. 

By @utoTOOLS MIS


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message