[hibernate-dev] Release Connection provider resources

Dmitry Geraskov dgeraskov at exadel.com
Wed Jun 1 04:33:41 EDT 2011


Actually I tried to debug and in my test ConnectionProviderInitiator 
creates an instance of
DriverManagerConnectionProviderImpl which is Stoppable.

And I expected that this code could help me:

if (connectionProvider.isUnwrappableAs(Stoppable.class)){
           Stoppable stoppable = connectionProvider.unwrap(Stoppable.class);
           stoppable.stop();
  }

but condition returns false...

Dmitry

01/06/2011 11:22, Dmitry Geraskov wrote:
> Hey, guys,
>
> in Hibernate 3 you had ConnectionProvider#close() method which releases
> all the resources used by the connection provider.
> In hibernate 4 ConnectionProvider is a service without this method, but
> you have Stoppable interface with stop() method which I guess do this work.
> But the problem is I can't use instanceof to determine whether current
> connection provider is Stoppable, because internally hibernate uses proxyes.
>
> What is right way to replace old ConnectionProvider#close()?
>
> Dmitry Geraskov
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev



More information about the hibernate-dev mailing list