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

org.babyfish.jimmer.sql.runtime.Cursors Maven / Gradle / Ivy

There is a newer version: 0.9.19
Show newest version
package org.babyfish.jimmer.sql.runtime;

public class Cursors {

    private static final ThreadLocal CURRENT_ID_LOCAL = new ThreadLocal<>();

    private Cursors() {}

    public static Long currentCursorId() {
        return CURRENT_ID_LOCAL.get();
    }

    static Long setCurrentCursorId(Long cursorId) {
        Long oldValue = CURRENT_ID_LOCAL.get();
        if (cursorId != null) {
            CURRENT_ID_LOCAL.set(cursorId);
        } else {
            CURRENT_ID_LOCAL.remove();
        }
        return oldValue;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy