1 16 17 package org.apache.tester; 18 19 20 import java.io.*; 21 import java.util.*; 22 import javax.servlet.*; 23 import javax.servlet.http.*; 24 25 26 33 34 public class StaticLogger { 35 36 37 39 40 42 43 46 protected static ArrayList messages = new ArrayList(); 47 48 49 52 protected static int position = 0; 53 54 55 57 58 62 public static String read() { 63 64 synchronized (messages) { 65 if (position < messages.size()) 66 return ((String ) messages.get(position++)); 67 else 68 return (null); 69 } 70 71 } 72 73 74 77 public static void reset() { 78 79 synchronized (messages) { 80 messages.clear(); 81 position = 0; 82 } 83 84 } 85 86 87 92 public static void write(String message) { 93 94 synchronized (messages) { 95 messages.add(message); 96 } 97 98 } 99 100 101 } 102 | Popular Tags |