Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-9397

Check TX support for remote caches

XMLWordPrintable

      The RemoteCacheManager.getCache() methods would fail to return a transactional cache if the cache in server isn't transactional. It would throw an exception! NotTransactionalException?

      The user can fallback to the non transaction case, example

      try {
        cache = remoteCacheManager.getCache("some-cache", TransactionMode.NON_XA);
      } catch(NotTransactionalException e) {
        cache = remoteCacheManager.getCache("some-cache", TransactionMode.NONE);
      }
      

      In addition, some helper method can be added to the RemoteCacheManager to avoid dealing with exceptions:

      boolean supportsTransactions(String cacheName);
      

      simple example:

      boolean txCache = remoteCacheManager.supportsTransactions("some-cache");
      remoteCacheManager.getCache("some-cache", txCache ? TransactionMode.NON_XA : TransactionMode.NONE);
      

            pruivo@redhat.com Pedro Ruivo
            pruivo@redhat.com Pedro Ruivo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: