示例#1
0
 /**
  * Ensures that {@link NamedCache} is connected to session opened for write. Creates a new session
  * and new {@link NamedCache} is provided instance is not write capable;
  */
 public static NamedCache ensureWriteable(NamedCache cache) {
   TxSession ss = getSession(cache);
   if (ss == null || ss.isReadOnly()) {
     ss = getManager().openReadWriteSession();
     return ss.connect(cache);
   } else {
     return cache;
   }
 }
示例#2
0
 public static void closeSession(NamedCache cache) {
   TxSession ss = getSession(cache);
   if (ss != null) {
     ss.close();
   }
 }
示例#3
0
 /**
  * Rolls back TX session associated with cache. Will affect all {@link NamedCache}s associated
  * with session.
  */
 public static void rollback(NamedCache cache) {
   TxSession ss = getSession(cache);
   if (ss != null) {
     ss.commit();
   }
 }