Exemplo n.º 1
0
 @SuppressWarnings("unchecked")
 private SlaveContext slaveContextOf(GraphDatabaseService graphDb) {
   XaDataSourceManager dsManager =
       ((AbstractGraphDatabase) graphDb).getConfig().getTxModule().getXaDataSourceManager();
   List<Pair<String, Long>> txs = new ArrayList<Pair<String, Long>>();
   for (XaDataSource ds : dsManager.getAllRegisteredDataSources()) {
     txs.add(Pair.of(ds.getName(), ds.getLastCommittedTxId()));
   }
   return new SlaveContext(0, 0, txs.toArray(new Pair[0]));
 }
Exemplo n.º 2
0
 private void getLastCommittedTxs(GraphDatabaseService graphDb) {
   for (XaDataSource ds :
       ((AbstractGraphDatabase) graphDb)
           .getConfig()
           .getTxModule()
           .getXaDataSourceManager()
           .getAllRegisteredDataSources()) {
     lastCommittedTxs.put(ds.getName(), ds.getLastCommittedTxId());
   }
 }
Exemplo n.º 3
0
 @Test
 public void hasAllXaManagerBeans() {
   for (XaDataSource xaDataSource :
       graphDb.getXaDataSourceManager().getAllRegisteredDataSources()) {
     XaResourceInfo info = getByName(xaDataSource.getName());
     assertEquals(
         "wrong branchid for XA data source " + xaDataSource.getName(),
         XaManagerBean.toHexString(xaDataSource.getBranchId()),
         info.getBranchId());
     assertEquals(
         "wrong log version for XA data source " + xaDataSource.getName(),
         xaDataSource.getCurrentLogVersion(),
         info.getLogVersion());
     assertEquals(
         "wrong last tx ID for XA data source " + xaDataSource.getName(),
         xaDataSource.getLastCommittedTxId(),
         info.getLastTxId());
   }
 }