org.openide.modules 7.32.1

org.openide.modules
Annotation Type OnStop


@Retention(value=SOURCE)
@Target(value=TYPE)
public @interface OnStop

Annotation that can be applied to Runnable or Callable<Boolean> subclasses with default constructor which will be invoked during shutdown sequence or when the module is being shutdown.

First of all call callables are consulted to allow or deny proceeding with the shutdown:

 @OnStop
 public class AskTheUser implements Callable {
   public Boolean call() {
     return isItOKToShutdown() ? Boolean.TRUE : Boolean.FALSE;
   }
 }
 
If the shutdown is approved, all runnables registered are acknowledged and can perform the shutdown cleanup. The runnables are invoked in parallel. It is guaranteed their execution is finished before the shutdown sequence is over:
 @OnStop
 public class Cleanup implements Runnable {
   public void run() {
     // do some cleanup
   }
 }
 

Since:
7.29


org.openide.modules 7.32.1

Built on July 17 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.