qianjava / ehcache-spring-annotations

Automatically exported from code.google.com/p/ehcache-spring-annotations
0 stars 0 forks source link

Can't use diskPersistent=true cache with DecoratedCacheType.REFRESHING_SELF_POPULATING_CACHE #93

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Configure a cache in ehcache.xml with diskPersistent=true
2. Annotate a method using Cacheable with that cache and 
DecoratedCacheType.REFRESHING_SELF_POPULATING_CACHE

What is the expected output? 
Can use diskPersistent=true with 
DecoratedCacheType.REFRESHING_SELF_POPULATING_CACHE

What do you see instead?
Method return value is not cached and stack trace:
2012-03-21 14:59:45,631 ERROR 
[net.sf.ehcache.store.compound.factories.DiskStorageFactory$DiskWriteTask.call(D
iskStorageFactory.java:422)] kcNewsFeed.data - Disk Write of -1927703584078 
failed (it will be evicted instead): 
java.io.NotSerializableException: 
com.googlecode.ehcache.annotations.RefreshableCacheEntry
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1081)
    at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
    at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:391)
    at net.sf.ehcache.Element.writeObject(Element.java:791)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:592)
    at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:917)
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1339)
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
    at net.sf.ehcache.util.MemoryEfficientByteArrayOutputStream.serialize(MemoryEfficientByteArrayOutputStream.java:97)
    at net.sf.ehcache.store.compound.factories.DiskStorageFactory.serializeElement(DiskStorageFactory.java:332)
    at net.sf.ehcache.store.compound.factories.DiskStorageFactory.write(DiskStorageFactory.java:311)
    at net.sf.ehcache.store.compound.factories.DiskStorageFactory$DiskWriteTask.call(DiskStorageFactory.java:415)
    at net.sf.ehcache.store.compound.factories.DiskPersistentStorageFactory$PersistentDiskWriteTask.call(DiskPersistentStorageFactory.java:565)
    at net.sf.ehcache.store.compound.factories.DiskPersistentStorageFactory$PersistentDiskWriteTask.call(DiskPersistentStorageFactory.java:551)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
    at java.util.concurrent.FutureTask.run(FutureTask.java:123)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:65)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:172)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)
    at java.lang.Thread.run(Thread.java:595)

What version of the product are you using? On what operating system?
Using version 1.2 on Windows 2000 with Tomcat 6

Please provide any additional information below.
Can com.googlecode.ehcache.annotations.RefreshableCacheEntry be made 
Serializable so that it can be written to disk.

Here is my cache config:
<cache name="kcNewsFeed" maxElementsInMemory="1000" eternal="true" 
overflowToDisk="true" diskPersistent="true"/>

And my annotated method signature:
@Cacheable(cacheName = "kcNewsFeed", selfPopulating = true, decoratedCacheType 
= DecoratedCacheType.REFRESHING_SELF_POPULATING_CACHE, refreshInterval = 1000 * 
60 * 5)
public String getSupportNewsXml() 

Original issue reported on code.google.com by clayem...@gmail.com on 21 Mar 2012 at 7:18

GoogleCodeExporter commented 8 years ago
Hey I also got the same issue, did any body knows how to fix this issue?

Original comment by Gurung.C...@gmail.com on 12 Jun 2012 at 5:36

GoogleCodeExporter commented 8 years ago
i am having the same problem... any fixes in sight?

Original comment by imbaRox...@gmail.com on 1 Jul 2013 at 3:04

GoogleCodeExporter commented 8 years ago
any comments of what classes to overwrite would be fine too

Original comment by imbaRox...@gmail.com on 1 Jul 2013 at 3:04

GoogleCodeExporter commented 8 years ago
for your bean class implement serializable inteface it may work

Original comment by adarshag...@gmail.com on 2 Dec 2014 at 7:36

GoogleCodeExporter commented 8 years ago
I am having same issue. Did anyone get it resolved or had an alternative ?

Original comment by kesha.sh...@gmail.com on 11 Mar 2015 at 11:54