amip.api.examples.util
Class Helpers

java.lang.Object
  extended by amip.api.examples.util.Helpers

public class Helpers
extends java.lang.Object

Helper class for examples


Constructor Summary
Helpers()
           
 
Method Summary
static void setupTerminationHandler(java.lang.Thread thread)
          Sets up a handler for INT signal, from console you can press Ctrl+C to activate the handler.
static void setupTerminationHandlerAndWait(java.lang.Thread thread)
          This method combines the calls to setupTerminationHandler(java.lang.Thread) and waitUntilTerminated().
static void waitUntilTerminated()
          This method locks current thread, the execution will continue only when InterruptedException is rised, before using this method you should set up signal handler which will interrupt waiting.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Helpers

public Helpers()
Method Detail

waitUntilTerminated

public static void waitUntilTerminated()
This method locks current thread, the execution will continue only when InterruptedException is rised, before using this method you should set up signal handler which will interrupt waiting.


setupTerminationHandler

public static void setupTerminationHandler(java.lang.Thread thread)
Sets up a handler for INT signal, from console you can press Ctrl+C to activate the handler. Thread is interrupted when signal is received.

Parameters:
thread - a thread to interrupt.

setupTerminationHandlerAndWait

public static void setupTerminationHandlerAndWait(java.lang.Thread thread)
This method combines the calls to setupTerminationHandler(java.lang.Thread) and waitUntilTerminated().

Parameters:
thread - a thread to lock and then release upon INT signal (Ctrl+C).