This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Singleton | |
@Startup | |
@Remote(HeartbeatEvent.class) | |
public class HeartbeatEventEJB implements HeartbeatEvent { | |
private final static Logger logger = LoggerFactory.getLogger( HeartbeatEventEJB.class); | |
private Thread t; | |
private Worker w; | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for(java.net.URL url:((java.net.URLClassLoader)ClassLoader.getSystemClassLoader()).getURLs()){ | |
System.out.println(url.getFile()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (Map.Entry<String, Object> entry : map.entrySet()) { | |
String key = entry.getKey(); | |
Object value = entry.getValue(); | |
// ... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thread.currentThread().getContextClassLoader().getResourceAsStream("gov/nasa/gsfc/cof/web/data/cities.txt") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LogService { | |
private static HashMap<Integer, String> esbLogCache = new HashMap<Integer, String>(); | |
private static String logDateRegex = "^[a-zA-Z]{3} (\\d)+, (\\d){4} (\\d)+:(\\d){2}:(\\d){2} (AM|PM).*"; | |
static { | |
try { | |
BufferedReader br = new BufferedReader(new InputStreamReader(getEsbLog())); | |
int row = 0; | |
boolean firstRead = true; | |
for (String line = br.readLine(); line != null; line = firstRead ? br.readLine() : line) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See JLogTailer | |
public void tailLog(File file) { | |
boolean running = true; | |
int updateInterval = 1000; | |
long filePointer = file.length(); | |
try { | |
while (running) { | |
Thread.sleep(updateInterval); | |
long length = file.length(); |