Commit 5ccc1438 authored by Matija Obreza's avatar Matija Obreza

AccessionRefs: Trigger re-link earlier

- unit tests were complaining
parent c1c755f1
......@@ -254,7 +254,7 @@ public class DatasetServiceImpl implements DatasetService {
}
long deleted = accessionRefRepository.deleteForDataset(dataset);
System.err.println("Deleted " + deleted + " refs for dataset");
LOG.trace("Deleted {} refs for dataset", deleted);
return addAccessionRefs(dataset, accessionRefs);
}
......@@ -614,33 +614,27 @@ public class DatasetServiceImpl implements DatasetService {
accessionRefRepository.save(dArs);
loadedDataset.setAccessionCount((int) accessionRefRepository.countByDataset(loadedDataset));
LOG.warn("Done saving {} accession refs, have {} in dataset", accessionRefs.size(), loadedDataset.getAccessionCount());
threadPoolTaskExecutor.execute(() -> {
try {
Thread.sleep(2000);
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
// explicitly setting the transaction name is something that can only be done
// programmatically
def.setName("SomeTxName");
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
datasetRepository.save(loadedDataset);
TransactionStatus status = transactionManager.getTransaction(def);
try {
// execute your business logic here
rematchDatasetAccessions(dArs);
} catch (Throwable ex) {
LOG.error("Rolling back rematch. Exception: {}", ex.getMessage(), ex);
transactionManager.rollback(status);
throw ex;
}
transactionManager.commit(status);
threadPoolTaskExecutor.execute(() -> {
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
// explicitly setting the transaction name is something that can only be done
// programmatically
def.setName("SomeTxName");
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
} catch (InterruptedException e) {
LOG.warn("Interrupted rematcher");
TransactionStatus status = transactionManager.getTransaction(def);
try {
// execute your business logic here
rematchDatasetAccessions(dArs);
} catch (Throwable ex) {
LOG.error("Rolling back rematch. Exception: {}", ex.getMessage(), ex);
transactionManager.rollback(status);
throw ex;
}
transactionManager.commit(status);
});
return lazyLoad(datasetRepository.save(loadedDataset));
return lazyLoad(loadedDataset);
}
/**
......
......@@ -366,33 +366,28 @@ public class SubsetServiceImpl implements SubsetService {
accessionRefRepository.save(sArs);
loadedSubset.setAccessionCount((int) accessionRefRepository.countBySubset(loadedSubset));
LOG.warn("Done saving {} accession refs, have {} in subset", accessionRefs.size(), loadedSubset.getAccessionCount());
subsetRepository.save(loadedSubset);
threadPoolTaskExecutor.execute(() -> {
try {
Thread.sleep(2000);
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
// explicitly setting the transaction name is something that can only be done
// programmatically
def.setName("SomeTxName");
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
TransactionStatus status = transactionManager.getTransaction(def);
try {
// execute your business logic here
rematchSubsetAccessions(sArs);
} catch (Throwable ex) {
LOG.error("Rolling back rematch. Exception: {}", ex.getMessage(), ex);
transactionManager.rollback(status);
throw ex;
}
transactionManager.commit(status);
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
// explicitly setting the transaction name is something that can only be done
// programmatically
def.setName("SomeTxName");
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
} catch (InterruptedException e) {
LOG.warn("Interrupted rematcher");
TransactionStatus status = transactionManager.getTransaction(def);
try {
// execute your business logic here
rematchSubsetAccessions(sArs);
} catch (Throwable ex) {
LOG.error("Rolling back rematch. Exception: {}", ex.getMessage(), ex);
transactionManager.rollback(status);
throw ex;
}
transactionManager.commit(status);
});
return lazyLoad(subsetRepository.save(loadedSubset));
return lazyLoad(loadedSubset);
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment