CheckThread.org (Beta)

@ThreadConfined Annotation

Description

Place @ThreadConfined annotation on methods/classes that should only be invoked on a specific thread. For example, Swing and SWT UI toolkits are both library API's that are thread confined.

Location

  • Method
  • Class

Parameters

  • suppressErrors=true/false
    Suppress any errors reported by CheckThread.
    Example: @ThreadConfined(suppressErrors=true)
  • ThreadName.SWT_UI | ThreadName.EDT |"someThreadName"
    Indicates which thread the method is confined to.
    Example 1: @ThreadConfined(ThreadName.EDT)
    Example 2: @ThreadConfined("mythread")

Validation Performed by CheckThread

  • Error if @ThreadConfined method is invoking a @NotThreadSafe method without synchronization
  • Error if @ThreadConfined method is invoking another @ThreadConfined method with a different thread name
©2009 CheckThread