Polish "Simplify retrieval of Narayana XARecoveryModule"

Closes gh-9725
This commit is contained in:
Andy Wilkinson 2017-07-28 07:31:32 +01:00
parent 3874196efe
commit 2925f1b86a
1 changed files with 9 additions and 7 deletions

View File

@ -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");
* 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();
}
void registerXAResourceRecoveryHelper(XAResourceRecoveryHelper xaResourceRecoveryHelper) {
void registerXAResourceRecoveryHelper(
XAResourceRecoveryHelper xaResourceRecoveryHelper) {
getXARecoveryModule().addXAResourceRecoveryHelper(xaResourceRecoveryHelper);
}
private XARecoveryModule getXARecoveryModule() {
XARecoveryModule xaRecoveryModule = XARecoveryModule.getRegisteredXARecoveryModule();
if (xaRecoveryModule == null) {
throw new IllegalStateException(
"XARecoveryModule is not registered with recovery manager");
XARecoveryModule xaRecoveryModule = XARecoveryModule
.getRegisteredXARecoveryModule();
if (xaRecoveryModule != null) {
return xaRecoveryModule;
}
return xaRecoveryModule;
throw new IllegalStateException(
"XARecoveryModule is not registered with recovery manager");
}
}