Skip to content

Commit 2925f1b

Browse files
committed
Polish "Simplify retrieval of Narayana XARecoveryModule"
Closes gh-9725
1 parent 3874196 commit 2925f1b

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

spring-boot/src/main/java/org/springframework/boot/jta/narayana/NarayanaRecoveryManagerBean.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2016 the original author or authors.
2+
* Copyright 2012-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -51,17 +51,19 @@ public void destroy() throws Exception {
5151
this.recoveryManagerService.destroy();
5252
}
5353

54-
void registerXAResourceRecoveryHelper(XAResourceRecoveryHelper xaResourceRecoveryHelper) {
54+
void registerXAResourceRecoveryHelper(
55+
XAResourceRecoveryHelper xaResourceRecoveryHelper) {
5556
getXARecoveryModule().addXAResourceRecoveryHelper(xaResourceRecoveryHelper);
5657
}
5758

5859
private XARecoveryModule getXARecoveryModule() {
59-
XARecoveryModule xaRecoveryModule = XARecoveryModule.getRegisteredXARecoveryModule();
60-
if (xaRecoveryModule == null) {
61-
throw new IllegalStateException(
62-
"XARecoveryModule is not registered with recovery manager");
60+
XARecoveryModule xaRecoveryModule = XARecoveryModule
61+
.getRegisteredXARecoveryModule();
62+
if (xaRecoveryModule != null) {
63+
return xaRecoveryModule;
6364
}
64-
return xaRecoveryModule;
65+
throw new IllegalStateException(
66+
"XARecoveryModule is not registered with recovery manager");
6567
}
6668

6769
}

0 commit comments

Comments
 (0)