ehcache错误 - “未读块数据”第二个.put和on

时间:2014-02-27 10:53:45

标签: scala ehcache

我从第二个ehcache .put得到此错误,我不知道为什么这只会发生与写入磁盘有关,任何想法如何解决?

2014-02-27 12:06:11,298 ERROR [worker-29] [MyApp] unread block data
java.lang.IllegalStateException: unread block data
    at java.io.ObjectInputStream$BlockDataInputStream.setBlockDataMode(ObjectInputStream.java:2419) ~[na:1.7.0_25]
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1380) ~[na:1.7.0_25]
    at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1989) ~[na:1.7.0_25]
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1913) ~[na:1.7.0_25]
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1796) ~[na:1.7.0_25]
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348) ~[na:1.7.0_25]
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370) ~[na:1.7.0_25]
    at net.sf.ehcache.store.disk.DiskStorageFactory.read(DiskStorageFactory.java:378) ~[ehcache-core.jar:na]
    at net.sf.ehcache.store.disk.DiskStorageFactory.retrieve(DiskStorageFactory.java:936) ~[ehcache-core.jar:na]
    at net.sf.ehcache.store.disk.Segment.decode(Segment.java:167) ~[ehcache-core.jar:na]
    at net.sf.ehcache.store.disk.Segment.put(Segment.java:444) ~[ehcache-core.jar:na]
    at net.sf.ehcache.store.disk.DiskStore.put(DiskStore.java:475) ~[ehcache-core.jar:na]
    at net.sf.ehcache.store.FrontEndCacheTier.put(FrontEndCacheTier.java:221) ~[ehcache-core.jar:na]
    at net.sf.ehcache.Cache.putInternal(Cache.java:1492) ~[ehcache-core.jar:na]
    at net.sf.ehcache.Cache.put(Cache.java:1417) ~[ehcache-core.jar:na]
    at net.sf.ehcache.Cache.put(Cache.java:1382) ~[ehcache-core.jar:na]

我的conf:

  val cacheConf: CacheConfiguration = new CacheConfiguration(EHCacheWrapper.cacheName, 50000)
    .maxElementsInMemory(50000)
    .maxElementsOnDisk(50000)
    .eternal(false)
    .timeToLiveSeconds(300)
    .timeToIdleSeconds(300)
    .overflowToDisk(true)
    .diskPersistent(true)
    .diskSpoolBufferSizeMB(20)
    .memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LRU)

  val cacheManagerConf = new Configuration()
  val diskStoreConfiguratoin = new DiskStoreConfiguration()
  val tempdiskLocation = "/data/tmp"
  diskStoreConfiguratoin.setPath(tempdiskLocation)

  cacheManagerConf.addDiskStore(diskStoreConfiguratoin)

  lazy val ehCacheFactory = EHCacheFactory.createFactory()
  lazy val cache = ehCacheFactory.createByConf(cacheManagerConf, cacheConf)

0 个答案:

没有答案