static <O> O createDerivedInstance (URI uri, Class<O> baseClass) throws ClassNotFoundException, InstantiationException, IllegalAccessException { return createDerivedInstance(uri.getScheme(), uri, baseClass); }
public static EncoderFactory getEncoderFactory (URI uri) throws ClassNotFoundException, InstantiationException, IllegalAccessException { synchronized(encodersMap) { EncoderFactory factory=encodersMap.get(uri); if (factory == null) { factory = createEncoderFactory(uri); encodersMap.put(uri, factory); } return factory; } }
public PingCollectionData sendPing (String message) throws IOException { CollectionDataTransport tx=getCollectionDataTransport(); PingCollectionData data=new PingCollectionData(getServerName(), getServerLabel(), message); try { tx.sendCollectedData(data); } catch(RuntimeException e) { throw new IOException("Failed(" + e.getClass().getSimpleName() + ")" + " to send ping=" + message + ": " + e.getMessage()); } return data; }
public CollectionDataTransport getCollectionDataTransport() { DispatcherContext context=DispatcherContext.getInstance(); return context.getCollectionDataTransport(); } };
public String getServerLabel () { synchronized(configLock) { if (serverLabel == null) { ServerName serverName=getServerName(); ResourceProperties props=getDispatcherResourceProperties(); serverLabel = ServerResourceLabelMaker.createServerLabel(serverName, props); } return serverLabel; } }
public ResourceProperties getDispatcherResourceProperties () { synchronized(configLock) { if (serverProps == null) { ServerName serverName=getServerName(); SystemInformation info=getDispatcherSystemInformation(); serverProps = ResourcePropertiesFactory.DEFAULT.createServerPropertiesFromSystemInformation(serverName, info); } return serverProps; } }
public DispatchAgentHeartbeatHelper (InsightAgentConfig config, DispatcherContext context, CollectionSettingsRegistry registry) { super(context.getServerName(), context.getServerLabel(), createInitialRuntimeState(config, context, registry), context.getBuildInfo(), context.getDispatcherResourceProperties(), SensitiveResourcePropertiesFilter.getInstance()); if ((settingsRegistry=registry) == null) { throw new IllegalStateException("No settings registry provided"); } this.props = new LayoutPreservingProperties(ConfigUtils.getInstance().getLocalPropsFile()); }
DispatchConfiguration config=DispatchConfiguration.getInstance(); URI uri=config.getEncoderURI(); encoderFactory = DispatcherContext.getEncoderFactory(uri); setEncoderFactory(encoderFactory); logger.info("afterPropertiesSet(" + mbeanConfig + ") encoder=" + uri); DispatcherContext context=DispatcherContext.getInstance(); CollectionDataTransport transport=context.getCollectionDataTransport();
public static KeyValPair<CollectionDataTransportFactory,EncoderFactory> initializeTransport ( URI transportURI, URI encoderURI) throws ClassNotFoundException, InstantiationException, IllegalAccessException { EncoderFactory encoderFactory=getEncoderFactory(encoderURI); CollectionDataTransportFactory transportFactory=getCollectionDataTransportFactory(transportURI); transportFactory.setEncoderFactory(encoderFactory); return new KeyValPair<CollectionDataTransportFactory,EncoderFactory>(transportFactory, encoderFactory); }
public EncoderFactory getEncoderFactory () throws ClassNotFoundException, InstantiationException, IllegalAccessException { synchronized(encoderURI) { if (factory == null) { factory = DispatcherContext.getEncoderFactory(encoderURI); } return factory; } } /**
createDerivedInstance(comps[0], uri, EncoderFactory.class); encoderFactory.setEncoderURI(uri); for (int index=1; index < comps.length; index++) { EncodingTransformerFactory xformer= createEncodingTransformerFactory(comps[index], uri); xformers.add(xformer); factory = createDerivedInstance(scheme, uri, EncoderFactory.class);
public SystemInformation getDispatcherSystemInformation () { synchronized(configLock) { if (sysInfo == null) { // NOTE !!! order is important sysInfo = new AggregatingSystemInformation( EnvironmentSystemInformation.getInstance(), SystemPropertiesSystemInformation.getInstance(), RuntimeSystemInformation.getInstance(), DefaultContainerInformationProvider.getInstance(), getBasicNetworkSystemInformation(), new MetaSystemInformation(), new DispatchAgentSystemInformation(getInsightVersion())); } return sysInfo; } }
public static final InsightAgentRuntimeState createInitialRuntimeState ( InsightAgentConfig config, DispatcherContext context, CollectionSettingsRegistry registry) { return new InsightAgentRuntimeState() .withMaxTracesSentPerMinute(config.getMaxTracesSentPerMinute()) .withHeartbeatInterval(config.getHeartbeat()) .withSyncPropsBeat(config.getSyncPropsBeat()) .withBuildInfo(context.getBuildInfo()) .withPluginSet(toPluginSet(context.getPluginSet())) .withCollectionSettings(registry.getCollectionSettings()) ; }
public CollectionDataTransport getCollectionDataTransport () { synchronized(transportLock) { if (transport == null) { try { CollectionDataTransportFactory factory=getCollectionDataTransportFactory(); transport = factory.createCollectionDataTransport(); } catch(Exception e) { throw ExceptionUtils.toRuntimeException(e, true); } } return transport; } }
boolean registerForTransportPings () { synchronized(txRegistered) { if (txRegistered.getAndSet(true)) { // are we the first ? return false; } DispatcherContext context=DispatcherContext.getInstance(); CollectionDataTransport transport=context.getCollectionDataTransport(); if (!transport.addCollectionDataTransportListener(this)) { Logger logger=Logger.getLogger(getClass().getName()); logger.warning("Failed to register as transport listener"); txRegistered.set(false); return false; } } return true; }
public CollectionDataTransportFactory getCollectionDataTransportFactory () { synchronized(transportLock) { if (transportFactory == null) { try { transportFactory=getCollectionDataTransportFactory(dispatchConfig.getTransportURI()); transportFactory.setEncoderFactory(getEncoderFactory()); } catch(Exception e) { throw ExceptionUtils.toRuntimeException(e, true); } } return transportFactory; } }
public Encoder getEncoder () { synchronized(encoderLock) { if (encoder == null) { EncoderFactory factory=getEncoderFactory(); encoder = factory.createEncoder(); } return encoder; } }
public BasicNetworkSystemInformation getBasicNetworkSystemInformation () { synchronized(configLock) { if (netInfo == null) { CollectionDataTransportFactory factory=getCollectionDataTransportFactory(); if (factory.isNetworkAware()) { netInfo = new BasicNetworkSystemInformation(factory.getTransportURI()); } else { netInfo = InsightAgentConfigFactory.resolveNetworkSystemInformation(dispatchConfig.getInsightAgentConfig()); } } return netInfo; } }
public Decoder getDecoder () { synchronized(encoderLock) { if (decoder == null) { EncoderFactory factory=getEncoderFactory(); decoder = factory.createDecoder(); } return decoder; } }
public static CollectionDataTransportFactory getCollectionDataTransportFactory (URI uri) throws ClassNotFoundException, InstantiationException, IllegalAccessException { synchronized(transportsMap) { CollectionDataTransportFactory factory=transportsMap.get(uri); if (factory == null) { factory = createDerivedInstance(uri, CollectionDataTransportFactory.class); factory.setTransportURI(uri); transportsMap.put(uri, factory); } return factory; } }