org.mariadb.jdbc.util.ThreadUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mariadb-java-client Show documentation
Show all versions of mariadb-java-client Show documentation
JDBC driver for MariaDB and MySQL
The newest version!
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (c) 2012-2014 Monty Program Ab
// Copyright (c) 2015-2024 MariaDB Corporation Ab
package org.mariadb.jdbc.util;
import java.util.concurrent.Callable;
import javax.security.auth.Subject;
public class ThreadUtils {
public static long getId(Thread thread) {
// must be return thread.threadId() for java 19+,
// but since we support java 8, cannot be removed for now
return thread.getId();
}
public static void callAs(
final Subject subject, final Callable> action)
throws Exception {
Subject.doAs(subject, action.call());
// must be for java 18+, but since we support java 8, cannot be removed for now
// Subject.callAs(subject, action);
}
}