本文整理汇总了Java中org.apache.camel.spi.ManagementStrategy类的典型用法代码示例。如果您正苦于以下问题:Java ManagementStrategy类的具体用法?Java ManagementStrategy怎么用?Java ManagementStrategy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ManagementStrategy类属于org.apache.camel.spi包,在下文中一共展示了ManagementStrategy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import org.apache.camel.spi.ManagementStrategy; //导入依赖的package包/类
public ManagementStrategy create(CamelContext context, boolean disableJMX) {
ManagementStrategy answer;
if (disableJMX || Boolean.getBoolean(JmxSystemPropertyKeys.DISABLED)) {
answer = new DefaultManagementStrategy(context);
} else {
try {
answer = new ManagedManagementStrategy(context, new DefaultManagementAgent(context));
// must add management lifecycle strategy
context.getLifecycleStrategies().add(0, new DefaultManagementLifecycleStrategy(context));
} catch (Exception e) {
log.warn("Cannot create JMX lifecycle strategy. Will fallback and disable JMX.", e);
answer = new DefaultManagementStrategy(context);
}
}
return answer;
}
示例2: init
import org.apache.camel.spi.ManagementStrategy; //导入依赖的package包/类
public void init(ManagementStrategy strategy) {
super.init(strategy);
this.exchangesCompleted = new Statistic("org.apache.camel.exchangesCompleted", this, Statistic.UpdateMode.COUNTER);
this.exchangesFailed = new Statistic("org.apache.camel.exchangesFailed", this, Statistic.UpdateMode.COUNTER);
this.exchangesInflight = new Statistic("org.apache.camel.exchangesInflight", this, Statistic.UpdateMode.COUNTER);
this.failuresHandled = new Statistic("org.apache.camel.failuresHandled", this, Statistic.UpdateMode.COUNTER);
this.redeliveries = new Statistic("org.apache.camel.redeliveries", this, Statistic.UpdateMode.COUNTER);
this.externalRedeliveries = new Statistic("org.apache.camel.externalRedeliveries", this, Statistic.UpdateMode.COUNTER);
this.minProcessingTime = new Statistic("org.apache.camel.minimumProcessingTime", this, Statistic.UpdateMode.MINIMUM);
this.maxProcessingTime = new Statistic("org.apache.camel.maximumProcessingTime", this, Statistic.UpdateMode.MAXIMUM);
this.totalProcessingTime = new Statistic("org.apache.camel.totalProcessingTime", this, Statistic.UpdateMode.COUNTER);
this.lastProcessingTime = new Statistic("org.apache.camel.lastProcessingTime", this, Statistic.UpdateMode.VALUE);
this.deltaProcessingTime = new Statistic("org.apache.camel.deltaProcessingTime", this, Statistic.UpdateMode.DELTA);
this.meanProcessingTime = new Statistic("org.apache.camel.meanProcessingTime", this, Statistic.UpdateMode.VALUE);
this.firstExchangeCompletedTimestamp = new Statistic("org.apache.camel.firstExchangeCompletedTimestamp", this, Statistic.UpdateMode.VALUE);
this.firstExchangeFailureTimestamp = new Statistic("org.apache.camel.firstExchangeFailureTimestamp", this, Statistic.UpdateMode.VALUE);
this.lastExchangeCompletedTimestamp = new Statistic("org.apache.camel.lastExchangeCompletedTimestamp", this, Statistic.UpdateMode.VALUE);
this.lastExchangeFailureTimestamp = new Statistic("org.apache.camel.lastExchangeFailureTimestamp", this, Statistic.UpdateMode.VALUE);
}
示例3: createCamelContext
import org.apache.camel.spi.ManagementStrategy; //导入依赖的package包/类
protected CamelContext createCamelContext() throws Exception {
CamelContext camelContext = super.createCamelContext();
ShutdownStrategy shutdownStrategy = camelContext.getShutdownStrategy();
camelContext.addComponent("async", new MyAsyncComponent());
shutdownStrategy.setTimeout(1000);
shutdownStrategy.setTimeUnit(TimeUnit.MILLISECONDS);
shutdownStrategy.setShutdownNowOnTimeout(true);
ManagementStrategy managementStrategy = new DefaultManagementStrategy();
managementStrategy.addEventNotifier(en);
camelContext.setManagementStrategy(managementStrategy);
return camelContext;
}
示例4: init
import org.apache.camel.spi.ManagementStrategy; //导入依赖的package包/类
public void init(ManagementStrategy strategy) {
this.exchangesTotal = new Statistic("org.apache.camel.exchangesTotal", this, Statistic.UpdateMode.COUNTER);
this.startTimestamp = new Statistic("org.apache.camel.startTimestamp", this, Statistic.UpdateMode.VALUE);
this.resetTimestamp = new Statistic("org.apache.camel.resetTimestamp", this, Statistic.UpdateMode.VALUE);
startTimestamp.updateValue(new Date().getTime());
resetTimestamp.updateValue(new Date().getTime());
}
示例5: init
import org.apache.camel.spi.ManagementStrategy; //导入依赖的package包/类
@Override
public void init(ManagementStrategy strategy) {
super.init(strategy);
sanitize = strategy.getManagementAgent().getMask() != null ? strategy.getManagementAgent().getMask() : false;
uri = getDefinition().getExpression().getExpression();
if (sanitize) {
uri = URISupport.sanitizeUri(uri);
}
}
示例6: init
import org.apache.camel.spi.ManagementStrategy; //导入依赖的package包/类
public void init(ManagementStrategy strategy) {
super.init(strategy);
boolean sanitize = strategy.getManagementAgent().getMask() != null ? strategy.getManagementAgent().getMask() : false;
if (sanitize) {
destination = URISupport.sanitizeUri(processor.getDestination().getEndpointUri());
} else {
destination = processor.getDestination().getEndpointUri();
}
}
示例7: init
import org.apache.camel.spi.ManagementStrategy; //导入依赖的package包/类
public void init(ManagementStrategy strategy) {
super.init(strategy);
sanitize = strategy.getManagementAgent().getMask() != null ? strategy.getManagementAgent().getMask() : false;
uri = getDefinition().getExpression().getExpression();
if (sanitize) {
uri = URISupport.sanitizeUri(uri);
}
}
示例8: init
import org.apache.camel.spi.ManagementStrategy; //导入依赖的package包/类
@Override
public void init(ManagementStrategy strategy) {
super.init(strategy);
boolean enabled = context.getManagementStrategy().getManagementAgent().getStatisticsLevel() != ManagementStatisticsLevel.Off;
setStatisticsEnabled(enabled);
exchangesInFlightKeys.clear();
exchangesInFlightStartTimestamps.clear();
}
示例9: init
import org.apache.camel.spi.ManagementStrategy; //导入依赖的package包/类
public void init(ManagementStrategy strategy) {
super.init(strategy);
sanitize = strategy.getManagementAgent().getMask() != null ? strategy.getManagementAgent().getMask() : false;
if (sanitize) {
uri = URISupport.sanitizeUri(processor.getUri());
} else {
uri = processor.getUri();
}
}
示例10: init
import org.apache.camel.spi.ManagementStrategy; //导入依赖的package包/类
public void init(ManagementStrategy strategy) {
super.init(strategy);
this.sanitize = strategy.getManagementAgent().getMask() != null ? strategy.getManagementAgent().getMask() : false;
if (sanitize) {
uri = URISupport.sanitizeUri(processor.getUri());
} else {
uri = processor.getUri();
}
}
示例11: notifyCamelContextStarting
import org.apache.camel.spi.ManagementStrategy; //导入依赖的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);
}
}
示例12: notifyCamelContextStarted
import org.apache.camel.spi.ManagementStrategy; //导入依赖的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);
}
}
示例13: notifyCamelContextStartupFailed
import org.apache.camel.spi.ManagementStrategy; //导入依赖的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);
}
}
示例14: notifyCamelContextStopping
import org.apache.camel.spi.ManagementStrategy; //导入依赖的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);
}
}
示例15: notifyCamelContextStopped
import org.apache.camel.spi.ManagementStrategy; //导入依赖的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);
}
}