Пример #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]));
 }
Пример #2
0
 private void getLastCommittedTxs(GraphDatabaseService graphDb) {
   for (XaDataSource ds :
       ((AbstractGraphDatabase) graphDb)
           .getConfig()
           .getTxModule()
           .getXaDataSourceManager()
           .getAllRegisteredDataSources()) {
     lastCommittedTxs.put(ds.getName(), ds.getLastCommittedTxId());
   }
 }
Пример #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());
   }
 }