/** * 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; } }
public static void closeSession(NamedCache cache) { TxSession ss = getSession(cache); if (ss != null) { ss.close(); } }
/** * 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(); } }