@Override public void begin() throws RepositoryException { assertOpen(); // non-blocking. synchronized (remoteTx) { assertOpen(); if (remoteTx.get() != null) throw new RepositoryException("Active transaction exists"); try { remoteTx.set(repo.getRemoteRepository() .getRemoteRepositoryManager().getTransactionManager() .createTx(RemoteTransactionManager.UNISOLATED)); } catch (RuntimeException e) { throw new RepositoryException(e); } } }
this.transactionManager = new RemoteTransactionManager(this);
/** * <code>LIST-TX</code>: Return the set of active transactions. */ public Iterator<IRemoteTxState0> listTx() { final ConnectOptions opts = new ConnectOptions(mgr.getBaseServiceURL() + "/tx"); opts.method = "GET"; JettyResponseListener response = null; try { RemoteRepository.checkResponseCode(response = mgr.doConnect(opts)); // Note: iterator return supports streaming results (not implemented). return multiTxResponse(response).iterator(); } catch (Exception e) { throw new RuntimeException(e); } finally { if (response != null) response.abort(); } }
return singleTxResponse(response);
throws RemoteTransactionNotFoundException { if (!isReadWriteTx(txId)) {
return new RemoteTx(singleTxResponse(response)); default: throw new HttpException(listener.getStatus(), "status="
/** * Begin a read-only transaction. Since all read operations have snapshot * isolation, this is only necessary when multiple read operations need to * read on the same commit point. */ public void beginReadOnly() throws RepositoryException { assertOpen(); // non-blocking. synchronized (remoteTx) { assertOpen(); if (remoteTx.get() != null) throw new RepositoryException("Active transaction exists"); try { remoteTx.set(repo.getRemoteRepository() .getRemoteRepositoryManager().getTransactionManager() .createTx(RemoteTransactionManager.READ_COMMITTED)); } catch (RuntimeException e) { throw new RepositoryException(e); } } }
remoteTx.set(repo.getRemoteRepository() .getRemoteRepositoryManager().getTransactionManager() .createTx(timestamp)); } catch (RuntimeException e) { throw new RepositoryException(e);
/** * Create an unisolated transaction and commit it. This should be a NOP since * nothing is written on the database. * * TODO Create an unisolated transaction, write on the transaction, commit * the transaction and verify that we can read back the write set after the * commit. Note that we can only write on the resulting transaction if the * namespace supports isolatable indices. */ public void test_CREATE_TX_UNISOLATED_02() throws Exception { assertNotNull(m_mgr); assertNotNull(m_mgr.getTransactionManager()); final IRemoteTx tx = m_mgr.getTransactionManager().createTx( RemoteTransactionManager.UNISOLATED); try { } finally { tx.commit(); } assertFalse(tx.isActive()); }
/** * Create an read-only transaction and commit it. This should be a NOP since * nothing is written on the database. * * TODO Actually read on the transaction. Verify that we do not see concurrent * updates. * * TODO Do something similar with read-historical transactions. Verify that * we do not see concurrent updates and that we do not see updates for commit * points after the transaction start (this is nearly the same thing, but we * also should create the read-only tx only once we know that a commit point * has been pinned and that subsequent commits have been applied and verify * that the new tx is also reading from the correct commit point.) */ public void test_CREATE_TX_READ_ONLY_02() throws Exception { assertNotNull(m_mgr); assertNotNull(m_mgr.getTransactionManager()); final IRemoteTx tx = m_mgr.getTransactionManager().createTx( RemoteTransactionManager.READ_COMMITTED); try { } finally { tx.commit(); } assertFalse(tx.isActive()); }
/** * Create an unisolated transaction, verify its metadata, and abort it. */ public void test_CREATE_TX_UNISOLATED_01() throws Exception { assertNotNull(m_mgr); assertNotNull(m_mgr.getTransactionManager()); final IRemoteTx tx = m_mgr.getTransactionManager().createTx( RemoteTransactionManager.UNISOLATED); try { assertTrue(tx.isActive()); assertFalse(tx.isReadOnly()); } finally { tx.abort(); } assertFalse(tx.isActive()); assertFalse(tx.isReadOnly()); }
/** * Create an read-only transaction, verify its metadata, and abort it. */ public void test_CREATE_TX_READ_ONLY_01() throws Exception { assertNotNull(m_mgr); assertNotNull(m_mgr.getTransactionManager()); final IRemoteTx tx = m_mgr.getTransactionManager().createTx( RemoteTransactionManager.READ_COMMITTED); try { assertTrue(tx.isActive()); assertTrue(tx.isReadOnly()); } finally { tx.abort(); } assertFalse(tx.isActive()); assertTrue(tx.isReadOnly()); }
/** * Create an unisolated transaction and commit it. This should be a NOP since * nothing is written on the database. * * TODO Create an unisolated transaction, write on the transaction, commit * the transaction and verify that we can read back the write set after the * commit. Note that we can only write on the resulting transaction if the * namespace supports isolatable indices. */ public void test_CREATE_TX_UNISOLATED_02() throws Exception { assertNotNull(m_mgr); assertNotNull(m_mgr.getTransactionManager()); final IRemoteTx tx = m_mgr.getTransactionManager().createTx( RemoteTransactionManager.UNISOLATED); try { } finally { tx.commit(); } assertFalse(tx.isActive()); }
/** * Create an read-only transaction and commit it. This should be a NOP since * nothing is written on the database. * * TODO Actually read on the transaction. Verify that we do not see concurrent * updates. * * TODO Do something similar with read-historical transactions. Verify that * we do not see concurrent updates and that we do not see updates for commit * points after the transaction start (this is nearly the same thing, but we * also should create the read-only tx only once we know that a commit point * has been pinned and that subsequent commits have been applied and verify * that the new tx is also reading from the correct commit point.) */ public void test_CREATE_TX_READ_ONLY_02() throws Exception { assertNotNull(m_mgr); assertNotNull(m_mgr.getTransactionManager()); final IRemoteTx tx = m_mgr.getTransactionManager().createTx( RemoteTransactionManager.READ_COMMITTED); try { } finally { tx.commit(); } assertFalse(tx.isActive()); }
/** * Create an unisolated transaction, verify its metadata, and abort it. */ public void test_CREATE_TX_UNISOLATED_01() throws Exception { assertNotNull(m_mgr); assertNotNull(m_mgr.getTransactionManager()); final IRemoteTx tx = m_mgr.getTransactionManager().createTx( RemoteTransactionManager.UNISOLATED); try { assertTrue(tx.isActive()); assertFalse(tx.isReadOnly()); } finally { tx.abort(); } assertFalse(tx.isActive()); assertFalse(tx.isReadOnly()); }
/** * Create an read-only transaction, verify its metadata, and abort it. */ public void test_CREATE_TX_READ_ONLY_01() throws Exception { assertNotNull(m_mgr); assertNotNull(m_mgr.getTransactionManager()); final IRemoteTx tx = m_mgr.getTransactionManager().createTx( RemoteTransactionManager.READ_COMMITTED); try { assertTrue(tx.isActive()); assertTrue(tx.isReadOnly()); } finally { tx.abort(); } assertFalse(tx.isActive()); assertTrue(tx.isReadOnly()); }