1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
package org.mule.lifecycle.phases; |
11 | |
|
12 | |
import org.mule.api.MuleContext; |
13 | |
import org.mule.api.agent.Agent; |
14 | |
import org.mule.api.lifecycle.Disposable; |
15 | |
import org.mule.api.lifecycle.Initialisable; |
16 | |
import org.mule.api.lifecycle.LifecyclePhase; |
17 | |
import org.mule.api.model.Model; |
18 | |
import org.mule.api.registry.Registry; |
19 | |
import org.mule.api.transport.Connector; |
20 | |
import org.mule.context.notification.MuleContextNotification; |
21 | |
import org.mule.lifecycle.DefaultLifecyclePhase; |
22 | |
import org.mule.lifecycle.NotificationLifecycleObject; |
23 | |
|
24 | |
import java.util.LinkedHashSet; |
25 | |
import java.util.Set; |
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
public class TransientRegistryDisposePhase extends DefaultLifecyclePhase |
38 | |
{ |
39 | |
public TransientRegistryDisposePhase() |
40 | |
{ |
41 | 1160 | this(new Class[]{Registry.class}); |
42 | 1160 | } |
43 | |
|
44 | |
public TransientRegistryDisposePhase(Class[] ignorredObjects) |
45 | |
{ |
46 | 1160 | super(Disposable.PHASE_NAME, Disposable.class, Initialisable.PHASE_NAME); |
47 | |
|
48 | 1160 | Set disposeOrderedObjects = new LinkedHashSet(); |
49 | |
|
50 | |
|
51 | |
|
52 | 1160 | disposeOrderedObjects.add(new NotificationLifecycleObject(MuleContext.class)); |
53 | 1160 | disposeOrderedObjects.add(new NotificationLifecycleObject(Connector.class, MuleContextNotification.class, |
54 | |
MuleContextNotification.CONTEXT_DISPOSING_CONNECTORS,MuleContextNotification.CONTEXT_DISPOSED_CONNECTORS)); |
55 | 1160 | disposeOrderedObjects.add(new NotificationLifecycleObject(Agent.class)); |
56 | 1160 | disposeOrderedObjects.add(new NotificationLifecycleObject(Model.class)); |
57 | 1160 | disposeOrderedObjects.add(new NotificationLifecycleObject(Disposable.class)); |
58 | |
|
59 | 1160 | setIgnoredObjectTypes(ignorredObjects); |
60 | 1160 | setOrderedLifecycleObjects(disposeOrderedObjects); |
61 | 1160 | registerSupportedPhase(LifecyclePhase.ALL_PHASES); |
62 | 1160 | } |
63 | |
} |