2

I am using infinispan 6.0.1 release, I have configured it to use SingleFileStore as loader

Configuration is as below

<namedCache name="MyCache">
 <persistence passivation="true">
    <singleFile fetchPersistentState="true"
                 ignoreModifications="false"
                 purgeOnStartup="false" maxEntries="5000">
     </singleFile>
  </persistence>

My question is, will this cache survive JVM restarts? I mean lets say my cache is holding {n} entries and my jvm goes down. When JVM starts again will my cache initialized with {n} entries?

Thanks in advance!!

Dhananjay
  • 3,903
  • 2
  • 29
  • 44

2 Answers2

2

With passivation, the entry is EITHER in memory (activated) OR in cache store (passivated). Therefore, no, it won't.

Radim Vansa
  • 5,686
  • 2
  • 25
  • 40
  • so its not at all possible to have recover from jvm restarts? Can we utilize shutdown hook..? – Dhananjay Jun 20 '14 at 07:44
  • If you talk about shutdown hooks, you probably consider grateful ones - after calling cacheManager.stop() etc. In that case, yes, entries are passivated into disk correctly. I had rather in my mind those non-grateful such as JVM crash or machine going out of power. – Radim Vansa Jun 24 '14 at 07:21
2

With passivation enabled, my understanding is, that everything only present in memory will persisted during shutdown. However, I cannot find proof in the InfiniSpan documentation now.

Anyway, keep in mind that the SingeFileStore is not a robust implementation. The stored value will only survive, if you do a correct shutdown.

cruftex
  • 5,545
  • 2
  • 20
  • 36
  • The proof is only in source code, never trust documentation too much :) but you're right. When the cache manager is stopping PassivationManagerImpl.passivateAll() is called (as this is annotated by @Stop). – Radim Vansa Jun 24 '14 at 07:24