* @param handlerNameToAdd the name of the handler to add.
*
* @throws OperationFailedException if an error occurs.
*/
public static void addHandler(final OperationContext context, final String asyncHandlerName, final String handlerNameToAdd) throws OperationFailedException {
final ServiceRegistry serviceRegistry = context.getServiceRegistry(true);
@SuppressWarnings("unchecked")
final ServiceController<Handler> asyncHandlerController = (ServiceController<Handler>) serviceRegistry.getService(LogServices.handlerName(asyncHandlerName));
@SuppressWarnings("unchecked")
final ServiceController<Handler> handlerToAssignController = (ServiceController<Handler>) serviceRegistry.getService(LogServices.handlerName(handlerNameToAdd));
if (handlerToAssignController == null) {
throw createFailureMessage(MESSAGES.handlerNotFound(handlerNameToAdd));
}