1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
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 | |
|
26 | |
|
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 | |
} |