Referencing Objects in a JDG cache
Issue
- Is it possible to have a reference to a cached object outside the cache and have it synchronized with the cluster?
- Is there a way to reference the last version of an object in a DataGrid cache?
Lets assume that on node1 the object for "A" is retrieved from the cache and stored as referece, is it possible to see updates which are made on node2? - Is there a problem if I modify Objects which I read from a JDG cache?
- Why should I prefer imutable objects for caching?
- A cache configured with a persistence
write-behind
will fail to start ifpreload=true
with Exceptions
Caused by: org.infinispan.persistence.spi.PersistenceException: java.io.StreamCorruptedException: Unexpected byte found when reading an object: 0
used by: org.infinispan.commons.CacheException: Unable to invoke method public void org.infinispan.persistence.manager.PreloadManager.start() on object of type PreloadManager
at org.infinispan.commons.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:193) [infinispan-commons-9.4.18.Final-redhat-00001.jar:9.4.18.Final-redhat-00001]
at org.infinispan.factories.impl.BasicComponentRegistryImpl.startWrapper(BasicComponentRegistryImpl.java:520) [infinispan-core-9.4.18.Final-redhat-00001.jar:9.4.18.Final-redhat-00001]
at org.infinispan.factories.impl.BasicComponentRegistryImpl$ComponentWrapper.running(BasicComponentRegistryImpl.java:711) [infinispan-core-9.4.18.Final-redhat-00001.jar:9.4.18.Final-redhat-00001]
at org.infinispan.factories.impl.BasicComponentRegistryImpl.startDependencies(BasicComponentRegistryImpl.java:552) [infinispan-core-9.4.18.Final-redhat-00001.jar:9.4.18.Final-redhat-00001]
.....
- ConcurrentModificationExceptions messages are logged like followed for caches configured with
write-behind
DEBUG [org.infinispan.persistence.async.AsyncCacheWriter] (AsyncStoreProcessor--p30-t10) Failed to process async modifications: org.infinispan.persistence.spi.PersistenceException: org.infinispan.persistence.spi.PersistenceException: java.util.ConcurrentModificationException
at org.infinispan.persistence.file.SingleFileStore.write(SingleFileStore.java:373) [infinispan-core-9.4.18.Final-redhat-00001.jar:9.4.18.Final-redhat-00001]
at java.lang.Iterable.forEach(Iterable.java:75) [rt.jar:1.8.0_242]
at org.infinispan.persistence.spi.CacheWriter.writeBatch(CacheWriter.java:47) [infinispan-core-9.4.18.Final-redhat-00001.jar:9.4.18.Final-redhat-00001]
at org.infinispan.persistence.async.AsyncCacheWriter.applyModificationsSync(AsyncCacheWriter.java:226) [infinispan-core-9.4.18.Final-redhat-00001.jar:9.4.18.Final-redhat-00001]
...
Caused by: org.infinispan.persistence.spi.PersistenceException: java.util.ConcurrentModificationException
at org.infinispan.marshall.core.MarshalledEntryImpl.marshall(MarshalledEntryImpl.java:132) [infinispan-core-9.4.18.Final-redhat-00001.jar:9.4.18.Final-redhat-00001]
at org.infinispan.marshall.core.MarshalledEntryImpl.getValueBytes(MarshalledEntryImpl.java:113) [infinispan-core-9.4.18.Final-redhat-00001.jar:9.4.18.Final-redhat-00001]
at org.infinispan.persistence.file.SingleFileStore.write(SingleFileStore.java:330) [infinispan-core-9.4.18.Final-redhat-00001.jar:9.4.18.Final-redhat-00001]
... 8 more
Caused by: java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextNode(HashMap.java:1445) [rt.jar:1.8.0_242]
at java.util.HashMap$KeyIterator.next(HashMap.java:1469) [rt.jar:1.8.0_242]
- State transfer will fail if a new instance is started with one of the following messages shown in both instances.
ERROR [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (jgroups-4463,jboss90432-63171) ISPN000475: Error processing response for request 10782325 from jboss90434-61244
ERROR [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (jgroups-18,jboss90434-61244) ISPN000474: Error processing request 10782325@jboss90432-63171
Environment
- Red Hat JBoss Data Grid (RHDG, JDG)
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.