test_class.declarator: LOOKUP_THRESHOLD = 10
test_class.modifier: private static final
test_class.original_string: private static final int LOOKUP_THRESHOLD = 10;
test_class.type: int
test_class.var_name: LOOKUP_THRESHOLD
test_class.declarator: logger = Logger.getLogger(SensorPublisherTest.class)
test_class.modifier: private static final
test_class.original_string: private static final Logger logger = Logger.getLogger(SensorPublisherTest.class);
test_class.type: Logger
test_class.var_name: logger
test_class.declarator: NO_ENV_EXC_MSG="missing KLOOPZ_AMQ_PASS env var"
test_class.modifier: private static final
test_class.original_string: private static final String NO_ENV_EXC_MSG="missing KLOOPZ_AMQ_PASS env var";
test_class.type: String
test_class.var_name: NO_ENV_EXC_MSG
test_class.file: daq/daq-collector/src/test/java/com/oneops/daq/jms/SensorPublisherTest.java
test_class.identifier: SensorPublisherTest
test_case.body: @Test(priority=1, expectedExceptions = JMSException.class ,enabled = false)
  	public void testInitWithNoSetup() throws JMSException {
  		// MessageProducer producerMock = mock(MessageProducer.class);
  		// BasicEvent event = new BasicEvent();
  		// event.setBucket("bucket");
  		// event.setChecksum(125791113);
  		// event.setCiId(1L);
  		// event.setManifestId(2L);
  		// event.setSource(this.getClass().getName());
  		//
  		SensorPublisher publisher = new SensorPublisher();
  
  		try {
  			publisher.init();
  		} catch (JMSException e) {
  			logger.info("I expected an exception, and yes I caught it "
  					+ e.getMessage());
  			assertEquals(e.getMessage(),NO_ENV_EXC_MSG);
  			throw e;
  		}
  	}
test_case.class_method_signature: SensorPublisherTest.testInitWithNoSetup()
test_case.full_signature: @Test(priority=1, expectedExceptions = JMSException.class ,enabled = false) public void testInitWithNoSetup()
test_case.identifier: testInitWithNoSetup
test_case.invocations: init info getMessage assertEquals getMessage
test_case.modifiers: @Test(priority=1, expectedExceptions = JMSException.class ,enabled = false) public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testInitWithNoSetup()
focal_class.declarator: logger = Logger.getLogger(SensorPublisher.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = Logger.getLogger(SensorPublisher.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: MINUTE = 60 * 1000
focal_class.modifier: private static final
focal_class.original_string: private static final int MINUTE = 60 * 1000;
focal_class.type: int
focal_class.var_name: MINUTE
focal_class.declarator: user = ActiveMQConnection.DEFAULT_USER
focal_class.modifier: private
focal_class.original_string: private String user = ActiveMQConnection.DEFAULT_USER;
focal_class.type: String
focal_class.var_name: user
focal_class.declarator: password = ActiveMQConnection.DEFAULT_PASSWORD
focal_class.modifier: private
focal_class.original_string: private String password = ActiveMQConnection.DEFAULT_PASSWORD;
focal_class.type: String
focal_class.var_name: password
focal_class.declarator: url = ActiveMQConnection.DEFAULT_BROKER_URL + "?connectionTimeout=1000"
focal_class.modifier: private
focal_class.original_string: private String url = ActiveMQConnection.DEFAULT_BROKER_URL + "?connectionTimeout=1000";
focal_class.type: String
focal_class.var_name: url
focal_class.declarator: queueBase = "perf-in-q"
focal_class.modifier: private
focal_class.original_string: private String queueBase = "perf-in-q";
focal_class.type: String
focal_class.var_name: queueBase
focal_class.declarator: manifestCache = new ConcurrentHashMap<>()
focal_class.modifier: private
focal_class.original_string: private ConcurrentHashMap<Long, Long> manifestCache = new ConcurrentHashMap<>();
focal_class.type: ConcurrentHashMap<Long, Long>
focal_class.var_name: manifestCache
focal_class.declarator: eventCounter = new AtomicLong()
focal_class.modifier: private final
focal_class.original_string: private final AtomicLong eventCounter = new AtomicLong();
focal_class.type: AtomicLong
focal_class.var_name: eventCounter
focal_class.declarator: missingManifestCounter = new AtomicLong()
focal_class.modifier: private final
focal_class.original_string: private final AtomicLong missingManifestCounter = new AtomicLong();
focal_class.type: AtomicLong
focal_class.var_name: missingManifestCounter
focal_class.declarator: failedThresholdLoadCounter = new AtomicLong()
focal_class.modifier: private final
focal_class.original_string: private final AtomicLong failedThresholdLoadCounter = new AtomicLong();
focal_class.type: AtomicLong
focal_class.var_name: failedThresholdLoadCounter
focal_class.declarator: publishedCounter = new AtomicLong()
focal_class.modifier: private final
focal_class.original_string: private final AtomicLong publishedCounter = new AtomicLong();
focal_class.type: AtomicLong
focal_class.var_name: publishedCounter
focal_class.declarator: amqConnectionPoolSize = Integer.parseInt(System.getProperty("daq.amq.connection.pool.size", "8"))
focal_class.modifier: private
focal_class.original_string: private int amqConnectionPoolSize = Integer.parseInt(System.getProperty("daq.amq.connection.pool.size", "8"));
focal_class.type: int
focal_class.var_name: amqConnectionPoolSize
focal_class.declarator: NO_OP_THRESHOLD = new Threshold()
focal_class.modifier: private static final
focal_class.original_string: private static final Threshold NO_OP_THRESHOLD = new Threshold();
focal_class.type: Threshold
focal_class.var_name: NO_OP_THRESHOLD
focal_class.declarator: ttlForNoThresholdCache = Integer.parseInt(System.getProperty("no_threshold_cache_ttl", "2"))
focal_class.modifier: private static
focal_class.original_string: private static int ttlForNoThresholdCache = Integer.parseInt(System.getProperty("no_threshold_cache_ttl", "2"));
focal_class.type: int
focal_class.var_name: ttlForNoThresholdCache
focal_class.declarator: loader = new CacheLoader<String, ThresholdHolderWithExpiration>() {
          @Override
          public ThresholdHolderWithExpiration load(String key) throws Exception {
              String[] keyParts = key.split(":");
              Long manifestId = Long.parseLong(keyParts[0]);
              Threshold threshold = thresholdsDao.getThreshold(manifestId, keyParts[1]);
              logger.debug("loading: " + manifestId.toString() + " " + keyParts[1]);
              if (threshold == null || (threshold.getThresholdJson().equals("n") && !threshold.isHeartbeat())) {
                  return new ThresholdHolderWithExpiration(NO_OP_THRESHOLD, ttlForNoThresholdCache*MINUTE);
              }
              return new ThresholdHolderWithExpiration(threshold);
          }
      }
focal_class.modifier: private
focal_class.original_string: private CacheLoader<String, ThresholdHolderWithExpiration> loader = new CacheLoader<String, ThresholdHolderWithExpiration>() {
          @Override
          public ThresholdHolderWithExpiration load(String key) throws Exception {
              String[] keyParts = key.split(":");
              Long manifestId = Long.parseLong(keyParts[0]);
              Threshold threshold = thresholdsDao.getThreshold(manifestId, keyParts[1]);
              logger.debug("loading: " + manifestId.toString() + " " + keyParts[1]);
              if (threshold == null || (threshold.getThresholdJson().equals("n") && !threshold.isHeartbeat())) {
                  return new ThresholdHolderWithExpiration(NO_OP_THRESHOLD, ttlForNoThresholdCache*MINUTE);
              }
              return new ThresholdHolderWithExpiration(threshold);
          }
      };
focal_class.type: CacheLoader<String, ThresholdHolderWithExpiration>
focal_class.var_name: loader
focal_class.declarator: thresholdTTL = Integer.parseInt(System.getProperty("threshold_cache_ttl", "15"))
focal_class.modifier: private static
focal_class.original_string: private static int thresholdTTL = Integer.parseInt(System.getProperty("threshold_cache_ttl", "15"));
focal_class.type: int
focal_class.var_name: thresholdTTL
focal_class.declarator: mqConnectionTimeout = System.getProperty("mqTimeout", "1000")
focal_class.modifier: private static
focal_class.original_string: private static String mqConnectionTimeout = System.getProperty("mqTimeout", "1000");
focal_class.type: String
focal_class.var_name: mqConnectionTimeout
focal_class.declarator: mqConnectionStartupRetries = System.getProperty("mqStartupRetries", "5")
focal_class.modifier: private static
focal_class.original_string: private static String mqConnectionStartupRetries = System.getProperty("mqStartupRetries", "5");
focal_class.type: String
focal_class.var_name: mqConnectionStartupRetries
focal_class.declarator: mqConnectionThreshold = Integer.parseInt(System.getProperty("mqRetryTimeout", "10000"))
focal_class.modifier: private static
focal_class.original_string: private static int mqConnectionThreshold = Integer.parseInt(System.getProperty("mqRetryTimeout", "10000"));
focal_class.type: int
focal_class.var_name: mqConnectionThreshold
focal_class.declarator: manifestIdLookupThreshold = Long.parseLong(System.getProperty("manifestIdLookupThreshold", "20"))
focal_class.modifier: private static
focal_class.original_string: private static Long manifestIdLookupThreshold = Long.parseLong(System.getProperty("manifestIdLookupThreshold", "20"));
focal_class.type: Long
focal_class.var_name: manifestIdLookupThreshold
focal_class.declarator: lastFailureTimestamp = -1
focal_class.modifier: private
focal_class.original_string: private long lastFailureTimestamp = -1;
focal_class.type: long
focal_class.var_name: lastFailureTimestamp
focal_class.declarator: thresholdCache = CacheBuilder.newBuilder()
              .refreshAfterWrite(thresholdTTL, TimeUnit.MINUTES)
              .build(loader)
focal_class.modifier: private
focal_class.original_string: private LoadingCache<String, ThresholdHolderWithExpiration> thresholdCache = CacheBuilder.newBuilder()
              .refreshAfterWrite(thresholdTTL, TimeUnit.MINUTES)
              .build(loader);
focal_class.type: LoadingCache<String, ThresholdHolderWithExpiration>
focal_class.var_name: thresholdCache
focal_class.declarator: poolsize = Integer.parseInt(System.getProperty("poolsize", "1"))
focal_class.modifier: private static
focal_class.original_string: private static int poolsize = Integer.parseInt(System.getProperty("poolsize", "1"));
focal_class.type: int
focal_class.var_name: poolsize
focal_class.declarator: producers = new JmsTemplate[poolsize]
focal_class.modifier: private
focal_class.original_string: private JmsTemplate[] producers = new JmsTemplate[poolsize];
focal_class.type: JmsTemplate[]
focal_class.var_name: producers
focal_class.declarator: thresholdsDao = null
focal_class.modifier: private
focal_class.original_string: private ThresholdsDao thresholdsDao = null;
focal_class.type: ThresholdsDao
focal_class.var_name: thresholdsDao
focal_class.file: daq/daq-collector/src/main/java/com/oneops/daq/jms/SensorPublisher.java
focal_class.identifier: SensorPublisher
focal_class.class_method_signature: SensorPublisher.setThresholdDao(ThresholdsDao thresholdDao)
focal_class.full_signature: public void setThresholdDao(ThresholdsDao thresholdDao)
focal_class.identifier: setThresholdDao
focal_class.modifiers: public
focal_class.parameters: (ThresholdsDao thresholdDao)
focal_class.return: void
focal_class.signature: void setThresholdDao(ThresholdsDao thresholdDao)
focal_class.class_method_signature: SensorPublisher.showParameters()
focal_class.full_signature: private void showParameters()
focal_class.identifier: showParameters
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void showParameters()
focal_class.class_method_signature: SensorPublisher.init()
focal_class.full_signature: public void init()
focal_class.identifier: init
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void init()
focal_class.class_method_signature: SensorPublisher.enrichAndPublish(PerfEvent event)
focal_class.full_signature: @SuppressWarnings("unused") public void enrichAndPublish(PerfEvent event)
focal_class.identifier: enrichAndPublish
focal_class.modifiers: @SuppressWarnings("unused") public
focal_class.parameters: (PerfEvent event)
focal_class.return: void
focal_class.signature: void enrichAndPublish(PerfEvent event)
focal_class.class_method_signature: SensorPublisher.needToDoALookup(Long counter, Long threshold)
focal_class.full_signature: private boolean needToDoALookup(Long counter, Long threshold)
focal_class.identifier: needToDoALookup
focal_class.modifiers: private
focal_class.parameters: (Long counter, Long threshold)
focal_class.return: boolean
focal_class.signature: boolean needToDoALookup(Long counter, Long threshold)
focal_class.class_method_signature: SensorPublisher.publishMessage(final BasicEvent event)
focal_class.full_signature: public void publishMessage(final BasicEvent event)
focal_class.identifier: publishMessage
focal_class.modifiers: public
focal_class.parameters: (final BasicEvent event)
focal_class.return: void
focal_class.signature: void publishMessage(final BasicEvent event)
focal_class.class_method_signature: SensorPublisher.setProducers(JmsTemplate[] producers)
focal_class.full_signature:  void setProducers(JmsTemplate[] producers)
focal_class.identifier: setProducers
focal_class.parameters: (JmsTemplate[] producers)
focal_class.return: void
focal_class.signature: void setProducers(JmsTemplate[] producers)
focal_class.class_method_signature: SensorPublisher.cleanup()
focal_class.full_signature: public void cleanup()
focal_class.identifier: cleanup
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void cleanup()
focal_class.class_method_signature: SensorPublisher.closeConnection()
focal_class.full_signature: public void closeConnection()
focal_class.identifier: closeConnection
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void closeConnection()
focal_class.class_method_signature: SensorPublisher.getMissingManifestCounter()
focal_class.full_signature: public long getMissingManifestCounter()
focal_class.identifier: getMissingManifestCounter
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long getMissingManifestCounter()
focal_class.class_method_signature: SensorPublisher.getFailedThresholdLoadCounter()
focal_class.full_signature: public long getFailedThresholdLoadCounter()
focal_class.identifier: getFailedThresholdLoadCounter
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long getFailedThresholdLoadCounter()
focal_class.class_method_signature: SensorPublisher.getPublishedCounter()
focal_class.full_signature: public long getPublishedCounter()
focal_class.identifier: getPublishedCounter
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long getPublishedCounter()
focal_method.body: public void init() throws JMSException {
          Properties properties = new Properties();
          try {
              properties.load(this.getClass().getResourceAsStream("/sink.properties"));
          } catch (IOException e) {
              logger.error("got: " + e.getMessage());
          }
  
          user = properties.getProperty("amq.user");
          password = System.getenv("KLOOPZ_AMQ_PASS");
  
  
          if (password == null) {
              throw new JMSException("missing KLOOPZ_AMQ_PASS env var");
          }
  
          AMQConnectorURI connectStringGenerator = new AMQConnectorURI();
          connectStringGenerator.setHost("opsmq");
          connectStringGenerator.setProtocol("tcp");
          connectStringGenerator.setPort(61616);
          connectStringGenerator.setTransport("failover");
          connectStringGenerator.setDnsResolve(true);
          connectStringGenerator.setKeepAlive(true);
          HashMap<String, String> transportOptions = new HashMap<>();
          transportOptions.put("initialReconnectDelay", "1000");
          transportOptions.put("startupMaxReconnectAttempts", mqConnectionStartupRetries);
          transportOptions.put("timeout", mqConnectionTimeout);
          transportOptions.put("useExponentialBackOff", "false");
          connectStringGenerator.setTransportOptions(transportOptions);
          url = connectStringGenerator.build();
  
          showParameters();
  
          // Create the connection.
          ActiveMQConnectionFactory amqConnectionFactory = new ActiveMQConnectionFactory(user, password, url);
          amqConnectionFactory.setUseAsyncSend(true);
          PooledConnectionFactory pooledConnectionFactory = new PooledConnectionFactory(amqConnectionFactory);
          pooledConnectionFactory.setMaxConnections(amqConnectionPoolSize);
          pooledConnectionFactory.setIdleTimeout(10000);
  
          for (int i = 0; i < poolsize; i++) {
              JmsTemplate producerTemplate = new JmsTemplate(pooledConnectionFactory);
              producerTemplate.setSessionTransacted(false);
              int shard = i + 1;
              Destination perfin = new org.apache.activemq.command.ActiveMQQueue(queueBase + "-" + shard);
              producerTemplate.setDefaultDestination(perfin);
              producerTemplate.setDeliveryPersistent(false);
              producers[i] = producerTemplate;
          }
  
  
      }
focal_method.class_method_signature: SensorPublisher.init()
focal_method.full_signature: public void init()
focal_method.identifier: init
focal_method.invocations: load getResourceAsStream getClass error getMessage getProperty getenv setHost setProtocol setPort setTransport setDnsResolve setKeepAlive put put put put setTransportOptions build showParameters setUseAsyncSend setMaxConnections setIdleTimeout setSessionTransacted setDefaultDestination setDeliveryPersistent
focal_method.modifiers: public
focal_method.parameters: ()
focal_method.return: void
focal_method.signature: void init()