Do not use virtual threads for native calls
This commit is contained in:
parent
72fbd17768
commit
091eda1b50
@ -118,7 +118,8 @@ public class Main {
|
||||
grpcServerBuilder.setClient(connection);
|
||||
|
||||
CountDownLatch shutdownLatch = new CountDownLatch(1);
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(shutdownLatch::countDown));
|
||||
Runtime.getRuntime().addShutdownHook(Thread.ofPlatform()
|
||||
.name("DB shutdown hook").unstarted(shutdownLatch::countDown));
|
||||
|
||||
try (var thrift = thriftServerBuilder.build(); var grpc = grpcServerBuilder.build()) {
|
||||
thrift.start();
|
||||
|
@ -30,7 +30,7 @@ public class TestGrpcLoop {
|
||||
var col = client.getSyncApi().createColumn("test", ColumnSchema.of(IntList.of(15), ObjectList.of(), true));
|
||||
var parallelism = 4;
|
||||
for (int i = 0; i < parallelism; i++) {
|
||||
var t = new Thread(() -> {
|
||||
var t = Thread.ofPlatform().daemon().name("test-requests-thread-" + i).start(() -> {
|
||||
while (true) {
|
||||
try (var arena = Arena.ofConfined()) {
|
||||
var delta = client.getSyncApi().put(arena, 0, col,
|
||||
@ -40,9 +40,6 @@ public class TestGrpcLoop {
|
||||
}
|
||||
}
|
||||
});
|
||||
t.setDaemon(true);
|
||||
t.setName("test-requests-thread-" + i);
|
||||
t.start();
|
||||
if (i + 1 == parallelism) {
|
||||
t.join();
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public class DatabaseTasks implements Closeable {
|
||||
|
||||
public synchronized void start() {
|
||||
if (delayWalFlushConfig.toMillis() > 0) {
|
||||
this.walFlushThread = Thread.ofVirtual().name("db." + db.getName() + ".tasks.wal.flush").start(() -> {
|
||||
this.walFlushThread = Thread.ofPlatform().name("db." + db.getName() + ".tasks.wal.flush").start(() -> {
|
||||
logger.info("Database delayed flush thread is enabled, it will flush the database every %.2f seconds".formatted(delayWalFlushConfig.toMillis() / 1000d));
|
||||
while (!Thread.interrupted()) {
|
||||
try {
|
||||
|
@ -48,9 +48,7 @@ public class ThriftServer extends Server {
|
||||
.processor(new Processor<>(handler))
|
||||
);
|
||||
|
||||
var thriftThread = new Thread(server::serve);
|
||||
thriftThread.setName("Thrift server thread");
|
||||
this.thriftThread = thriftThread;
|
||||
this.thriftThread = Thread.ofPlatform().name("Thrift server thread").unstarted(server::serve);
|
||||
LOG.info("Thrift RocksDB server is listening at " + http2Host + ":" + http2Port);
|
||||
} catch (TTransportException e) {
|
||||
throw new IOException("Can't open server socket", e);
|
||||
|
Loading…
x
Reference in New Issue
Block a user