Exemplo n.º 1
0
 /**
  * Initializes the instance if it is not already initialized.
  *
  * @param ctx
  * @param request
  * @throws java.io.IOException
  */
 public static void initIfNotInited(ServletContext ctx, HttpServletRequest request)
     throws IOException {
   if (INITIALIZED.compareAndSet(false, true)) {
     try {
       instance = new Engine();
       instance.init(ctx, request);
     } catch (IOException e) {
       INITIALIZED.set(false);
       throw e;
     } catch (Throwable t) {
       INITIALIZED.set(false);
       throw new IOException(t.getMessage(), t);
     }
   }
 }
Exemplo n.º 2
0
 /** Terminates the instance. */
 public static void destroy() {
   if (INITIALIZED.compareAndSet(true, false)) instance.terminate();
 }