org.vmmagic.pragma
Annotation Type Uninterruptible


@Retention(value=RUNTIME)
@Target(value={TYPE,METHOD})
public @interface Uninterruptible

By default all Java code is interruptible, that is scheduling or garbage collection may occur at points within the code. Code can be marked as Unpreemptible or Uninterruptible, that instructs the JVM to avoid garbage collection and thread scheduling. The Uninterruptible annotation disallows any operation that may cause garbage collection or thread scheduling, for example memory allocation. The Unpreemptible annotation doesn't disallow operations that can cause garbage collection or scheduling, but instructs the JVM to avoid inserting such operations during a block of code.

In the internals of a VM most code wants to be Uninterruptible. However, code involved in scheduling and locking will cause context switches, and creating exception objects may trigger garbage collection, this code is therefore Unpreemptible.

Any method that is marked as uninterruptible is treated specially by the machine code compiler:

  1. the normal thread switch test that would be emitted in the method prologue is omitted.
  2. the stack overflow test that would be emitted in the method prologue is omitted.
  3. calls to preemptible code causes warnings.
  4. bytecodes that can cause interruption cause warnings.
  5. uninterruptible code will be generated assuming no RuntimeExceptions are raised and without any GC maps (since by definition there can be noGC if control is not lost).

This is the inverse of Interruptible.


Optional Element Summary
 String value
           
 

value

public abstract String value
Returns:
Explanation of why code needs to be uninterruptible
Default:
""