Coverage Report - org.mule.lifecycle.processor.ProcessIfStartedWaitIfSyncPausedMessageProcessor
 
Classes in this File Line Coverage Branch Coverage Complexity
ProcessIfStartedWaitIfSyncPausedMessageProcessor
0%
0/13
0%
0/10
0
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.lifecycle.processor;
 8  
 
 9  
 import org.mule.api.MessagingException;
 10  
 import org.mule.api.MuleEvent;
 11  
 import org.mule.api.MuleException;
 12  
 import org.mule.api.lifecycle.LifecycleState;
 13  
 import org.mule.api.lifecycle.Startable;
 14  
 import org.mule.config.i18n.CoreMessages;
 15  
 
 16  
 public class ProcessIfStartedWaitIfSyncPausedMessageProcessor extends
 17  
     ProcessIfStartedWaitIfPausedMessageProcessor
 18  
 {
 19  
 
 20  
     public ProcessIfStartedWaitIfSyncPausedMessageProcessor(Startable startable, LifecycleState lifecycleState)
 21  
     {
 22  0
         super(startable, lifecycleState);
 23  0
     }
 24  
 
 25  
     // TODO DF This needs refactoring. This is to ensure processNext()
 26  
     // is used and not next.process()
 27  
     @Override
 28  
     public MuleEvent process(MuleEvent event) throws MuleException
 29  
     {
 30  0
         if (accept(event))
 31  
         {
 32  0
             if (isPaused() && event.getEndpoint().getExchangePattern().hasResponse())
 33  
             {
 34  
                 try
 35  
                 {
 36  0
                     if (logger.isDebugEnabled())
 37  
                     {
 38  0
                         logger.debug(startable.getClass().getName() + " " + getStartableName(startable)
 39  
                                      + " is paused. Blocking call until resumd");
 40  
                     }
 41  0
                     while (isPaused())
 42  
                     {
 43  0
                         Thread.sleep(500);
 44  
                     }
 45  
                 }
 46  0
                 catch (InterruptedException e)
 47  
                 {
 48  0
                     throw new MessagingException(
 49  
                         CoreMessages.interruptedWaitingForPaused(getStartableName(startable)), event, e);
 50  0
                 }
 51  
             }
 52  0
             return processNext(event);
 53  
         }
 54  
         else
 55  
         {
 56  0
             return handleUnaccepted(event);
 57  
         }
 58  
     }
 59  
 }