public void saveOrUpdate(PersistentSession ksessionInfo) { ksessionInfo.transform(); ksessions.put( ksessionInfo.getId(), ksessionInfo ); }
public EntityHolder(String key, PersistentSession session) { this.key = key; this.type = "sessionInfo"; this.sessionInfoId = session.getId(); SessionInfo sessionInfo = (SessionInfo) session; this.sessionInfoVersion = sessionInfo.getVersion(); session.transform(); this.sessionInfoData = Base64.encodeBase64String(sessionInfo.getData()); this.sessionInfoLastModificationDate = sessionInfo.getLastModificationDate(); this.sessionInfoStartDate = sessionInfo.getStartDate(); }
public void commit(boolean transactionOwner) { // Do not check if the caller is the transactionOwner // because there's no need to "wait" for a commit try{ for(PersistentSession session : session.getStoredKnowledgeSessions()){ session.transform(); storage.saveOrUpdate(session); } for(PersistentWorkItem workItem : session.getStoredWorkItems()){ workItem.transform(); storage.saveOrUpdate( workItem ); } try{ transactionSynchronization.afterCompletion(TransactionManager.STATUS_COMMITTED); } catch (RuntimeException re){ logger.warn("Unable to synchronize transaction after commit, see cause.", re); } } catch (RuntimeException re) { transactionSynchronization.afterCompletion(TransactionManager.STATUS_ROLLEDBACK); } // We shouldn't clear session here because by doing so // we lose track of this objects on successive interactions }
public PersistentSession persist(PersistentSession entity) { if (entity.getId() == null) { entity.setId(generateSessionInfoId()); } String key = createSessionKey(entity.getId()); entity.transform(); this.cache.put(key , new EntityHolder(key, entity) ); return entity; }