this인 static 필드 또는 메서드의 @GuardedBy 어노테이션을 보고합니다.
static 요소를 static이 아닌 요소로 보호하면 과도한 동시성이 발생할 수 있으며, 서로 다른 객체 컨텍스트를 잠가, 가드된 필드에 여러 스레드가 동시에 액세스할 수 있습니다.
예:
private ReadWriteLock lock = new ReentrantReadWriteLock();
@GuardedBy("lock")
public static void bar() {
// ...
}
지원되는 @GuardedBy 어노테이션:
net.jcip.annotations.GuardedByjavax.annotation.concurrent.GuardedByorg.apache.http.annotation.GuardedBycom.android.annotations.concurrency.GuardedByandroidx.annotation.GuardedBycom.google.errorprone.annotations.concurrent.GuardedBy