source: ccr/trunk/nhin-vista/projects/NHINC/Current/Product/Production/Common/UDDIUpdateManagerEJB/src/java/gov/hhs/fha/nhinc/connectmgr/uddi/UDDITimerTask.java@ 507

Last change on this file since 507 was 507, checked in by George Lilly, 15 years ago

NHIN gateway and adaptor for use on linux with VistA EHR and RPMS

File size: 2.2 KB
Line 
1package gov.hhs.fha.nhinc.connectmgr.uddi;
2
3import java.io.PrintWriter;
4import java.io.StringWriter;
5import org.apache.commons.logging.Log;
6import org.apache.commons.logging.LogFactory;
7
8
9/**
10 * This class is responsible for handling the work that is done each time the timer
11 * goes off. It will read the data from the UDDI server, update the
12 * uddiConenctionInfo.xml file, and tell the connection manager to update its cache
13 * with that data.
14 *
15 * @author Les Westberg
16 */
17public class UDDITimerTask
18{
19 private static Log log = LogFactory.getLog(UDDITimerTask.class);
20
21 /**
22 * This method is called each time the timer thread wakes up.
23 */
24 public void run()
25 {
26 try
27 {
28 if (log.isDebugEnabled())
29 {
30 log.debug("Start: UDDITimerTask.run method - loading from UDDI server.");
31 }
32
33 UDDIUpdateManagerHelper.forceRefreshUDDIFile();
34
35 if (log.isDebugEnabled())
36 {
37 log.debug("Done: UDDITimerTask.run method - loading from UDDI server.");
38 }
39 }
40 catch (Throwable t)
41 {
42 log.debug("****** UDDITimerTask THROWABLE: " + t.getMessage(), t);
43
44 StringWriter stackTrace = new StringWriter();
45 t.printStackTrace(new PrintWriter(stackTrace));
46 String sValue = stackTrace.toString();
47 if (sValue.indexOf("EJBClassLoader") >= 0)
48 {
49 UDDITimer.stopTimer();
50 }
51 }
52 }
53
54 /**
55 * Main method used to test this class. This one really should not be run under unit
56 * test scenarios because it requires access to the UDDI server.
57 *
58 * @param args
59 */
60 public static void main(String[] args)
61 {
62 System.out.println("Starting test.");
63
64 try
65 {
66 UDDITimerTask oTimerTask = new UDDITimerTask();
67 oTimerTask.run();
68 }
69 catch (Exception e)
70 {
71 System.out.println("An unexpected exception occurred: " + e.getMessage());
72 e.printStackTrace();
73 System.exit(-1);
74 }
75
76 System.out.println("End of test.");
77
78 }
79}
Note: See TracBrowser for help on using the repository browser.