Annotation called ThreadSafe

前端 未结 1 871
情书的邮戳
情书的邮戳 2021-02-13 09:28
@ThreadSafe 
public class A
{
}

Does this annotation actually make the class Thread Safe or is it just for readability?

相关标签:
1条回答
  • 2021-02-13 10:00

    See @ThreadSafe Annotation:

    Place this annotation on methods that can safely be called from more than one thread concurrently. The method implementer must ensure thread safety using a variety of possible techniques including immutable data, synchronized shared data, or not using any shared data at all.

    It does not make the class Thread Safe, the programmer does it Thread Safe and adds the annotation.

    You might want to see this helpful link too.

    0 讨论(0)
提交回复
热议问题