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

net.ttddyy.dsproxy.proxy.DefaultConnectionIdManager Maven / Gradle / Ivy

There is a newer version: 1.10
Show newest version
package net.ttddyy.dsproxy.proxy;

import net.ttddyy.dsproxy.ConnectionIdManager;

import java.sql.Connection;
import java.util.concurrent.atomic.AtomicLong;

/**
 * Default implementation of {@link ConnectionIdManager}.
 *
 * This implementation returns sequentially increasing unique number as connection id.
 *
 * @author Tadaya Tsuyukubo
 * @since 1.4.2
 */
public class DefaultConnectionIdManager implements ConnectionIdManager {

    private AtomicLong idCounter = new AtomicLong(0);

    @Override
    public long getId(Connection connection) {
        return this.idCounter.incrementAndGet();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy