HHH-5943 - Make ServiceRegistry mutable
This commit is contained in:
parent
11d32ba69c
commit
72a94161e2
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2007-2011, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -89,10 +89,18 @@ public class C3P0ConnectionProvider implements ConnectionProvider {
|
||||||
conn.close();
|
conn.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUnwrappableAs(Class unwrapType) {
|
||||||
|
return ConnectionProvider.class.equals( unwrapType ) ||
|
||||||
|
C3P0ConnectionProvider.class.isAssignableFrom( unwrapType ) ||
|
||||||
|
DataSource.class.isAssignableFrom( unwrapType );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings( {"unchecked"})
|
@SuppressWarnings( {"unchecked"})
|
||||||
public <T> T unwrap(Class<T> unwrapType) {
|
public <T> T unwrap(Class<T> unwrapType) {
|
||||||
if ( ConnectionProvider.class.isAssignableFrom( unwrapType ) ) {
|
if ( ConnectionProvider.class.equals( unwrapType ) ||
|
||||||
|
C3P0ConnectionProvider.class.isAssignableFrom( unwrapType ) ) {
|
||||||
return (T) this;
|
return (T) this;
|
||||||
}
|
}
|
||||||
else if ( DataSource.class.isAssignableFrom( unwrapType ) ) {
|
else if ( DataSource.class.isAssignableFrom( unwrapType ) ) {
|
||||||
|
|
Loading…
Reference in New Issue