Revision 2663
Added by sgarg over 18 years ago
ForceReplicationHandler.java | ||
---|---|---|
38 | 38 |
import java.lang.*; |
39 | 39 |
import java.text.*; |
40 | 40 |
|
41 |
import org.apache.log4j.Logger; |
|
42 |
|
|
41 | 43 |
/** |
42 | 44 |
* A class to asyncronously force the replication of each server |
43 | 45 |
* that has an entry in the xml_replication table. When run, |
... | ... | |
60 | 62 |
// other metacat in its serverlist to update this docid if A is a hub. But we |
61 | 63 |
// don't want A to notify B again. B is nofitification of A |
62 | 64 |
private String notificationServer = null; |
65 |
private Logger logMetacat = Logger.getLogger(ForceReplicationHandler.class); |
|
63 | 66 |
|
64 | 67 |
//constant |
65 | 68 |
public static final String DELETE = "delete"; |
... | ... | |
92 | 95 |
}//try |
93 | 96 |
catch (Exception e) |
94 | 97 |
{ |
95 |
MetaCatUtil.debugMessage("Error in ForceReplicationHandle(): "
|
|
96 |
+e.getMessage(), 30);
|
|
98 |
logMetacat.error("Error in ForceReplicationHandle(): "
|
|
99 |
+e.getMessage()); |
|
97 | 100 |
}//catch |
98 | 101 |
// Get the notification server |
99 | 102 |
this.notificationServer = myNotificationServer; |
... | ... | |
126 | 129 |
} |
127 | 130 |
catch (Exception e) |
128 | 131 |
{ |
129 |
MetaCatUtil.debugMessage("Error in ForceReplicationHandle(): "
|
|
130 |
+e.getMessage(), 30);
|
|
132 |
logMetacat.error("Error in ForceReplicationHandle(): "
|
|
133 |
+e.getMessage()); |
|
131 | 134 |
}//catch |
132 | 135 |
// Get notification server |
133 | 136 |
this.notificationServer = myNotificationServer; |
... | ... | |
162 | 165 |
} |
163 | 166 |
catch(Exception ee) |
164 | 167 |
{ |
165 |
MetaCatUtil.debugMessage("Couldn't sleep in force replication", 20);
|
|
168 |
logMetacat.error("Couldn't sleep in force replication");
|
|
166 | 169 |
} |
167 |
MetaCatUtil.debugMessage("notification server:"+notificationServer, 34);
|
|
170 |
logMetacat.info("notification server:"+notificationServer);
|
|
168 | 171 |
// Check every server in the serverlists |
169 | 172 |
for (int i=0; i<serverLists.size(); i++) |
170 | 173 |
{ |
... | ... | |
343 | 346 |
//Make sure comeAndGetIt is not empty |
344 | 347 |
if ( comeAndGetIt != null && !comeAndGetIt.equals("")) |
345 | 348 |
{ |
346 |
MetaCatUtil.debugMessage("sending message: "
|
|
347 |
+ comeAndGetIt.toString(), 25);
|
|
349 |
logMetacat.warn("sending message: "
|
|
350 |
+ comeAndGetIt.toString()); |
|
348 | 351 |
String message = MetacatReplication.getURLContent(comeAndGetIt); |
349 | 352 |
} |
350 | 353 |
//send out the url. message is a dummy variable as the target of |
... | ... | |
354 | 357 |
} |
355 | 358 |
catch (Exception ee) |
356 | 359 |
{ |
357 |
MetaCatUtil.debugMessage("error in ForceReplicationHandler.run for server "
|
|
358 |
+ server +" "+ee.getMessage(), 20);
|
|
360 |
logMetacat.error("error in ForceReplicationHandler.run for server "
|
|
361 |
+ server +" "+ee.getMessage()); |
|
359 | 362 |
ee.printStackTrace(); |
360 | 363 |
} |
361 | 364 |
}//for |
362 | 365 |
|
363 | 366 |
|
364 |
MetaCatUtil.debugMessage("exiting ForceReplicationHandler Thread", 25);
|
|
367 |
logMetacat.warn("exiting ForceReplicationHandler Thread");
|
|
365 | 368 |
}//run |
366 | 369 |
}//ForceReplication class |
Also available in: Unified diff
Replacing MetaCatUtil.debugMessage or MetaCatUtil.logMetacat call with logMetacat (private Logger object) call