私はehcache.xmlに次のものを持っています
<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd" updateCheck="false" >
<defaultCache
maxElementsInMemory="500"
eternal="false"
overflowToDisk="false"
overflowToOffHeap="false"
memoryStoreEvictionPolicy="LRU" >
<persistence strategy="none" />
</defaultCache>
<cache name="leadSourceCollectionsCache"
maxElementsInMemory="500"
eternal="false"
overflowToDisk="false"
overflowToOffHeap="false"
memoryStoreEvictionPolicy="LRU" >
<persistence strategy="none" />
</cache>
</ehcache>
サーバーを起動すると、次の ehcache 関連のデバッグ出力が表示されます
07.08.2013 15:36:10 DEBUG-ConfigurationFactory: [Configuring ehcache from InputStream]
07.08.2013 15:36:10 DEBUG-BeanHandler: [Ignoring ehcache attribute xmlns:xsi]
07.08.2013 15:36:10 DEBUG-BeanHandler: [Ignoring ehcache attribute xsi:noNamespaceSchemaLocation]
07.08.2013 15:36:10 DEBUG-PropertyUtil: [propertiesString is null.]
07.08.2013 15:36:10 DEBUG-ConfigurationHelper: [No CacheManagerEventListenerFactory class specified. Skipping...]
07.08.2013 15:36:10 DEBUG-Cache: [No BootstrapCacheLoaderFactory class specified. Skipping...]
07.08.2013 15:36:10 DEBUG-Cache: [CacheWriter factory not configured. Skipping...]
07.08.2013 15:36:10 DEBUG-ConfigurationHelper: [No CacheExceptionHandlerFactory class specified. Skipping...]
07.08.2013 15:36:10 DEBUG-Cache: [No BootstrapCacheLoaderFactory class specified. Skipping...]
07.08.2013 15:36:10 DEBUG-Cache: [CacheWriter factory not configured. Skipping...]
07.08.2013 15:36:10 DEBUG-ConfigurationHelper: [No CacheExceptionHandlerFactory class specified. Skipping...]
07.08.2013 15:36:10 DEBUG-MemoryStore: [Initialized net.sf.ehcache.store.NotifyingMemoryStore for leadSourceCollectionsCache]
07.08.2013 15:36:10 DEBUG-Cache: [Initialised cache: leadSourceCollectionsCache]
07.08.2013 15:36:10 DEBUG-ConfigurationHelper: [CacheDecoratorFactory not configured. Skipping for 'leadSourceCollectionsCache'.]
07.08.2013 15:36:10 DEBUG-ConfigurationHelper: [CacheDecoratorFactory not configured for defaultCache. Skipping for 'leadSourceCollectionsCache'.]
07.08.2013 15:36:10 DEBUG-Cache: [No BootstrapCacheLoaderFactory class specified. Skipping...]
07.08.2013 15:36:10 DEBUG-Cache: [CacheWriter factory not configured. Skipping...]
07.08.2013 15:36:10 DEBUG-MemoryStore: [Initialized net.sf.ehcache.store.MemoryStore for leadSourceCollectionCache]
07.08.2013 15:36:10 DEBUG-DiskStorePathManager: [Using diskstore path /tmp]
07.08.2013 15:36:10 DEBUG-DiskStorePathManager: [Holding exclusive lock on /tmp/.ehcache-diskstore.lock]
07.08.2013 15:36:10 DEBUG-DiskStorageFactory: [Failed to delete file lead%0053ource%0043ollection%0043ache.index]
07.08.2013 15:36:10 DEBUG-DiskStorageFactory: [Matching data file missing (or empty) for index file. Deleting index file /tmp/lead%0053ource%0043ollection%0043ache.index]
07.08.2013 15:36:10 DEBUG-DiskStorageFactory: [Failed to delete file lead%0053ource%0043ollection%0043ache.index]
07.08.2013 15:36:10 DEBUG-Cache: [Initialised cache: leadSourceCollectionCache]
したがって、LeadSourceCollectionCache をメモリ ストア キャッシュとして作成しているように見えますが、これは私が望むものです。ただし、leadSourceCollectionCache.put を呼び出すと、次のようになります。
07.08.2013 15:37:46 DEBUG-Segment: [ヒープに 0 を追加] 07.08.2013 15:37:46 ERROR-DiskStorageFactory: [1 ~ 2 のディスク書き込みに失敗しました: ]
java.io.NotSerializableException: intouch.connector.business.LeadSourceCollection
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1181)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1541)
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:439)
at net.sf.ehcache.Element.writeObject(Element.java:835)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1429)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1175)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
at net.sf.ehcache.util.MemoryEfficientByteArrayOutputStream.serialize(MemoryEfficientByteArrayOutputStream.java:97)
at net.sf.ehcache.store.disk.DiskStorageFactory.serializeElement(DiskStorageFactory.java:405)
at net.sf.ehcache.store.disk.DiskStorageFactory.write(DiskStorageFactory.java:384)
at net.sf.ehcache.store.disk.DiskStorageFactory$DiskWriteTask.call(DiskStorageFactory.java:485)
at net.sf.ehcache.store.disk.DiskStorageFactory$PersistentDiskWriteTask.call(DiskStorageFactory.java:1088)
at net.sf.ehcache.store.disk.DiskStorageFactory$PersistentDiskWriteTask.call(DiskStorageFactory.java:1072)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
なぜこれが起こっているのか、一生理解できません。キャッシュがディスクに触れないようにしたいです。また、永続性がなしに設定されているときに /tmp に書き込もうとする理由もわかりません。