public class LifecycleUtils extends Object
Modifier and Type | Method and Description |
---|---|
static void |
disposeAllIfNeeded(Collection<? extends Object> objects,
Logger logger)
For each item in the
objects collection, it invokes Disposable.dispose()
if it implements the Disposable interface. |
static void |
disposeIfNeeded(Object object,
Logger logger)
|
static void |
initialiseIfNeeded(Collection<? extends Object> objects)
For each item in the
objects collection, it invokes Initialisable.initialise()
if it implements the Initialisable interface. |
static void |
initialiseIfNeeded(Object object)
|
static void |
initialiseIfNeeded(Object object,
MuleContext muleContext)
The same as
initialiseIfNeeded(Object) , only that before checking
for object being Initialisable , it also checks if it implements
MuleContextAware , in which case it will invoke MuleContextAware.setMuleContext(MuleContext)
with the given muleContext |
static void |
startIfNeeded(Collection<? extends Object> objects)
For each item in the
objects collection, it invokes the the Startable.start()
if it implements the Startable interface. |
static void |
startIfNeeded(Object object)
|
static void |
stopIfNeeded(Collection<? extends Object> objects)
For each item in the
objects collection, it invokes the Stoppable.stop()
if it implements the Stoppable interface. |
static void |
stopIfNeeded(Object object)
|
public static void initialiseIfNeeded(Object object) throws InitialisationException
object
- the object you're trying to initialiseInitialisationException
public static void initialiseIfNeeded(Object object, MuleContext muleContext) throws InitialisationException
initialiseIfNeeded(Object)
, only that before checking
for object
being Initialisable
, it also checks if it implements
MuleContextAware
, in which case it will invoke MuleContextAware.setMuleContext(MuleContext)
with the given muleContext
object
- the object you're trying to initialisemuleContext
- a MuleContext
InitialisationException
public static void initialiseIfNeeded(Collection<? extends Object> objects) throws InitialisationException
objects
collection, it invokes Initialisable.initialise()
if it implements the Initialisable
interface.objects
- the list of objects to be initialisedInitialisationException
public static void startIfNeeded(Object object) throws MuleException
object
- the object you're trying to startMuleException
public static void startIfNeeded(Collection<? extends Object> objects) throws MuleException
objects
collection, it invokes the the Startable.start()
if it implements the Startable
interface.objects
- the list of objects to be startedMuleException
public static void stopIfNeeded(Collection<? extends Object> objects) throws MuleException
objects
collection, it invokes the Stoppable.stop()
if it implements the Stoppable
interface.objects
- the list of objects to be stoppedMuleException
public static void stopIfNeeded(Object object) throws MuleException
object
- the object you're trying to stopMuleException
public static void disposeIfNeeded(Object object, Logger logger)
Disposable.dispose()
on object
if it implements the
Disposable
interface. If the dispose operation fails, then the exception
will be silently logged using the provided logger
object
- the object you're trying to disposepublic static void disposeAllIfNeeded(Collection<? extends Object> objects, Logger logger)
objects
collection, it invokes Disposable.dispose()
if it implements the Disposable
interface.
Per each dispose operation that fails, the exception will be silently logged using the
provided logger
objects
- the list of objects to be stoppedMuleException
Copyright © 2003–2016 MuleSoft, Inc.. All rights reserved.