Polishing

Issue: SPR-10469
This commit is contained in:
Juergen Hoeller
2013-12-23 21:59:21 +01:00
parent b4d6e27fb3
commit d032c20a54
4 changed files with 62 additions and 19 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 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.
@@ -30,10 +30,11 @@ import org.springframework.util.ClassUtils;
*/
final class H2EmbeddedDatabaseConfigurer extends AbstractEmbeddedDatabaseConfigurer {
private static H2EmbeddedDatabaseConfigurer INSTANCE;
private static H2EmbeddedDatabaseConfigurer instance;
private final Class<? extends Driver> driverClass;
/**
* Get the singleton {@link H2EmbeddedDatabaseConfigurer} instance.
* @return the configurer
@@ -41,13 +42,14 @@ final class H2EmbeddedDatabaseConfigurer extends AbstractEmbeddedDatabaseConfigu
*/
@SuppressWarnings("unchecked")
public static synchronized H2EmbeddedDatabaseConfigurer getInstance() throws ClassNotFoundException {
if (INSTANCE == null) {
INSTANCE = new H2EmbeddedDatabaseConfigurer(
(Class<? extends Driver>) ClassUtils.forName("org.h2.Driver", H2EmbeddedDatabaseConfigurer.class.getClassLoader()));
if (instance == null) {
instance = new H2EmbeddedDatabaseConfigurer( (Class<? extends Driver>)
ClassUtils.forName("org.h2.Driver", H2EmbeddedDatabaseConfigurer.class.getClassLoader()));
}
return INSTANCE;
return instance;
}
private H2EmbeddedDatabaseConfigurer(Class<? extends Driver> driverClass) {
this.driverClass = driverClass;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 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.
@@ -30,10 +30,11 @@ import org.springframework.util.ClassUtils;
*/
final class HsqlEmbeddedDatabaseConfigurer extends AbstractEmbeddedDatabaseConfigurer {
private static HsqlEmbeddedDatabaseConfigurer INSTANCE;
private static HsqlEmbeddedDatabaseConfigurer instance;
private final Class<? extends Driver> driverClass;
/**
* Get the singleton {@link HsqlEmbeddedDatabaseConfigurer} instance.
* @return the configurer
@@ -41,13 +42,14 @@ final class HsqlEmbeddedDatabaseConfigurer extends AbstractEmbeddedDatabaseConfi
*/
@SuppressWarnings("unchecked")
public static synchronized HsqlEmbeddedDatabaseConfigurer getInstance() throws ClassNotFoundException {
if (INSTANCE == null) {
INSTANCE = new HsqlEmbeddedDatabaseConfigurer(
(Class<? extends Driver>) ClassUtils.forName("org.hsqldb.jdbcDriver", HsqlEmbeddedDatabaseConfigurer.class.getClassLoader()));
if (instance == null) {
instance = new HsqlEmbeddedDatabaseConfigurer( (Class<? extends Driver>)
ClassUtils.forName("org.hsqldb.jdbcDriver", HsqlEmbeddedDatabaseConfigurer.class.getClassLoader()));
}
return INSTANCE;
return instance;
}
private HsqlEmbeddedDatabaseConfigurer(Class<? extends Driver> driverClass) {
this.driverClass = driverClass;
}