Revision 683
Added by berkley over 23 years ago
ReplicationHandler.java | ||
---|---|---|
82 | 82 |
//xml_documents with an update_date > last_checked |
83 | 83 |
try |
84 | 84 |
{ |
85 |
conn = util.openDBConnection(); |
|
85 |
try |
|
86 |
{ //this connection is prone to error for some reason so we |
|
87 |
//try to connect it three times before quiting. |
|
88 |
conn = util.openDBConnection(); |
|
89 |
} |
|
90 |
catch(SQLException sqle) |
|
91 |
{ |
|
92 |
try |
|
93 |
{ |
|
94 |
conn = util.openDBConnection(); |
|
95 |
} |
|
96 |
catch(SQLException sqlee) |
|
97 |
{ |
|
98 |
try |
|
99 |
{ |
|
100 |
conn = util.openDBConnection(); |
|
101 |
} |
|
102 |
catch(SQLException sqleee) |
|
103 |
{ |
|
104 |
System.out.println("error getting db connection in " + |
|
105 |
"ReplicationHandler.run: " + |
|
106 |
sqleee.getMessage()); |
|
107 |
} |
|
108 |
} |
|
109 |
} |
|
86 | 110 |
serverList = buildServerList(conn); |
87 |
update(serverList, conn);
|
|
88 |
updateCatalog(serverList, conn);
|
|
111 |
update(serverList); |
|
112 |
updateCatalog(serverList); |
|
89 | 113 |
conn.close(); |
90 | 114 |
} |
91 | 115 |
catch (Exception e) |
... | ... | |
97 | 121 |
/** |
98 | 122 |
* Method that uses revision taging for replication instead of update_date. |
99 | 123 |
*/ |
100 |
private void update(Hashtable serverList, Connection conn)
|
|
124 |
private void update(Hashtable serverList) |
|
101 | 125 |
{ |
102 | 126 |
/* |
103 | 127 |
Pseudo-algorithm |
... | ... | |
112 | 136 |
(this info is theoretically not needed using this system but probably |
113 | 137 |
should be kept anyway) |
114 | 138 |
*/ |
139 |
|
|
140 |
Connection conn = null; |
|
141 |
try |
|
142 |
{ |
|
143 |
try |
|
144 |
{ //this connection is prone to error for some reason so we |
|
145 |
//try to connect it three times before quiting. |
|
146 |
conn = util.openDBConnection(); |
|
147 |
} |
|
148 |
catch(SQLException sqle) |
|
149 |
{ |
|
150 |
try |
|
151 |
{ |
|
152 |
conn = util.openDBConnection(); |
|
153 |
} |
|
154 |
catch(SQLException sqlee) |
|
155 |
{ |
|
156 |
try |
|
157 |
{ |
|
158 |
conn = util.openDBConnection(); |
|
159 |
} |
|
160 |
catch(SQLException sqleee) |
|
161 |
{ |
|
162 |
System.out.println("error getting db connection in " + |
|
163 |
"ReplicationHandler.update: " + |
|
164 |
sqleee.getMessage()); |
|
165 |
} |
|
166 |
} |
|
167 |
} |
|
168 |
} |
|
169 |
catch(Exception e) |
|
170 |
{ |
|
171 |
System.out.println("error in ReplicationHandler.update: " + |
|
172 |
e.getMessage()); |
|
173 |
} |
|
174 |
|
|
115 | 175 |
Enumeration keys; |
116 | 176 |
String server; |
117 | 177 |
String update; |
... | ... | |
285 | 345 |
/** |
286 | 346 |
* updates xml_catalog with entries from other servers. |
287 | 347 |
*/ |
288 |
private void updateCatalog(Hashtable serverList, Connection conn)
|
|
348 |
private void updateCatalog(Hashtable serverList) |
|
289 | 349 |
{ |
350 |
Connection conn = null; |
|
290 | 351 |
try |
291 | 352 |
{ |
353 |
try |
|
354 |
{ //this connection is prone to error for some reason so we |
|
355 |
//try to connect it three times before quiting. |
|
356 |
conn = util.openDBConnection(); |
|
357 |
} |
|
358 |
catch(SQLException sqle) |
|
359 |
{ |
|
360 |
try |
|
361 |
{ |
|
362 |
conn = util.openDBConnection(); |
|
363 |
} |
|
364 |
catch(SQLException sqlee) |
|
365 |
{ |
|
366 |
try |
|
367 |
{ |
|
368 |
conn = util.openDBConnection(); |
|
369 |
} |
|
370 |
catch(SQLException sqleee) |
|
371 |
{ |
|
372 |
System.out.println("error getting db connection in " + |
|
373 |
"ReplicationHandler.update: " + |
|
374 |
sqleee.getMessage()); |
|
375 |
} |
|
376 |
} |
|
377 |
} |
|
292 | 378 |
String server; |
293 | 379 |
Enumeration keys = serverList.keys(); |
294 | 380 |
while(keys.hasMoreElements()) |
Also available in: Unified diff
fixed some problems with database connections getting a time out error. Also updated some catch statements