本文整理汇总了Java中com.heliosapm.utils.jmx.SharedNotificationExecutor类的典型用法代码示例。如果您正苦于以下问题:Java SharedNotificationExecutor类的具体用法?Java SharedNotificationExecutor怎么用?Java SharedNotificationExecutor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SharedNotificationExecutor类属于com.heliosapm.utils.jmx包,在下文中一共展示了SharedNotificationExecutor类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ZooKeepPublisher
import com.heliosapm.utils.jmx.SharedNotificationExecutor; //导入依赖的package包/类
/**
* Creates a new ZooKeepPublisher
*/
public ZooKeepPublisher() {
super(SharedNotificationExecutor.getInstance(), NOTIF_INFOS);
connect = ConfigurationHelper.getSystemThenEnvProperty(CONFIG_CONNECT, DEFAULT_CONNECT);
timeout = ConfigurationHelper.getIntSystemThenEnvProperty(CONFIG_TIMEOUT, DEFAULT_TIMEOUT);
adminUrl = "http://" + hostName() + ":" + ConfigurationHelper.getIntSystemThenEnvProperty(CONFIG_PORT, 7560) + "/streamhubadmin";
//+ ConfigurationHelper.getSystemThenEnvProperty("server.context-path", "/" + ROOT_ADMIN_NODE.replace("/", ""));
log.info("Advertised Admin URL: [{}]", adminUrl);
}
示例2: AgentName
import com.heliosapm.utils.jmx.SharedNotificationExecutor; //导入依赖的package包/类
private AgentName() {
super(SharedNotificationExecutor.getInstance(), NOTIF_INFOS);
forceLowerCase = ConfigurationHelper.getBooleanSystemThenEnvProperty(PROP_FORCE_LOWER_CASE, DEFAULT_FORCE_LOWER_CASE);
shortHostName = ConfigurationHelper.getBooleanSystemThenEnvProperty(PROP_USE_SHORT_HOSTNAMES, DEFAULT_USE_SHORT_HOSTNAMES);
loadExtraTags();
getAppName();
getHostName();
initBufferized();
JMXHelper.registerMBean(this, OBJECT_NAME);
sendInitialNotif();
}
示例3: fireAgentNameChange
import com.heliosapm.utils.jmx.SharedNotificationExecutor; //导入依赖的package包/类
/**
* Fires an AgentName change event
* @param app The new app name, or null if only the host changed
* @param host The new host name, or null if only the app changed
*/
private void fireAgentNameChange(final String app, final String host) {
if(app==null && host==null) return;
Map<String, String> userData = new HashMap<String, String>(2);
String notifType = null;
if(app!=null && host!=null) {
notifType = NOTIF_BOTH_NAME_CHANGE;
userData.put(APP_TAG, app);
userData.put(HOST_TAG, host);
} else {
if(app==null) {
notifType = NOTIF_HOST_NAME_CHANGE;
userData.put(HOST_TAG, host);
} else {
notifType = NOTIF_APP_NAME_CHANGE;
userData.put(APP_TAG, app);
}
}
final Notification n = new Notification(notifType, OBJECT_NAME, notifSerial.incrementAndGet(), System.currentTimeMillis(), "AgentName reset. New Id: [" + appName + "@" + hostName + "]");
n.setUserData(userData);
sendNotification(n);
for(final AgentNameChangeListener listener: listeners) {
SharedNotificationExecutor.getInstance().execute(new Runnable(){
@Override
public void run() {
listener.onAgentNameChange(app, host);
}
});
}
}
示例4: ManagedScript
import com.heliosapm.utils.jmx.SharedNotificationExecutor; //导入依赖的package包/类
/**
* Creates a new ManagedScript
* @param initialBindings Initial bindings required for instantiation
*/
@SuppressWarnings("unchecked")
public ManagedScript(final Map<String, Object> initialBindings) {
super(new Binding(initialBindings==null ? new HashMap<String, Object>() : initialBindings));
springMode = CollectorServer.isSpringMode();
cache = GlobalCacheService.getInstance();
dependencyManager = new DependencyManager<ManagedScript>(this, (Class<ManagedScript>) this.getClass());
executionService = CollectorExecutionService.getInstance();
broadcaster = new NotificationBroadcasterSupport(SharedNotificationExecutor.getInstance(), NOTIF_INFOS);
for(Field f: getClass().getDeclaredFields()) {
fields.put(f.getName(), f);
// final groovy.transform.Field fieldAnn = f.getAnnotation(groovy.transform.Field.class);
final Dependency fieldAnn = f.getAnnotation(Dependency.class);
if(fieldAnn!=null) {
f.setAccessible(true);
}
}
packageSegs = StringHelper.splitString(getClass().getPackage().getName(), '.');
packageElems = packageSegs.length;
packageKey = getClass().getPackage().getName();
regionKey = packageKey.substring(packageKey.indexOf('.')+1);
classKey = getClass().getName();
hystrixEnabled.set(ConfigurationHelper.getBooleanSystemThenEnvProperty(CONFIG_HYSTRIX_ENABLED, DEFAULT_HYSTRIX_ENABLED));
if(hystrixEnabled.get()) {
commandBuilder = HystrixCommandFactory.getInstance().builder(CONFIG_HYSTRIX, packageSegs[0] + packageSegs[1])
.andCommandKey(classKey)
.andThreadPoolKey(regionKey.replace('.', '-'))
.build();
}
}
示例5: shutdown
import com.heliosapm.utils.jmx.SharedNotificationExecutor; //导入依赖的package包/类
/**
* <p>Closes the groovy sql instance and removes all related entries from cache, calls super, then emits a close event</p>
* {@inheritDoc}
* @see com.zaxxer.hikari.HikariDataSource#shutdown()
*/
@Override
public void shutdown() {
try { groovySql.close(); } catch (Exception x) {/* No Op */}
super.shutdown();
for(final DataSourceListener listener: listeners) {
SharedNotificationExecutor.getInstance().execute(new Runnable(){
@Override
public void run() {
listener.onDataSourceStopped(poolName, dsCacheKey, groovydsCacheKey);
}
});
}
listeners.clear();
}
示例6: EndpointListener
import com.heliosapm.utils.jmx.SharedNotificationExecutor; //导入依赖的package包/类
/**
* Creates a new EndpointPubSub
* @param listeners an optional array of endpoint listeners to add
*/
private EndpointListener(final AdvertisedEndpointListener...listeners) {
super(SharedNotificationExecutor.getInstance(), NOTIF_INFOS);
for(AdvertisedEndpointListener listener : listeners) {
instance.addEndpointListener(listener);
}
CloseableService.getInstance().register(this);
log.info("ZK_CONNECT_CONF: [{}]", System.getProperty(ZK_CONNECT_CONF, "undefined"));
zkConnect = ConfigurationHelper.getSystemThenEnvProperty(ZK_CONNECT_CONF, ZK_CONNECT_DEFAULT);
log.info("EndpointListener ZooKeep Connect: [{}]", zkConnect);
serviceType = ConfigurationHelper.getSystemThenEnvProperty(SERVICE_TYPE_CONF, SERVICE_TYPE_DEFAULT);
connectionTimeout = ConfigurationHelper.getIntSystemThenEnvProperty(DISC_CONN_TO_CONF, DISC_CONN_TO_DEFAULT);
sessionTimeout = ConfigurationHelper.getIntSystemThenEnvProperty(DISC_SESS_TO_CONF, DISC_SESS_TO_DEFAULT);
curator = CuratorFrameworkFactory.newClient(zkConnect, sessionTimeout, connectionTimeout, new ExponentialBackoffRetry( 1000, 3 ));
curator.getConnectionStateListenable().addListener(this);
curator.start();
treeCache = TreeCache.newBuilder(curator, serviceType)
.setCacheData(true)
.setCreateParentNodes(true)
.setExecutor(executor)
.setMaxDepth(5)
.build();
treeCache.getListenable().addListener(this, executor);
try {
JMXHelper.registerMBean(OBJECT_NAME, this);
} catch (Exception ex) {
log.warn("Failed to register management interface. Will continue without.", ex);
}
connectClients();
}
示例7: DropWizardMetrics
import com.heliosapm.utils.jmx.SharedNotificationExecutor; //导入依赖的package包/类
/**
* Creates a new DropWizardMetrics
* @param objectName The object name to register this mbean with
* @param description A description for the metric set to be exposed by this mbean
*/
public DropWizardMetrics(final ObjectName objectName, final String description) {
super(DropWizardMetricsMXBean.class, true, new NotificationBroadcasterSupport(SharedNotificationExecutor.getInstance(), notifInfos));
if(objectName==null) throw new IllegalArgumentException("The passed object name was null");
this.objectName = objectName;
this.description = (description==null || description.trim().isEmpty()) ? "DropWizard Metric Set" : description.trim();
}
示例8: fireConnected
import com.heliosapm.utils.jmx.SharedNotificationExecutor; //导入依赖的package包/类
/**
* Fires a connected event if the channel group has at least one channel
* and the current state is disconnected.
*/
protected void fireConnected() {
if(!channels.isEmpty() && !connectionsAvailable.getAndSet(true)) {
for(final ConnectionStateListener listener: connectedStateListeners) {
SharedNotificationExecutor.getInstance().execute(new Runnable(){
@Override
public void run() {
listener.onConnected();
}
});
}
}
}
示例9: fireDisconnected
import com.heliosapm.utils.jmx.SharedNotificationExecutor; //导入依赖的package包/类
/**
* Fires a disconnected event if the channel group is empty
* and the current state is connected.
*/
protected void fireDisconnected() {
if(channels.isEmpty() && connectionsAvailable.getAndSet(false)) {
for(final ConnectionStateListener listener: connectedStateListeners) {
SharedNotificationExecutor.getInstance().execute(new Runnable(){
@Override
public void run() {
listener.onDisconnected(!keepReconnecting.get());
}
});
}
}
}
示例10: AppMetric
import com.heliosapm.utils.jmx.SharedNotificationExecutor; //导入依赖的package包/类
/**
* Creates a new AppMetric
* @param metric The metric
*/
public AppMetric(final Metric metric) {
super(SharedNotificationExecutor.getInstance(), NOTIFS);
if(metric==null) throw new IllegalArgumentException("The passed metric was null");
this.metric = metric;
objectName = this.metric.toObjectName();
lastActivity = System.currentTimeMillis();
}
示例11: GlobalCacheService
import com.heliosapm.utils.jmx.SharedNotificationExecutor; //导入依赖的package包/类
private GlobalCacheService() {
super(SharedNotificationExecutor.getInstance(), NOTIF_INFOS);
JMXHelper.registerMBean(this, objectName);
}
示例12: Blacklist
import com.heliosapm.utils.jmx.SharedNotificationExecutor; //导入依赖的package包/类
private Blacklist() {
super(SharedNotificationExecutor.getInstance(), INFOS);
JMXHelper.registerMBean(this, OBJECT_NAME);
}