1 package org.tanukisoftware.wrapper.test; 2 3 27 28 import org.tanukisoftware.wrapper.WrapperManager; 29 30 35 public class Filter { 36 39 public static void main(String [] args) { 40 System.out.println("Test the handling of filters."); 41 System.out.println("The Wrapper should restart the JVM when it detects either the string:"); 42 System.out.println(" \"ERR OR\" or \"N ice long restart message.\", both without the"); 43 System.out.println(" extra space It should ignore the string: \"NONERROR\". Then"); 44 System.out.println(" it should exit when it detects the string: \"ALL DONE\", once again"); 45 System.out.println(" without the space."); 46 System.out.println(); 47 48 System.out.println("The next line should be ignored:"); 49 System.out.println(" NONERROR"); 50 System.out.println(); 51 52 if (WrapperManager.getJVMId() >= 4) { 53 System.out.println("The next line should cause the Wrapper to exit:"); 55 System.out.println(" ALLDONE"); 56 } else if (WrapperManager.getJVMId() == 3) { 57 System.out.println("The next line should cause the Wrapper to restart the JVM:"); 59 System.out.println(" Nice long restart message."); 60 } else { 61 System.out.println("The next line should cause the Wrapper to restart the JVM:"); 62 System.out.println(" ERROR"); 63 } 64 System.out.println(); 65 System.out.println("The above message should be caught before this line, but this line"); 66 System.out.println(" will still be visible. Wait for 5 seconds before this thread is"); 67 System.out.println(" allowed to complete. This prevents the Wrapper from detecting"); 68 System.out.println(" that the application has completed and exiting normally. The"); 69 System.out.println(" Wrapper will try to shutdown the JVM cleanly, so it will not exit"); 70 System.out.println(" until this thread has completed."); 71 72 try { 73 Thread.sleep(5000); 74 } catch (InterruptedException e) { 75 } 76 77 System.out.println("Main complete."); 78 } 79 } 80 81 | Popular Tags |