Tabnine Logo
TimerDataAggregator
Code IndexAdd Tabnine to your IDE (free)

How to use
TimerDataAggregator
in
rocks.inspectit.server.dao.impl

Best Java code snippets using rocks.inspectit.server.dao.impl.TimerDataAggregator (Showing top 10 results out of 315)

origin: inspectIT/inspectIT

/**
 * Tests that after maximum amount of elements is reached we move them to persist list.
 */
@Test
public void maxElementsReached() {
  aggregator.maxElements = 1;
  TimerData timerData1 = new TimerData(new Timestamp(System.currentTimeMillis()), 10L, 20L, 30L);
  TimerData timerData2 = new TimerData(new Timestamp(System.currentTimeMillis()), 100L, 200L, 300L);
  aggregator.processTimerData(timerData1);
  aggregator.processTimerData(timerData2);
  assertThat(aggregator.getElementCount(), is(1));
  verifyZeroInteractions(entityManager);
}
origin: inspectIT/inspectIT

/**
 * {@inheritDoc}
 */
@Override
public void run() {
  while (true) {
    TimerData timerData = this.mostRecentlyAdded;
    if (timerData != null) {
      if (timerData == lastChecked) { // NOPMD
        this.timerDataAggregator.removeAndPersistAll();
      }
      lastChecked = timerData;
    }
    this.timerDataAggregator.saveAllInPersistList();
    try {
      Thread.sleep(this.timerDataAggregator.cacheCleanSleepingPeriod);
    } catch (InterruptedException e) {
      Thread.interrupted();
    }
  }
}
origin: inspectIT/inspectIT

/**
 * Initialize.
 */
@BeforeMethod
public void init() {
  MockitoAnnotations.initMocks(this);
  aggregator = new TimerDataAggregator(transactionManager);
  aggregator.aggregationPeriod = 5l;
  aggregator.cacheCleanSleepingPeriod = 10;
  aggregator.maxElements = 100;
  aggregator.entityManager = entityManager;
}
origin: inspectIT/inspectIT

/**
 * Tests that persist list saving includes correct elements being saved.
 */
@Test
public void saveAllInPersistList() {
  aggregator.maxElements = 1;
  TimerData timerData1 = new TimerData(new Timestamp(System.currentTimeMillis()), 10L, 20L, 30L);
  TimerData timerData2 = new TimerData(new Timestamp(System.currentTimeMillis()), 100L, 200L, 300L);
  aggregator.processTimerData(timerData1);
  aggregator.processTimerData(timerData2);
  aggregator.saveAllInPersistList();
  ArgumentCaptor<DatabaseAggregatedTimerData> argument = ArgumentCaptor.forClass(DatabaseAggregatedTimerData.class);
  verify(entityManager, times(1)).persist(argument.capture());
  assertThat(argument.getValue(), is(instanceOf(DatabaseAggregatedTimerData.class)));
  assertThat(argument.getValue().getPlatformIdent(), is(timerData1.getPlatformIdent()));
  assertThat(argument.getValue().getSensorTypeIdent(), is(timerData1.getSensorTypeIdent()));
  assertThat(argument.getValue().getMethodIdent(), is(timerData1.getMethodIdent()));
}
origin: inspectIT/inspectIT

  aggregator.processTimerData(timerData);
  aggregator.processTimerData(timerData2);
aggregator.removeAndPersistAll();
verify(entityManager, timeout(10000).times(2)).persist(argThat(new ArgumentMatcher<TimerData>() {
  @Override
origin: inspectIT/inspectIT

/**
 * {@inheritDoc}
 */
@Override
protected void processData(DefaultData defaultData, EntityManager entityManager) {
  if (defaultData instanceof HttpTimerData) {
    try {
      HttpTimerData original = (HttpTimerData) defaultData;
      HttpInfo httpInfo = getHttpInfo(original, entityManager);
      HttpTimerData clone = getClone(original);
      clone.setHttpInfo(httpInfo);
      entityManager.persist(clone);
    } catch (SerializationException e) {
      log.warn("TimerDataChartingCmrProcessor failed to clone the given HttpTimerData", e);
    }
  } else {
    timerDataAggregator.processTimerData((TimerData) defaultData);
  }
}
origin: inspectIT/inspectIT

long aggregationTimestamp = getAlteredTimestamp(timerData);
int cacheHash = getCacheHash(timerData.getPlatformIdent(), timerData.getMethodIdent(), aggregationTimestamp);
      TimerData oldest = queue.poll();
      if (null != oldest) {
        map.remove(getCacheHash(oldest.getPlatformIdent(), oldest.getMethodIdent(), oldest.getTimeStamp().getTime()));
        persistList.add(oldest);
        count = elementCount.decrementAndGet();
origin: inspectIT/inspectIT

processor.process(httpTimerData, entityManager);
verify(timerDataAggregator, times(1)).processTimerData(timerData);
origin: inspectIT/inspectIT

/**
 * Tests that if we place many time same amount of elements, maximum will not be reached.
 */
@Test
public void noMaxElementsReached() {
  aggregator.maxElements = 2;
  TimerData timerData1 = new TimerData(new Timestamp(System.currentTimeMillis()), 10L, 20L, 30L);
  TimerData timerData2 = new TimerData(new Timestamp(System.currentTimeMillis()), 100L, 200L, 300L);
  for (int i = 0; i < 100; i++) {
    aggregator.processTimerData(timerData1);
    aggregator.processTimerData(timerData2);
  }
  assertThat(aggregator.getElementCount(), is(2));
  verifyZeroInteractions(entityManager);
}
origin: inspectIT/inspectIT

when(timerData.getMethodIdent()).thenReturn(20L);
aggregator.processTimerData(timerData);
rocks.inspectit.server.dao.implTimerDataAggregator

Javadoc

Aggregator for the TimerData objects that need to be persisted to the DB.

Most used methods

  • processTimerData
    Aggregates the TimerData object and updates the cache. Note that the given object will not be modifi
  • removeAndPersistAll
    Clears the cache and persists all the data inside.
  • saveAllInPersistList
    Persists all objects in the persistence list.
  • <init>
    Default constructor.
  • getAlteredTimestamp
    Returns the value of the time stamp based on a aggregation period.
  • getCacheHash
    Returns the cache hash code.
  • getElementCount
    Gets #elementCount.

Popular in Java

  • Running tasks concurrently on multiple threads
  • setScale (BigDecimal)
  • onCreateOptionsMenu (Activity)
  • addToBackStack (FragmentTransaction)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Option (scala)
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now