You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jcs-users@jakarta.apache.org by TMUser <mt...@hotmail.com> on 2007/09/14 16:40:28 UTC

Is there a direct method to load all cache into a HashMap?

Hello,

I tried to load all elements of a cache to an HashMap with the following
java code:

-----------------------------------------------------
		HashMap ados = new HashMap();
		String key;	
		Iterator itAdos = adosCache.getGroupKeys("adosCache").iterator();
		while (itAdos.hasNext()) {
			key = (String) itAdos.next();
			ados.put(key, adosCache.getFromGroup(key, "adosCache"));			
		}
-----------------------------------------------------

But I have this 2 error messages:
-----------------------------------------------------
IndexedDiskCache.java:593  - Region [adosCache] Exception, Problem reading
object from file
java.lang.NullPointerException
	at com.test.app.dto.ListObject.hashCode(ListObject.java:130)
	at java.util.HashMap.put(Unknown Source)
	at java.util.HashSet.readObject(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
…
-----------------------------------------------------
IndexedDiskCache.java:551  - Region [adosCache] Failure getting from disk,
key = [GAN: groupId=[groupId=adosCache, adosCache], attrName=AZ.BVG.1278]
java.io.IOException: Region [adosCache] Problem reading object from disk.
null
	at
org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache.readElement(IndexedDiskCache.java:594)
	at
org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache.doGet(IndexedDiskCache.java:537)
…
-----------------------------------------------------

I don’t know if there is a direct method to load a JCS cache to an HashMap.

NB : I have no problems with reading and writing a single element from the
cache.

Thanks for your help. 
Mohammed. 

-- 
View this message in context: http://www.nabble.com/Is-there-a-direct-method-to-load-all-cache-into-a-HashMap--tf4442897.html#a12676473
Sent from the JCS - Users mailing list archive at Nabble.com.


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