mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-10-23 12:19:09 +00:00
Refactor EbeanServerFactory internals - use SpiContainerShutdown interface for container shutdown mechanism
This commit is contained in:
@@ -3,11 +3,12 @@ package io.ebean;
|
||||
import io.ebean.common.SpiContainer;
|
||||
import io.ebean.config.ContainerConfig;
|
||||
import io.ebean.config.ServerConfig;
|
||||
import io.ebeaninternal.server.lib.ShutdownManager;
|
||||
import io.ebean.service.SpiContainerShutdown;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.Properties;
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
/**
|
||||
* Creates EbeanServer instances.
|
||||
@@ -99,7 +100,9 @@ public class EbeanServerFactory {
|
||||
* </p>
|
||||
*/
|
||||
public static synchronized void shutdown() {
|
||||
ShutdownManager.shutdown();
|
||||
for (SpiContainerShutdown shutdown : ServiceLoader.load(SpiContainerShutdown.class)) {
|
||||
shutdown.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package io.ebean.service;
|
||||
|
||||
/**
|
||||
* Provides shutdown of the entire container.
|
||||
*/
|
||||
public interface SpiContainerShutdown {
|
||||
|
||||
/**
|
||||
* Shutdown the entire container - all EbeanServer instances.
|
||||
*/
|
||||
void shutdown();
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package io.ebeaninternal.server.lib;
|
||||
|
||||
import io.ebean.service.SpiContainerShutdown;
|
||||
|
||||
/**
|
||||
* Default container shutdown implementation.
|
||||
*/
|
||||
public class DContainerShutdown implements SpiContainerShutdown {
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
ShutdownManager.shutdown();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
io.ebeaninternal.server.lib.DContainerShutdown
|
||||
@@ -18,7 +18,7 @@
|
||||
from o_order_detail d
|
||||
group by d.order_id;
|
||||
</ddl-script>
|
||||
|
||||
|
||||
<ddl-script name="order views sqlite" platforms="sqlite">
|
||||
drop view if exists order_agg_vw;
|
||||
create view order_agg_vw as
|
||||
@@ -28,7 +28,7 @@
|
||||
group by d.order_id;
|
||||
|
||||
</ddl-script>
|
||||
|
||||
|
||||
<ddl-script name="order views mssql" platforms="sqlserver">
|
||||
IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'order_agg_vw')
|
||||
DROP VIEW order_agg_vw;
|
||||
|
||||
Reference in New Issue
Block a user