public DelegatedCollectorPathTrackingDataStore() { this.delegatedPathTrackingDataStore = IoCs.findOrCreateInstance( PathTrackingDataStore.class ); }
public CubeDisruptorDataStoreFactory() { super( IoCs.processInstance(new CubeCounterDataStore()), IoCs.processInstance(new CubeGaugeDataStore()), IoCs.processInstance(new CubeNodeStatusDataStore()), IoCs.findOrCreateInstance( DisruptorPathTrackingDataStore.class )); // IoCs.processInstance(new DisruptorPathTrackingDataStore()) } }
public static <T> T autoSet(final T instance) throws Exception { return autoSet(null, instance); }
public static boolean isCollector() { IoCs.findOrCreateInstance(Repository.class); // ensure we have a repo which init store classes by default return IoCs.getInstance(CollectorCounterStore.class) != null; } }
public DefaultDataStoreFactory() { super( IoCs.processInstance( new InMemoryCounterDataStore() ), // IoCs.processInstance(new InMemoryGaugeDataStore()), // IoCs.processInstance(new PeriodicNodeStatusDataStore()), // IoCs.processInstance( new InMemoryPathTrackingDataStore() )); } }
@Override public void contextDestroyed(final ServletContextEvent sce) { IoCs.shutdown(); } }
public CubeDataStoreFactory() { super( IoCs.processInstance(new CubeCounterDataStore()), IoCs.processInstance(new CubeGaugeDataStore()), IoCs.processInstance(new CubeNodeStatusDataStore()), IoCs.processInstance(new CubePathTrackingDataStore())); } }
@Override public void run() { shutdown(); } };
protected static NodeStatusDataStore findStatusDataStore() { NodeStatusDataStore status = null; try { status = IoCs.findOrCreateInstance(NodeStatusDataStore.class); } catch (final SironaException e) { // no-op } if (status == null) { status = IoCs.findOrCreateInstance(DataStoreFactory.class).getNodeStatusDataStore(); } return status; }
public CassandraCollectorDataStoreFactory() { super( IoCs.processInstance(new CassandraCollectorCounterDataStore()), IoCs.processInstance(new CassandraCollectorGaugeDataStore()), IoCs.processInstance(new CassandraCollectorNodeStatusDataStore()), IoCs.processInstance(new CassandraPathTrackingDataStore())); } }
public static <T> T autoSet(final String key, final T instance) throws Exception { return autoSet(key, instance, instance.getClass()); }
protected static CommonGaugeDataStore findGaugeDataStore() { CommonGaugeDataStore gauge = null; try { gauge = IoCs.findOrCreateInstance(GaugeDataStore.class); } catch (final SironaException e) { // no-op } if (gauge == null) { try { gauge = IoCs.findOrCreateInstance(CollectorGaugeDataStore.class); } catch (final SironaException e) { // no-op } } if (gauge == null) { gauge = IoCs.findOrCreateInstance(DataStoreFactory.class).getGaugeDataStore(); } return gauge; }
public CassandraAgentDataStoreFactory() { super( IoCs.processInstance(new CassandraCounterDataStore()), IoCs.processInstance(new CassandraGaugeDataStore()), IoCs.processInstance(new CassandraStatusDataStore()), IoCs.processInstance(new CassandraPathTrackingDataStore())); } }
protected static Collection<AlertListener> findAlerters() { final Collection<AlertListener> listeners = new ArrayList<AlertListener>(); final String alerters = Configuration.getProperty(Configuration.CONFIG_PROPERTY_PREFIX + "alerters", null); if (alerters != null && alerters.trim().length() > 0) { for (final String alert : alerters.split(" *, *")) { final String classKey = alert + ".class"; final String type = Configuration.getProperty(classKey, null); if (type == null) { throw new IllegalArgumentException("Missing configuration " + classKey); } try { final Class<?> clazz = ClassLoaders.current().loadClass(type); final AlertListener listener = IoCs.autoSet(alert, AlertListener.class.cast(clazz.newInstance())); listeners.add(listener); } catch (final Exception e) { throw new IllegalArgumentException(e); } } } return listeners; }
protected static CounterDataStore findCounterDataStore() { CounterDataStore counter = null; try { counter = IoCs.findOrCreateInstance(CounterDataStore.class); } catch (final SironaException e) { // no-op } if (counter == null) { try { counter = IoCs.findOrCreateInstance(CollectorCounterStore.class); } catch (final SironaException e) { // no-op } } if (counter == null) { counter = IoCs.findOrCreateInstance(DataStoreFactory.class).getCounterDataStore(); } return counter; }
private static <T> T internalProcessInstance(final T instance) throws Exception { final Class<?> loadedClass = instance.getClass(); // autoset before invoking @Created if (loadedClass.getAnnotation(AutoSet.class) != null) { autoSet(null, instance, loadedClass); } Class<?> clazz = loadedClass; while (clazz != null && !Object.class.equals(clazz)) { for (final Method m : clazz.getDeclaredMethods()) { if (m.getAnnotation(Created.class) != null) { m.setAccessible(true); m.invoke(instance); } else if (m.getAnnotation(Destroying.class) != null) { m.setAccessible(true); if (shutdownHook == null == Configuration.is(Configuration.CONFIG_PROPERTY_PREFIX + "shutdown.hook", true)) { shutdownHook = new Thread() { @Override public void run() { shutdown(); } }; Runtime.getRuntime().addShutdownHook(shutdownHook); } INSTANCES.add(new ToDestroy(m, instance)); } } clazz = clazz.getSuperclass(); } return instance; }
protected static PathTrackingDataStore findPathTrackingDataStore() { PathTrackingDataStore pathTrackingDataStore = null; try { pathTrackingDataStore = IoCs.findOrCreateInstance(PathTrackingDataStore.class); } catch (final SironaException e) { // no-op } /** FIXME define/implement CollectorPathTrackingDataStore if (pathTrackingDataStore == null) { try { pathTrackingDataStore = IoCs.findOrCreateInstance(CollectorPathTrackingDataStore.class); } catch (final SironaException e) { // no-op } } */ if (pathTrackingDataStore == null) { pathTrackingDataStore = IoCs.findOrCreateInstance(DataStoreFactory.class).getPathTrackingDataStore(); } return pathTrackingDataStore; }
public static <T> T monitor(final Class<T> clazz, final Object instance) { return clazz.cast( IoCs.findOrCreateInstance(ProxyFactory.class) .createInvokerProxy(ClassLoaders.current(), new SironaPerformanceHandler(instance), new Class<?>[]{clazz})); }
public CassandraCollectorGaugeDataStore() { this.cassandra = IoCs.findOrCreateInstance(CassandraSirona.class); this.keyspace = cassandra.getKeyspace(); this.valueFamily = cassandra.getGaugeValuesColumnFamily(); this.markerFamily = cassandra.getMarkerGaugesColumFamily(); }