public enum ThreadLocalConnection extends Enum<ThreadLocalConnection>
| Modifier and Type | Class and Description |
|---|---|
static class |
ThreadLocalConnection.GroupedConnection
分组连接,根据不同的分组获取对应的连接,用于多数据源情况
|
| Enum Constant and Description |
|---|
INSTANCE
单例
|
| Modifier and Type | Method and Description |
|---|---|
void |
close(DataSource ds)
关闭数据库,并从线程池中移除
|
Connection |
get(DataSource ds)
获取数据源对应的数据库连接
|
static ThreadLocalConnection |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static ThreadLocalConnection[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final ThreadLocalConnection INSTANCE
public static ThreadLocalConnection[] values()
for (ThreadLocalConnection c : ThreadLocalConnection.values()) System.out.println(c);
public static ThreadLocalConnection valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic Connection get(DataSource ds) throws SQLException
ds - 数据源SQLException - SQL异常public void close(DataSource ds)
ds - 数据源Copyright © 2025. All rights reserved.