What problems are seen for the .compute(...) method exposed by the RHDG cache interface?

Solution Verified - Updated -

Issue

  • If I use remoteCache.compute(key, (k,v)->{...}) this seems working but remoteCache.compute(key, (k,v)->{...}, timeToLive, TimeUnit.SECONDS) will throw an UnsupportedOperationException. What is the reason?
Caused by: java.lang.UnsupportedOperationException
    at org.infinispan.client.hotrod.impl.RemoteCacheSupport.compute(RemoteCacheSupport.java:212)

  • The use of cache.compute(key, (k,v)->{...}, timeToLive, TimeUnit.SECONDS) will not work correctly if off-heap memory is configured. Without off-heap it will not throw Exceptions.
ERROR [org.infinispan.interceptors.impl.InvocationContextInterceptor] ISPN000136: Error executing command PrepareCommand on Cache 'wolfX', writing keys [test] java.lang.ClassCastException: java.lang.String cannot be cast to org.infinispan.commons.marshall.WrappedBytes
    at org.infinispan.container.offheap.OffHeapConcurrentMap.put(OffHeapConcurrentMap.java:83)
    ...
ERROR [org.infinispan.transaction.impl.TransactionCoordinator] ISPN000097: Error while processing a prepare in a single-phase transaction org.infinispan.commons.CacheException: java.lang.ClassCastException: java.lang.String cannot be cast to org.infinispan.commons.marshall.WrappedBytes
    at org.infinispan.interceptors.impl.InvocationContextInterceptor.rethrowException(InvocationContextInterceptor.java:134)
    ...
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to org.infinispan.commons.marshall.WrappedBytes
    at org.infinispan.container.offheap.OffHeapConcurrentMap.put(OffHeapConcurrentMap.java:83)
    ... 54 more
ERROR [org.infinispan.commons.tx.TransactionImpl] ISPN000926: afterCompletion() failed for SynchronizationAdapter{localTransaction=LocalTransaction{remoteLockedNodes=[lt-34411], isMarkedForRollback=false, lockedKeys=[], backupKeyLocks=[], topologyId=1, stateTransferFlag=null} org.infinispan.transaction.synchronization.SyncLocalTransaction@3} org.infinispan.transaction.synchronization.SynchronizationAdapter@22 org.infinispan.commons.CacheException: Could not commit.
    at org.infinispan.transaction.impl.TransactionTable.afterCompletion(TransactionTable.java:912)
    ...
Caused by: javax.transaction.xa.XAException
Caused by: org.infinispan.commons.CacheException: java.lang.ClassCastException: java.lang.String cannot be cast to org.infinispan.commons.marshall.WrappedBytes
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to org.infinispan.commons.marshall.WrappedBytes
  • Using cache.compute(...) with expiration properties seems to not change the value, but did not throw any Exception. Is there a problem in my code?

Environment

  • Red Hat Data Grid (RHDG)
    • 7

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content