Take a look at synchronizations (https://docs.jboss.org/author/display/ISPN/Infinispan+transactions)
The grouping API does have benefits; I use it for my use case where I have to pessimisticly acquire locks on keys across several caches in the same transaction. By knowing the group, I can execute it on the local data owner, which means all lock acquisition is local -- no RPC involved. You'll probably see a similar benefit.
I checked the synchronizations. But I do not think it can keep the consisitency between the two cache as two-phase transction does.
Do you mean to use the lock operation to explictly acquire the lock on the cache?
In my use case, it is possibile that the Node A process the transcation but the Node B own all the data. So the RPC can not be avoided.
Depending on what you mean about "consistency," you may also need to check out recovery.
As for your use case, you may also want to check out the DistributedExecutor service. That way you can serialize a task that executes on the main key owner. You'll still incur a RPC marshalling the requisite data, but the transaction can be run in the task context. This way, the transaction only runs on the main data owner and any backups -- say (B,C), rather than (A,B,C).
To achieve the ACI (not D, its in memory) . The two-phase transaction has its problem. But it is much stronger than the synchronizations.
Use DistributedExecutor is an option need invesigate because we hope to use client-server mode finally when hotrod fully support JTA. (Infinispan team guys, please don't make us wait too long. we keen to that)
Thank you for your advice.