Add the real implementation

This commit is contained in:
Derry Hamilton 2023-07-12 08:45:48 +01:00
parent 1b1ba551c8
commit 9a8716f33e

View file

@ -105,14 +105,14 @@ public class CopyingApp {
log.info(String.format("%s - Setting Row count interval to default of 100 rows.",jobName)); log.info(String.format("%s - Setting Row count interval to default of 100 rows.",jobName));
} }
Integer pollTimeout = null; Integer pollTimeout = null;
try { try {
pollTimeout = new Integer(config.getString("pollTimeout")); pollTimeout = new Integer(config.getString("pollTimeout"));
log.info(String.format("%s - Setting Poll timeout to %s milliseconds", jobName, pollTimeout)); log.info(String.format("%s - Setting Poll timeout to %s milliseconds", jobName, pollTimeout));
} catch(Exception e) { } catch(Exception e) {
pollTimeout = new Integer(1000); // If we don't have a new setting, use the old default pollTimeout = new Integer(1000); // If we don't have a new setting, use the old default
log.info(String.format("%s - Setting poll timeout to default of 1 second.",jobName)); log.info(String.format("%s - Setting poll timeout to default of 1 second.",jobName));
} }
@ -148,7 +148,7 @@ public class CopyingApp {
pollTimeout, pollTimeout,
identifySourceSQL, identifySourceSQL,
identifyDestinationSQL identifyDestinationSQL
); );
j.start(); j.start();
j.join(); j.join();
@ -179,7 +179,7 @@ public class CopyingApp {
pollTimeout, pollTimeout,
identifySourceSQL, identifySourceSQL,
identifyDestinationSQL identifyDestinationSQL
); );
j.start(); j.start();
j.join(); j.join();
} else { } else {
@ -242,10 +242,20 @@ public class CopyingApp {
return c; return c;
} }
private void loadDrivers(Configuration config){ // Even with JDBC 4, some drivers don't play nicely with whatever
// the classloaders are up to. So this allows us to force it the
// old fashioned way, and works around the
// "But it works fine when it's the /only/ driver!"
// cross-database problem
private void loadDrivers(Configuration config) {
String[] drivers = config.get(String[].class, "drivers.driver"); String[] drivers = config.get(String[].class, "drivers.driver");
for(String d:drivers){ for(String d:drivers) {
log.info("Would load "+d); try {
Class.forName(d);
log.info("Preloaded driver "+d);
} catch(ClassNotFoundException e) {
log.error("Could not preload driver "+d,e);
}
} }
} }
} }