本文整理匯總了Java中org.apache.camel.spi.EventNotifier類的典型用法代碼示例。如果您正苦於以下問題:Java EventNotifier類的具體用法?Java EventNotifier怎麽用?Java EventNotifier使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
EventNotifier類屬於org.apache.camel.spi包,在下文中一共展示了EventNotifier類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getObjectNameForEventNotifier
import org.apache.camel.spi.EventNotifier; //導入依賴的package包/類
public ObjectName getObjectNameForEventNotifier(CamelContext context, EventNotifier eventNotifier) throws MalformedObjectNameException {
StringBuilder buffer = new StringBuilder();
buffer.append(domainName).append(":");
buffer.append(KEY_CONTEXT + "=").append(getContextId(context)).append(",");
buffer.append(KEY_TYPE + "=" + TYPE_EVENT_NOTIFIER + ",");
if (eventNotifier instanceof JmxNotificationEventNotifier) {
// JMX notifier shall have an easy to use name
buffer.append(KEY_NAME + "=").append("JmxEventNotifier");
} else {
// others can be per instance
buffer.append(KEY_NAME + "=")
.append("EventNotifier")
.append("(").append(ObjectHelper.getIdentityHashCode(eventNotifier)).append(")");
}
return createObjectName(buffer);
}
示例2: doNotifyEvent
import org.apache.camel.spi.EventNotifier; //導入依賴的package包/類
private static void doNotifyEvent(EventNotifier notifier, EventObject event) {
// only notify if notifier is started
boolean started = true;
if (notifier instanceof StatefulService) {
started = ((StatefulService) notifier).isStarted();
}
if (!started) {
LOG.debug("Ignoring notifying event {}. The EventNotifier has not been started yet: {}", event, notifier);
return;
}
if (!notifier.isEnabled(event)) {
LOG.trace("Notifier: {} is not enabled for the event: {}", notifier, event);
return;
}
try {
notifier.notify(event);
} catch (Throwable e) {
LOG.warn("Error notifying event " + event + ". This exception will be ignored. ", e);
}
}
示例3: setServiceDomain
import org.apache.camel.spi.EventNotifier; //導入依賴的package包/類
/**
* Associates camel context with given service domain.
*
* @param domain Domain to associate.
*/
public void setServiceDomain(ServiceDomain domain) {
_domain = domain;
for (EventNotifier notifier : getManagementStrategy().getEventNotifiers()) {
if (notifier instanceof CamelEventBridge) {
((CamelEventBridge) notifier).setEventPublisher(domain.getEventPublisher());
}
}
PackageScanClassResolver packageScanClassResolver = findPackageScanClassResolver();
if (packageScanClassResolver != null) {
setPackageScanClassResolver(packageScanClassResolver);
}
_domain.setProperty(CAMEL_CONTEXT_PROPERTY, this);
}
示例4: doNotifyEvent
import org.apache.camel.spi.EventNotifier; //導入依賴的package包/類
private static void doNotifyEvent(EventNotifier notifier, EventObject event) {
// only notify if notifier is started
boolean started = true;
if (notifier instanceof StatefulService) {
started = ((StatefulService) notifier).isStarted();
}
if (!started) {
Log.debug("Ignoring notifying event {}. The EventNotifier has not been started yet: {}", event, notifier);
return;
}
if (!notifier.isEnabled(event)) {
Log.debug("Notification of event is disabled: {}", event);
return;
}
try {
Log.debug("Event {} arrived to notifier {}", event, notifier.getClass().getName());
notifier.notify(event);
} catch (Throwable e) {
Log.warn("Error notifying event " + event + ". This exception will be ignored. ", e);
}
}
示例5: notify
import org.apache.camel.spi.EventNotifier; //導入依賴的package包/類
public void notify(EventObject event) throws Exception {
if (eventNotifiers != null && !eventNotifiers.isEmpty()) {
for (EventNotifier notifier : eventNotifiers) {
if (notifier.isEnabled(event)) {
notifier.notify(event);
}
}
}
}
示例6: doStartManagementStrategy
import org.apache.camel.spi.EventNotifier; //導入依賴的package包/類
protected void doStartManagementStrategy() throws Exception {
ObjectHelper.notNull(camelContext, "CamelContext");
if (eventNotifiers != null) {
for (EventNotifier notifier : eventNotifiers) {
// inject CamelContext if the service is aware
if (notifier instanceof CamelContextAware) {
CamelContextAware aware = (CamelContextAware) notifier;
aware.setCamelContext(camelContext);
}
ServiceHelper.startService(notifier);
}
}
if (managementAgent != null) {
ServiceHelper.startService(managementAgent);
// set the naming strategy using the domain name from the agent
if (managementNamingStrategy == null) {
setManagementNamingStrategy(new DefaultManagementNamingStrategy(managementAgent.getMBeanObjectDomainName()));
}
}
if (managementNamingStrategy instanceof CamelContextAware) {
((CamelContextAware) managementNamingStrategy).setCamelContext(getCamelContext());
}
}
示例7: ManagedEventNotifier
import org.apache.camel.spi.EventNotifier; //導入依賴的package包/類
public ManagedEventNotifier(CamelContext context, EventNotifier eventNotifier) {
this.context = context;
this.eventNotifier = eventNotifier;
if (eventNotifier instanceof JmxNotificationBroadcasterAware) {
((JmxNotificationBroadcasterAware)eventNotifier).setNotificationBroadcaster(this);
}
}
示例8: notifyCamelContextStarting
import org.apache.camel.spi.EventNotifier; //導入依賴的package包/類
public static void notifyCamelContextStarting(CamelContext context) {
ManagementStrategy management = context.getManagementStrategy();
if (management == null) {
return;
}
List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
for (EventNotifier notifier : notifiers) {
if (notifier.isIgnoreCamelContextEvents()) {
continue;
}
EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
EventObject event = factory.createCamelContextStartingEvent(context);
if (event == null) {
return;
}
doNotifyEvent(notifier, event);
}
}
示例9: notifyCamelContextStarted
import org.apache.camel.spi.EventNotifier; //導入依賴的package包/類
public static void notifyCamelContextStarted(CamelContext context) {
ManagementStrategy management = context.getManagementStrategy();
if (management == null) {
return;
}
List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
for (EventNotifier notifier : notifiers) {
if (notifier.isIgnoreCamelContextEvents()) {
continue;
}
EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
EventObject event = factory.createCamelContextStartedEvent(context);
if (event == null) {
return;
}
doNotifyEvent(notifier, event);
}
}
示例10: notifyCamelContextStartupFailed
import org.apache.camel.spi.EventNotifier; //導入依賴的package包/類
public static void notifyCamelContextStartupFailed(CamelContext context, Throwable cause) {
ManagementStrategy management = context.getManagementStrategy();
if (management == null) {
return;
}
List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
for (EventNotifier notifier : notifiers) {
if (notifier.isIgnoreCamelContextEvents()) {
continue;
}
EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
EventObject event = factory.createCamelContextStartupFailureEvent(context, cause);
if (event == null) {
return;
}
doNotifyEvent(notifier, event);
}
}
示例11: notifyCamelContextStopping
import org.apache.camel.spi.EventNotifier; //導入依賴的package包/類
public static void notifyCamelContextStopping(CamelContext context) {
ManagementStrategy management = context.getManagementStrategy();
if (management == null) {
return;
}
List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
for (EventNotifier notifier : notifiers) {
if (notifier.isIgnoreCamelContextEvents()) {
continue;
}
EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
EventObject event = factory.createCamelContextStoppingEvent(context);
if (event == null) {
return;
}
doNotifyEvent(notifier, event);
}
}
示例12: notifyCamelContextStopped
import org.apache.camel.spi.EventNotifier; //導入依賴的package包/類
public static void notifyCamelContextStopped(CamelContext context) {
ManagementStrategy management = context.getManagementStrategy();
if (management == null) {
return;
}
List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
for (EventNotifier notifier : notifiers) {
if (notifier.isIgnoreCamelContextEvents()) {
continue;
}
EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
EventObject event = factory.createCamelContextStoppedEvent(context);
if (event == null) {
return;
}
doNotifyEvent(notifier, event);
}
}
示例13: notifyCamelContextStopFailed
import org.apache.camel.spi.EventNotifier; //導入依賴的package包/類
public static void notifyCamelContextStopFailed(CamelContext context, Throwable cause) {
ManagementStrategy management = context.getManagementStrategy();
if (management == null) {
return;
}
List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
for (EventNotifier notifier : notifiers) {
if (notifier.isIgnoreCamelContextEvents()) {
continue;
}
EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
EventObject event = factory.createCamelContextStopFailureEvent(context, cause);
if (event == null) {
return;
}
doNotifyEvent(notifier, event);
}
}
示例14: notifyServiceStopFailure
import org.apache.camel.spi.EventNotifier; //導入依賴的package包/類
public static void notifyServiceStopFailure(CamelContext context, Object service, Throwable cause) {
ManagementStrategy management = context.getManagementStrategy();
if (management == null) {
return;
}
List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
for (EventNotifier notifier : notifiers) {
if (notifier.isIgnoreServiceEvents()) {
continue;
}
EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
EventObject event = factory.createServiceStopFailureEvent(context, service, cause);
if (event == null) {
return;
}
doNotifyEvent(notifier, event);
}
}
示例15: notifyServiceStartupFailure
import org.apache.camel.spi.EventNotifier; //導入依賴的package包/類
public static void notifyServiceStartupFailure(CamelContext context, Object service, Throwable cause) {
ManagementStrategy management = context.getManagementStrategy();
if (management == null) {
return;
}
List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
for (EventNotifier notifier : notifiers) {
if (notifier.isIgnoreServiceEvents()) {
continue;
}
EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
EventObject event = factory.createServiceStartupFailureEvent(context, service, cause);
if (event == null) {
return;
}
doNotifyEvent(notifier, event);
}
}