}
if ( !( result instanceof ComponentHandler ) )
{
final String message = "Invalid entry in component manager";
throw new ServiceException( role, message );
}
try
{
final ComponentHandler handler = (ComponentHandler) result;
final Object component = handler.get();
// we only have to keep track of components that don't implement
// the ReleasableComponent interface
if ( !(component instanceof ReleasableComponent) )
{
m_used.put( new ComponentKey( component ), handler );
}
return component;
}
catch ( final ServiceException ce )
{
throw ce; // rethrow
}
catch ( final Exception e )
{
final String message =
"Could not return a reference to the Component";
throw new ServiceException( role, message, e );
}
}