@Override public void stop() { if ( connectionProvider instanceof Stoppable ) { ( (Stoppable) connectionProvider ).stop(); } } }
public void release() { if ( connectionProvider instanceof Stoppable ) { ( (Stoppable) connectionProvider ).stop(); } }
@Override public synchronized <R extends Service> void stopService(ServiceBinding<R> binding) { final Service service = binding.getService(); if ( Stoppable.class.isInstance( service ) ) { try { ( (Stoppable) service ).stop(); } catch ( Exception e ) { log.unableToStopService( service.getClass(), e ); } } }
@Override public synchronized <R extends Service> void stopService(ServiceBinding<R> binding) { final Service service = binding.getService(); if ( Stoppable.class.isInstance( service ) ) { try { ( (Stoppable) service ).stop(); } catch ( Exception e ) { LOG.unableToStopService( service.getClass(), e ); } } }
@AfterClassOnce @SuppressWarnings("UnusedDeclaration") private void releaseConnectionProvider() { try { if ( cp instanceof Stoppable ) { ( ( Stoppable ) cp ).stop(); } cp = null; } catch( Throwable ignore ) { } }
@AfterClassOnce public void destroy() { sessionFactory.close(); for ( ConnectionProvider connectionProvider : connectionProviderMap.values() ) { if ( connectionProvider instanceof Stoppable ) { ( (Stoppable) connectionProvider ).stop(); } } }
@AfterClassOnce public void destroy() { sessionFactory.close(); for ( ConnectionProvider connectionProvider : connectionProviderMap.values() ) { if ( connectionProvider instanceof Stoppable ) { ( (Stoppable) connectionProvider ).stop(); } } }
@Test public void testSettingIsolationAsNumericString() throws Exception { Properties properties = Environment.getProperties(); augmentConfigurationSettings( properties ); properties.put( AvailableSettings.ISOLATION, Integer.toString( Connection.TRANSACTION_SERIALIZABLE ) ); ConnectionProvider provider = getConnectionProviderUnderTest(); try { ( (Configurable) provider ).configure( properties ); if ( Startable.class.isInstance( provider ) ) { ( (Startable) provider ).start(); } Connection connection = provider.getConnection(); assertEquals( Connection.TRANSACTION_SERIALIZABLE, connection.getTransactionIsolation() ); provider.closeConnection( connection ); } finally { ( (Stoppable) provider ).stop(); } }
@Test public void testSettingIsolationAsNumeric() throws Exception { Properties properties = Environment.getProperties(); augmentConfigurationSettings( properties ); properties.put( AvailableSettings.ISOLATION, Connection.TRANSACTION_SERIALIZABLE ); ConnectionProvider provider = getConnectionProviderUnderTest(); try { ( (Configurable) provider ).configure( properties ); if ( Startable.class.isInstance( provider ) ) { ( (Startable) provider ).start(); } Connection connection = provider.getConnection(); assertEquals( Connection.TRANSACTION_SERIALIZABLE, connection.getTransactionIsolation() ); provider.closeConnection( connection ); } finally { ( (Stoppable) provider ).stop(); } }
@Test public void testSettingIsolationAsName() throws Exception { Properties properties = Environment.getProperties(); augmentConfigurationSettings( properties ); properties.put( AvailableSettings.ISOLATION, "TRANSACTION_SERIALIZABLE" ); ConnectionProvider provider = getConnectionProviderUnderTest(); try { ( (Configurable) provider ).configure( properties ); if ( Startable.class.isInstance( provider ) ) { ( (Startable) provider ).start(); } Connection connection = provider.getConnection(); assertEquals( Connection.TRANSACTION_SERIALIZABLE, connection.getTransactionIsolation() ); provider.closeConnection( connection ); } finally { ( (Stoppable) provider ).stop(); } }
@Test public void testSettingIsolationAsNameAlt() throws Exception { Properties properties = Environment.getProperties(); augmentConfigurationSettings( properties ); properties.put( AvailableSettings.ISOLATION, "SERIALIZABLE" ); ConnectionProvider provider = getConnectionProviderUnderTest(); try { ( (Configurable) provider ).configure( properties ); if ( Startable.class.isInstance( provider ) ) { ( (Startable) provider ).start(); } Connection connection = provider.getConnection(); assertEquals( Connection.TRANSACTION_SERIALIZABLE, connection.getTransactionIsolation() ); provider.closeConnection( connection ); } finally { ( (Stoppable) provider ).stop(); } } }
public void close() throws HibernateException { if ( actualConnectionProvider instanceof Stoppable ) { ( ( Stoppable ) actualConnectionProvider ).stop(); } }
public void close() throws HibernateException { if ( actualConnectionProvider instanceof Stoppable ) { ((Stoppable) actualConnectionProvider).stop(); } }
@Override public <R extends Service> void stopService(ServiceBinding<R> binding) { final Service service = binding.getService(); if ( Stoppable.class.isInstance( service ) ) { try { ( (Stoppable) service ).stop(); } catch ( Exception e ) { LOG.unableToStopService( service.getClass(), e ); } } }
@Override public <R extends Service> void stopService(ServiceBinding<R> binding) { final Service service = binding.getService(); if ( Stoppable.class.isInstance( service ) ) { try { ( (Stoppable) service ).stop(); } catch ( Exception e ) { LOG.unableToStopService( service.getClass(), e.toString() ); } } } }
@Override public <R extends Service> void stopService(ServiceBinding<R> binding) { final Service service = binding.getService(); if ( Stoppable.class.isInstance( service ) ) { try { ( (Stoppable) service ).stop(); } catch ( Exception e ) { log.unableToStopService( service.getClass(), e ); } } }
@Override public <R extends Service> void stopService(ServiceBinding<R> binding) { final Service service = binding.getService(); if ( Stoppable.class.isInstance( service ) ) { try { ( (Stoppable) service ).stop(); } catch ( Exception e ) { LOG.unableToStopService( service.getClass(), e.toString() ); } } } }
public void close() { metaData = null; if (hibernateSessionFactory != null) { Preconditions.checkState(!hibernateSessionFactory.isClosed()); // close connection provider if possible (http://nuiton.org/issues/2757) ConnectionProvider service = getHibernateService(hibernateSessionFactory, ConnectionProvider.class); if (service instanceof Stoppable) { Stoppable stoppable = (Stoppable) service; stoppable.stop(); } hibernateSessionFactory.close(); } }