You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Virtual threads, introduced in JEP 444, are forced to pin to their carrier threads when in a synchronized block. Since AmazonDynamoDBLockClientsynchronizes on LockItems while performing blocking dynamodb operations, using the lock client from a virtual thread pins the virtual thread to the carrier thread while waiting for the operation to complete (which sort of defeats the purpose of virtual threads).
JEP 444 suggests replacing synchronzied blocks that contain long blocking I/O operations with ReentrantLock
avoid frequent and long-lived pinning by revising synchronized blocks or methods that run frequently and guard potentially long I/O operations to use java.util.concurrent.locks.ReentrantLock instead.
I'd be happy to open a PR if you're amenable to tossing a ReentrantLock in LockItem to replace the synchronized blocks
The text was updated successfully, but these errors were encountered:
Virtual threads, introduced in JEP 444, are forced to pin to their carrier threads when in a
synchronized
block. SinceAmazonDynamoDBLockClient
synchronizes onLockItems
while performing blocking dynamodb operations, using the lock client from a virtual thread pins the virtual thread to the carrier thread while waiting for the operation to complete (which sort of defeats the purpose of virtual threads).JEP 444 suggests replacing
synchronzied
blocks that contain long blocking I/O operations withReentrantLock
I'd be happy to open a PR if you're amenable to tossing a
ReentrantLock
inLockItem
to replace thesynchronized
blocksThe text was updated successfully, but these errors were encountered: