Minor fixes
This commit is contained in:
parent
024ddef803
commit
3f75db556c
@ -5,15 +5,10 @@ val someStmt = PreparedStatementsCompilationPhantomCache("SELECT * FROM sqlite_m
|
||||
|
||||
fun main() {
|
||||
for (i in 0..1000) {
|
||||
DriverManager.getConnection("jdbc:sqlite::memory:").use { connection ->
|
||||
someStmt.preparedStatementForConnection(connection).use { ps ->
|
||||
ps.executeQuery().use { rs ->
|
||||
while (rs.next()) {
|
||||
println(rs.getString(0))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
val connection = DriverManager.getConnection("jdbc:sqlite::memory:")
|
||||
val ps = someStmt.preparedStatementForConnection(connection)
|
||||
val rs = ps.executeQuery();
|
||||
connection.close()
|
||||
System.gc()
|
||||
}
|
||||
}
|
@ -26,7 +26,8 @@ class _PhantomCacheCleanup {
|
||||
|
||||
@NotNull
|
||||
private static Thread _createThread() {
|
||||
if (_PhantomCacheCleanup._isVirtualThreadsSupported() && !System.getProperty(_PhantomCacheCleanup._virtualThreadProperty).equalsIgnoreCase("false")) {
|
||||
final String useVirtualSetting = System.getProperty(_PhantomCacheCleanup._virtualThreadProperty);
|
||||
if (_PhantomCacheCleanup._isVirtualThreadsSupported() && (useVirtualSetting != null && !useVirtualSetting.equalsIgnoreCase("false"))) {
|
||||
return _PhantomCacheCleanup._startVirtualThread();
|
||||
} else {
|
||||
return _PhantomCacheCleanup._startVirtualThread();
|
||||
@ -58,7 +59,7 @@ class _PhantomCacheCleanup {
|
||||
|
||||
@NotNull
|
||||
private static Thread _startVirtualThread() {
|
||||
final var b = Thread.ofVirtual();
|
||||
final Thread.Builder.OfVirtual b = Thread.ofVirtual();
|
||||
b.name(_PhantomCacheCleanup._threadName);
|
||||
b.inheritInheritableThreadLocals(false);
|
||||
return b.start(new CleanupRoutine());
|
||||
@ -72,7 +73,10 @@ class _PhantomCacheCleanup {
|
||||
// (Thread.currentThread() as? InnocuousThread)?.eraseThreadLocals()
|
||||
|
||||
try {
|
||||
((CleanablePhantomReference<?>) _PhantomCacheCleanup._referenceQueue.remove(60 * 60)).cleanup();
|
||||
final CleanablePhantomReference<?> cleanableRef = ((CleanablePhantomReference<?>) _PhantomCacheCleanup._referenceQueue.remove(60 * 60));
|
||||
if (cleanableRef == null)
|
||||
continue;
|
||||
cleanableRef.cleanup();
|
||||
} /* catch (_: LinkageError) {
|
||||
return
|
||||
} */ catch (InterruptedException e) {
|
||||
|
Reference in New Issue
Block a user