public void remove( Object resourceId )
throws ResourceUnknownException,
ResourceException
{
Resource resource = null;
Lock lock = acquireLock( resourceId );
try
{
resource = get( resourceId );
try
{
resource.destroy( );
}
catch ( RuntimeException re )
{
throw new ResourceException( MSG.getMessage( Keys.FAILED_TO_DESTROY_RESOURCE, resource, re ) );
}
Resource removedResource = (Resource) m_resources.remove( getNonNullKey( resourceId ) );
if ( removedResource instanceof PropertiesResource )
{
notifyResourceDeletedListeners( removedResource );
}
LOG.debug( MSG.getMessage( Keys.REMOVED_RESOURCE_WITH_KEY,
resource.getClass( ).getName( ),
String.valueOf( resourceId ) ) );
if ( m_cache != null )
{
m_cache.remove( resource );
}
}
finally
{
lock.release( );
}
}