public class DefaultMuleContext extends Object implements MuleContext
Modifier and Type | Field and Description |
---|---|
protected SystemExceptionHandler |
exceptionListener
Global exception handler which handles "system" exceptions (i.e., when no message is involved).
|
protected MuleContextLifecycleManager |
lifecycleManager
LifecycleManager for the MuleContext.
|
static String |
LOCAL_OBJECT_STORE_MANAGER_KEY |
static String |
LOCAL_PERSISTENT_OBJECT_STORE_KEY |
static String |
LOCAL_QUEUE_MANAGER_KEY |
static String |
LOCAL_TRANSIENT_OBJECT_STORE_KEY
TODO: Remove these constants.
|
protected LocalMuleClient |
localMuleClient |
protected ServerNotificationManager |
notificationManager |
PHASE_NAME
PHASE_NAME
PHASE_NAME
PHASE_NAME
Constructor and Description |
---|
DefaultMuleContext() |
DefaultMuleContext(MuleConfiguration config,
WorkManager workManager,
javax.resource.spi.work.WorkListener workListener,
MuleContextLifecycleManager lifecycleManager,
ServerNotificationManager notificationManager)
Deprecated.
Use empty constructor instead and use setter for dependencies.
|
Modifier and Type | Method and Description |
---|---|
void |
addRegistry(Registry registry) |
protected SplashScreen |
buildShutdownSplash() |
protected SplashScreen |
buildStartupSplash() |
protected void |
checkLifecycleForPropertySet(String propertyName,
String phase) |
protected DefaultRegistryBroker |
createRegistryBroker() |
protected MuleRegistry |
createRegistryHelper(DefaultRegistryBroker registry) |
void |
dispose()
A lifecycle method where implementor should free up any resources.
|
void |
fireNotification(ServerNotification notification)
Fires a server notification to all registered
CustomNotificationListener notificationManager. |
LocalMuleClient |
getClient() |
String |
getClusterId() |
int |
getClusterNodeId() |
MuleConfiguration |
getConfiguration() |
Map<QName,Set<Object>> |
getConfigurationAnnotations()
Return all annotations seen in the configuration
|
DataTypeConversionResolver |
getDataTypeConverterResolver() |
MessagingExceptionHandler |
getDefaultExceptionStrategy() |
ThreadingProfile |
getDefaultMessageDispatcherThreadingProfile() |
ThreadingProfile |
getDefaultMessageReceiverThreadingProfile() |
ThreadingProfile |
getDefaultMessageRequesterThreadingProfile() |
ThreadingProfile |
getDefaultServiceThreadingProfile() |
ThreadingProfile |
getDefaultThreadingProfile() |
EndpointFactory |
getEndpointFactory()
Returns the EndpointFactory configured for this instance of Mule
|
SystemExceptionHandler |
getExceptionListener() |
ClassLoader |
getExecutionClassLoader() |
ExpressionLanguage |
getExpressionLanguage()
Expression Language for evaluating expressions using Mule as the context
|
ExpressionManager |
getExpressionManager()
Returns the Expression Manager configured for this instance of Mule
|
LifecycleManager |
getLifecycleManager() |
ObjectStoreManager |
getLocalObjectStoreManager()
When running in clustered mode, it returns a
ObjectStoreManager that
creates ObjectStore instances which are only local to the current node. |
QueueManager |
getLocalQueueManager()
When running in clustered mode, it returns a
QueueManager that
creates Queue instances which are only local to the current node. |
LockFactory |
getLockFactory()
Factory for creating locks for synchronizing mule components.
|
ServerNotificationManager |
getNotificationManager() |
ObjectStoreManager |
getObjectStoreManager() |
ProcessingTimeWatcher |
getProcessorTimeWatcher() |
QueueManager |
getQueueManager()
Gets the queue manager used by mule for queuing events.
|
MuleRegistry |
getRegistry() |
SecurityManager |
getSecurityManager()
Gets the security manager used by this Mule instance to authenticate and
authorise incoming and outgoing event traffic and service invocations
|
long |
getStartDate()
Returns the long date when the server was started
|
AllStatistics |
getStatistics()
Gets all statistics for this instance
|
StreamCloserService |
getStreamCloserService()
Returns the configured
StreamCloserService |
SingleResourceTransactionFactoryManager |
getTransactionFactoryManager() |
TransactionManager |
getTransactionManager()
Returns the Jta transaction manager used by this Mule server instance.
|
String |
getUniqueIdString()
Generate a unique ID string; this will begin with the cluster node ID followed by a
dash, e.g.
|
javax.resource.spi.work.WorkListener |
getWorkListener() |
WorkManager |
getWorkManager()
Obtains a workManager instance that can be used to schedule work in a
thread pool.
|
void |
handleException(Exception e) |
void |
handleException(Exception e,
RollbackSourceCallback rollbackMethod) |
void |
initialise()
Method used to perform any initialisation work.
|
boolean |
isDisposed() |
boolean |
isDisposing() |
boolean |
isInitialised()
Determines if the server has been initialised
|
boolean |
isInitialising()
Determines if the server is being initialised
|
boolean |
isPrimaryPollingInstance() |
boolean |
isStarted()
Determines if the server has been started
|
boolean |
isStarting() |
boolean |
isStopped() |
boolean |
isStopping() |
void |
registerListener(ServerNotificationListener l)
Registers an intenal server event listener.
|
void |
registerListener(ServerNotificationListener l,
String resourceIdentifier)
Registers an intenal server event listener.
|
void |
removeRegistry(Registry registry) |
void |
setExceptionListener(SystemExceptionHandler exceptionListener) |
void |
setExecutionClassLoader(ClassLoader cl) |
void |
setExpressionManager(DefaultExpressionManager expressionManager) |
void |
setLifecycleManager(MuleContextLifecycleManager lifecyleManager) |
void |
setLocalMuleClient(DefaultLocalMuleClient localMuleContext) |
void |
setMuleConfiguration(MuleConfiguration muleConfiguration) |
void |
setMuleRegistry(MuleRegistryHelper muleRegistry) |
void |
setNotificationManager(ServerNotificationManager notificationManager) |
void |
setObjectStore(String name,
ListableObjectStore<Serializable> store) |
void |
setPollingController(PollingController pollingController) |
void |
setQueueManager(QueueManager queueManager)
Sets the queue manager used by mule for queuing events.
|
void |
setRegistryBroker(DefaultRegistryBroker registryBroker) |
void |
setSecurityManager(SecurityManager securityManager)
Sets the security manager used by this Mule instance to authenticate and
authorise incoming and outgoing event traffic and service invocations
|
void |
setTransactionManager(TransactionManager manager)
Sets the JTA Transaction Manager to use with this Mule server instance
|
void |
setworkListener(javax.resource.spi.work.WorkListener workListener) |
void |
setWorkManager(WorkManager workManager) |
void |
start() |
void |
stop()
Stops the
MuleContext which stops all sessions and
connectors |
void |
unregisterListener(ServerNotificationListener l)
Unregisters a previously registered listener.
|
boolean |
waitUntilStarted(int timeout)
Makes the caller wait until the
MuleContext was started |
public static final String LOCAL_TRANSIENT_OBJECT_STORE_KEY
public static final String LOCAL_PERSISTENT_OBJECT_STORE_KEY
public static final String LOCAL_OBJECT_STORE_MANAGER_KEY
public static final String LOCAL_QUEUE_MANAGER_KEY
protected MuleContextLifecycleManager lifecycleManager
protected ServerNotificationManager notificationManager
protected LocalMuleClient localMuleClient
protected SystemExceptionHandler exceptionListener
@Deprecated public DefaultMuleContext(MuleConfiguration config, WorkManager workManager, javax.resource.spi.work.WorkListener workListener, MuleContextLifecycleManager lifecycleManager, ServerNotificationManager notificationManager)
public DefaultMuleContext()
protected DefaultRegistryBroker createRegistryBroker()
protected MuleRegistry createRegistryHelper(DefaultRegistryBroker registry)
public void initialise() throws InitialisationException
Initialisable
InitialisationException
should be thrown,
causing the Mule instance to shutdown. If the error is recoverable, say by
retrying to connect, a RecoverableException
should be thrown.
There is no guarantee that by throwing a Recoverable exception that the Mule
instance will not shut down.initialise
in interface Initialisable
InitialisationException
- if a fatal error occurs causing the Mule instance to shutdownRecoverableException
- if an error occurs that can be recovered frompublic void start() throws MuleException
start
in interface Startable
MuleException
public void stop() throws MuleException
MuleContext
which stops all sessions and
connectorsstop
in interface Stoppable
MuleException
- if either any of the sessions or connectors fail to stoppublic void dispose()
Disposable
dispose
in interface Disposable
public boolean isInitialised()
isInitialised
in interface MuleContext
public boolean isInitialising()
isInitialising
in interface MuleContext
public boolean isStopped()
isStopped
in interface MuleContext
public boolean isStopping()
isStopping
in interface MuleContext
public boolean isStarted()
isStarted
in interface MuleContext
public boolean isStarting()
isStarting
in interface MuleContext
public boolean isDisposed()
isDisposed
in interface MuleContext
public boolean isDisposing()
isDisposing
in interface MuleContext
public LifecycleManager getLifecycleManager()
getLifecycleManager
in interface MuleContext
public AllStatistics getStatistics()
getStatistics
in interface MuleContext
public void registerListener(ServerNotificationListener l) throws NotificationException
MuleContext
registerListener
in interface MuleContext
l
- the listener to registerNotificationException
public void registerListener(ServerNotificationListener l, String resourceIdentifier) throws NotificationException
MuleContext
registerListener
in interface MuleContext
l
- the listener to registerresourceIdentifier
- a particular resource name for the given type
of listener For example, the resourceName could be the name of
a service if the listener was a ServiceNotificationListenerNotificationException
public void unregisterListener(ServerNotificationListener l)
MuleContext
unregisterListener
in interface MuleContext
l
- the listener to unregisterpublic void fireNotification(ServerNotification notification)
CustomNotificationListener
notificationManager.fireNotification
in interface MuleContext
notification
- the notification to fire. This must be of type
CustomNotification
otherwise an
exception will be thrown.UnsupportedOperationException
- if the notification fired is not a
CustomNotification
public void setSecurityManager(SecurityManager securityManager) throws RegistrationException
setSecurityManager
in interface MuleContext
securityManager
- the security manager used by this Mule instance to
authenticate and authorise incoming and outgoing event traffic
and service invocationsRegistrationException
public SecurityManager getSecurityManager()
getSecurityManager
in interface MuleContext
public WorkManager getWorkManager()
initialise()
method has been called a default
MuleWorkManager
will be created using the
DefaultThreadingProfile on the MuleConfiguration
object.getWorkManager
in interface MuleContext
ThreadingProfile
,
DefaultMuleConfiguration
public javax.resource.spi.work.WorkListener getWorkListener()
getWorkListener
in interface MuleContext
public QueueManager getQueueManager()
MuleContext
getQueueManager
in interface MuleContext
public ObjectStoreManager getObjectStoreManager()
getObjectStoreManager
in interface MuleContext
public ObjectStoreManager getLocalObjectStoreManager()
ObjectStoreManager
that
creates ObjectStore
instances which are only local to the current node.
This is just a workaround until we introduce a solution for durable persistent stores in HA. This is not part of
Mule's API and you should not use this in your apps or extensionsObjectStoreManager
public QueueManager getLocalQueueManager()
QueueManager
that
creates Queue
instances which are only local to the current node.
This is just a workaround until we introduce a solution for durable persistent queues in HA. This is not part of
Mule's API and you should not use this in your apps or extensionsQueueManager
public void setQueueManager(QueueManager queueManager) throws RegistrationException
MuleContext
setQueueManager
in interface MuleContext
RegistrationException
public MuleConfiguration getConfiguration()
getConfiguration
in interface MuleContext
public ServerNotificationManager getNotificationManager()
getNotificationManager
in interface MuleContext
public void setTransactionManager(TransactionManager manager) throws RegistrationException
setTransactionManager
in interface MuleContext
manager
- the manager to useRegistrationException
- if a transaction manager has already been setpublic TransactionManager getTransactionManager()
getTransactionManager
in interface MuleContext
protected void checkLifecycleForPropertySet(String propertyName, String phase) throws IllegalStateException
IllegalStateException
public MuleRegistry getRegistry()
getRegistry
in interface MuleContext
public ThreadingProfile getDefaultMessageDispatcherThreadingProfile()
getDefaultMessageDispatcherThreadingProfile
in interface MuleContext
public ThreadingProfile getDefaultMessageRequesterThreadingProfile()
getDefaultMessageRequesterThreadingProfile
in interface MuleContext
public ThreadingProfile getDefaultMessageReceiverThreadingProfile()
getDefaultMessageReceiverThreadingProfile
in interface MuleContext
public ThreadingProfile getDefaultServiceThreadingProfile()
getDefaultServiceThreadingProfile
in interface MuleContext
public StreamCloserService getStreamCloserService()
StreamCloserService
getStreamCloserService
in interface MuleContext
StreamCloserService
public ThreadingProfile getDefaultThreadingProfile()
getDefaultThreadingProfile
in interface MuleContext
public long getStartDate()
getStartDate
in interface MuleContext
public ExpressionManager getExpressionManager()
getExpressionManager
in interface MuleContext
ExpressionManager
public void setExecutionClassLoader(ClassLoader cl)
setExecutionClassLoader
in interface MuleContext
public ClassLoader getExecutionClassLoader()
getExecutionClassLoader
in interface MuleContext
public void addRegistry(Registry registry)
addRegistry
in interface MuleContext
public void removeRegistry(Registry registry)
removeRegistry
in interface MuleContext
protected SplashScreen buildStartupSplash()
protected SplashScreen buildShutdownSplash()
public LocalMuleClient getClient()
getClient
in interface MuleContext
public void handleException(Exception e, RollbackSourceCallback rollbackMethod)
handleException
in interface MuleContext
public void handleException(Exception e)
handleException
in interface MuleContext
public SystemExceptionHandler getExceptionListener()
getExceptionListener
in interface MuleContext
public void setExceptionListener(SystemExceptionHandler exceptionListener)
setExceptionListener
in interface MuleContext
public EndpointFactory getEndpointFactory()
MuleContext
getEndpointFactory
in interface MuleContext
EndpointFactory
public void setObjectStore(String name, ListableObjectStore<Serializable> store) throws RegistrationException
setObjectStore
in interface MuleContext
RegistrationException
public String getClusterId()
getClusterId
in interface MuleContext
public int getClusterNodeId()
getClusterNodeId
in interface MuleContext
public void setPollingController(PollingController pollingController)
public boolean isPrimaryPollingInstance()
isPrimaryPollingInstance
in interface MuleContext
public String getUniqueIdString()
MuleContext
getUniqueIdString
in interface MuleContext
public Map<QName,Set<Object>> getConfigurationAnnotations()
MuleContext
getConfigurationAnnotations
in interface MuleContext
public MessagingExceptionHandler getDefaultExceptionStrategy()
getDefaultExceptionStrategy
in interface MuleContext
DefaultMessagingExceptionStrategy
public SingleResourceTransactionFactoryManager getTransactionFactoryManager()
getTransactionFactoryManager
in interface MuleContext
public DataTypeConversionResolver getDataTypeConverterResolver()
getDataTypeConverterResolver
in interface MuleContext
DataTypeConversionResolver
instance to resolve implicit data type conversionspublic ExpressionLanguage getExpressionLanguage()
MuleContext
getExpressionLanguage
in interface MuleContext
public LockFactory getLockFactory()
MuleContext
getLockFactory
in interface MuleContext
public ProcessingTimeWatcher getProcessorTimeWatcher()
getProcessorTimeWatcher
in interface MuleContext
public boolean waitUntilStarted(int timeout) throws InterruptedException
MuleContext
MuleContext
was startedwaitUntilStarted
in interface MuleContext
timeout
- maximum number of milliseconds that will be waitingInterruptedException
- if the current thread is interrupted while waitingpublic void setMuleConfiguration(MuleConfiguration muleConfiguration)
public void setWorkManager(WorkManager workManager)
public void setworkListener(javax.resource.spi.work.WorkListener workListener)
public void setNotificationManager(ServerNotificationManager notificationManager)
public void setLifecycleManager(MuleContextLifecycleManager lifecyleManager)
public void setExpressionManager(DefaultExpressionManager expressionManager)
public void setRegistryBroker(DefaultRegistryBroker registryBroker)
public void setMuleRegistry(MuleRegistryHelper muleRegistry)
public void setLocalMuleClient(DefaultLocalMuleClient localMuleContext)
Copyright © 2003–2015 MuleSoft, Inc.. All rights reserved.