Methods Summary |
---|
public java.lang.Object | getCache()
return cache;
|
private java.lang.Object | locateCache(java.lang.String jndiNamespace, java.util.Properties jndiProperties)
Context ctx = null;
try {
ctx = new InitialContext( jndiProperties );
return ctx.lookup( jndiNamespace );
}
catch (NamingException ne) {
String msg = "Unable to retreive Cache from JNDI [" + jndiNamespace + "]";
log.info( msg, ne );
throw new CacheException( msg );
}
finally {
if ( ctx != null ) {
try {
ctx.close();
}
catch( NamingException ne ) {
log.info( "Unable to release initial context", ne );
}
}
}
|
protected void | prepare(java.util.Properties properties)
// Do nothing; subclasses may override.
|
protected void | release()
// Do nothing; subclasses may override.
|
public final void | start(java.util.Properties properties)Callback to perform any necessary initialization of the underlying cache implementation during SessionFactory
construction.
String jndiNamespace = properties.getProperty( Environment.CACHE_NAMESPACE );
if ( StringHelper.isEmpty( jndiNamespace ) ) {
throw new CacheException( "No JNDI namespace specified for cache" );
}
cache = locateCache( jndiNamespace, NamingHelper.getJndiProperties( properties ) );
prepare( properties );
|
public final void | stop()Callback to perform any necessary cleanup of the underlying cache
implementation during SessionFactory.close().
release();
cache = null;
|