Polish "Simplify retrieval of Narayana XARecoveryModule"

Closes gh-9725
pull/9893/merge
Andy Wilkinson 7 years ago
parent 3874196efe
commit 2925f1b86a

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -51,17 +51,19 @@ public class NarayanaRecoveryManagerBean implements InitializingBean, Disposable
this.recoveryManagerService.destroy(); this.recoveryManagerService.destroy();
} }
void registerXAResourceRecoveryHelper(XAResourceRecoveryHelper xaResourceRecoveryHelper) { void registerXAResourceRecoveryHelper(
XAResourceRecoveryHelper xaResourceRecoveryHelper) {
getXARecoveryModule().addXAResourceRecoveryHelper(xaResourceRecoveryHelper); getXARecoveryModule().addXAResourceRecoveryHelper(xaResourceRecoveryHelper);
} }
private XARecoveryModule getXARecoveryModule() { private XARecoveryModule getXARecoveryModule() {
XARecoveryModule xaRecoveryModule = XARecoveryModule.getRegisteredXARecoveryModule(); XARecoveryModule xaRecoveryModule = XARecoveryModule
if (xaRecoveryModule == null) { .getRegisteredXARecoveryModule();
throw new IllegalStateException( if (xaRecoveryModule != null) {
"XARecoveryModule is not registered with recovery manager"); return xaRecoveryModule;
} }
return xaRecoveryModule; throw new IllegalStateException(
"XARecoveryModule is not registered with recovery manager");
} }
} }

Loading…
Cancel
Save