Create millions of lightweight virtual threads instead of heavy OS threads.
Porównanie kodu
✕ Java 8
Thread thread = new Thread(() -> {
System.out.println("hello");
});
thread.start();
thread.join();
✓ Java 21+
Thread.startVirtualThread(() -> {
IO.println("hello");
}).join();
Widzisz problem z tym kodem? Daj nam znać.
Dlaczego nowoczesne podejście wygrywa
Lightweight
Virtual threads use KB of memory, platform threads use MB.
Scalable
Create millions of threads — no pool sizing needed.
Simple model
Write blocking code that scales like async code.
Stare podejście
Platform Threads
Nowoczesne podejście
Virtual Threads
Od JDK
21
Poziom trudności
Początkujący
Wsparcie JDK
Virtual threads
Dostępne
Widely available since JDK 21 LTS (Sept 2023)
Jak to działa
Virtual threads are lightweight threads managed by the JVM, not the OS. You can create millions of them without tuning thread pools. They're ideal for I/O-bound tasks like HTTP calls and database queries.
Powiązana dokumentacja