Skip to content

Commit d8c4033

Browse files
committed
Refactor rename internal methods only
1 parent d5bc557 commit d8c4033

2 files changed

Lines changed: 7 additions & 10 deletions

File tree

ebean-datasource-api/src/main/java/io/ebean/datasource/DSManager.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package io.ebean.datasource;
22

3-
import java.util.Iterator;
43
import java.util.ServiceLoader;
54

65
/**
@@ -11,11 +10,9 @@ final class DSManager {
1110
private static final DataSourceFactory factory = init();
1211

1312
private static DataSourceFactory init() {
14-
Iterator<DataSourceFactory> loader = ServiceLoader.load(DataSourceFactory.class).iterator();
15-
if (loader.hasNext()) {
16-
return loader.next();
17-
}
18-
throw new IllegalStateException("No service implementation found for DataSourceFactory in the classpath, please add ebean-datasource to the classpath.");
13+
return ServiceLoader.load(DataSourceFactory.class)
14+
.findFirst()
15+
.orElseThrow(() -> new IllegalStateException("No DataSourceFactory, add ebean-datasource to the classpath."));
1916
}
2017

2118
static DataSourceFactory get() {

ebean-datasource-api/src/main/java/io/ebean/datasource/DataSourceConfig.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -884,8 +884,8 @@ private void loadSettings(ConfigPropertiesHelper properties) {
884884
poolListener = properties.get("poolListener", poolListener);
885885
offline = properties.getBoolean("offline", offline);
886886

887-
String isoLevel = properties.get("isolationLevel", getTransactionIsolationLevel(isolationLevel));
888-
this.isolationLevel = getTransactionIsolationLevel(isoLevel);
887+
String isoLevel = properties.get("isolationLevel", isolationLevel(isolationLevel));
888+
this.isolationLevel = isolationLevel(isoLevel);
889889
this.initSql = parseSql(properties.get("initSql", null));
890890
this.failOnStart = properties.getBoolean("failOnStart", failOnStart);
891891

@@ -934,7 +934,7 @@ Map<String, String> parseCustom(String customProperties) {
934934
/**
935935
* Return the isolation level description from the associated Connection int value.
936936
*/
937-
private String getTransactionIsolationLevel(int level) {
937+
private String isolationLevel(int level) {
938938
switch (level) {
939939
case Connection.TRANSACTION_NONE:
940940
return "NONE";
@@ -954,7 +954,7 @@ private String getTransactionIsolationLevel(int level) {
954954
/**
955955
* Return the isolation level for a given string description.
956956
*/
957-
private int getTransactionIsolationLevel(String level) {
957+
private int isolationLevel(String level) {
958958
level = level.toUpperCase();
959959
if (level.startsWith("TRANSACTION")) {
960960
level = level.substring("TRANSACTION".length());

0 commit comments

Comments
 (0)