All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.thundra.swark.jdbc.spring.monitoring.DatabaseExecutionInfoGroup Maven / Gradle / Ivy

package io.thundra.swark.jdbc.spring.monitoring;

import io.thundra.swark.monitoring.ExecutionInfoGroup;

import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;

/**
 * @author serkan
 */
public class DatabaseExecutionInfoGroup implements ExecutionInfoGroup {

    public static final String GROUP_NAME = "db";

    AtomicInteger queryCount = new AtomicInteger(0);
    AtomicInteger updateCount = new AtomicInteger(0);
    AtomicInteger errorCount = new AtomicInteger(0);

    AtomicLong queryDuration = new AtomicLong(0L);
    AtomicLong updateDuration = new AtomicLong(0L);

    @Override
    public String getGroupName() {
        return GROUP_NAME;
    }

    public void increaseQueryCount() {
        queryCount.incrementAndGet();
    }

    public void increaseQueryCount(int count) {
        queryCount.addAndGet(count);
    }

    public void increaseUpdateCount() {
        updateCount.incrementAndGet();
    }

    public void increaseUpdateCount(int count) {
        updateCount.addAndGet(count);
    }

    public void increaseErrorCount() {
        errorCount.incrementAndGet();
    }

    public void increaseErrorCount(int count) {
        errorCount.addAndGet(count);
    }

    public void increaseQueryDuration(long durationNanos) {
        queryDuration.addAndGet(durationNanos);
    }

    public void increaseUpdateDuration(long durationNanos) {
        updateDuration.addAndGet(durationNanos);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy