mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
context not needed anymore
This commit is contained in:
@@ -5,8 +5,6 @@ import io.dropwizard.lifecycle.Managed;
|
|||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import javax.naming.Context;
|
|
||||||
import javax.naming.InitialContext;
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import liquibase.Liquibase;
|
import liquibase.Liquibase;
|
||||||
@@ -58,14 +56,12 @@ public class StartupService implements Managed {
|
|||||||
|
|
||||||
private void updateSchema() {
|
private void updateSchema() {
|
||||||
try {
|
try {
|
||||||
Context context = null;
|
|
||||||
Connection connection = null;
|
Connection connection = null;
|
||||||
try {
|
try {
|
||||||
Thread currentThread = Thread.currentThread();
|
Thread currentThread = Thread.currentThread();
|
||||||
ClassLoader classLoader = currentThread.getContextClassLoader();
|
ClassLoader classLoader = currentThread.getContextClassLoader();
|
||||||
ResourceAccessor accessor = new ClassLoaderResourceAccessor(classLoader);
|
ResourceAccessor accessor = new ClassLoaderResourceAccessor(classLoader);
|
||||||
|
|
||||||
context = new InitialContext();
|
|
||||||
DataSource dataSource = getDataSource(sessionFactory);
|
DataSource dataSource = getDataSource(sessionFactory);
|
||||||
connection = dataSource.getConnection();
|
connection = dataSource.getConnection();
|
||||||
JdbcConnection jdbcConnection = new JdbcConnection(connection);
|
JdbcConnection jdbcConnection = new JdbcConnection(connection);
|
||||||
@@ -85,9 +81,6 @@ public class StartupService implements Managed {
|
|||||||
Liquibase liq = new Liquibase("migrations.xml", accessor, database);
|
Liquibase liq = new Liquibase("migrations.xml", accessor, database);
|
||||||
liq.update("prod");
|
liq.update("prod");
|
||||||
} finally {
|
} finally {
|
||||||
if (context != null) {
|
|
||||||
context.close();
|
|
||||||
}
|
|
||||||
if (connection != null) {
|
if (connection != null) {
|
||||||
connection.close();
|
connection.close();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user