From d3b376a757f55eae9b156aa5cc432b92a3189721 Mon Sep 17 00:00:00 2001 From: Jan Lolling Date: Thu, 8 Oct 2020 14:31:32 +0200 Subject: [PATCH] Java version updated Code comment added --- pom.xml | 13 ++----------- .../jlo/talendcomp/tabletransfer/TableTransfer.java | 7 +++++-- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index 77ac2e5..8e7dbd3 100644 --- a/pom.xml +++ b/pom.xml @@ -13,8 +13,8 @@ org.apache.maven.plugins maven-compiler-plugin - 1.7 - 1.7 + 1.8 + 1.8 @@ -100,15 +100,6 @@ 9.4.1212.jre7 provided - 9.4 \ No newline at end of file diff --git a/src/main/java/de/jlo/talendcomp/tabletransfer/TableTransfer.java b/src/main/java/de/jlo/talendcomp/tabletransfer/TableTransfer.java index 2036f02..6c8c654 100644 --- a/src/main/java/de/jlo/talendcomp/tabletransfer/TableTransfer.java +++ b/src/main/java/de/jlo/talendcomp/tabletransfer/TableTransfer.java @@ -542,9 +542,12 @@ private final void writeTable() { if (one == null) { continue; } else { + // because poll removes already the one object + // we have to add it here queueObjects.add(one); } // drain never waits! Thats why we have to use poll before! + // here we get the rest of all objects from the queue tableQueue.drainTo(queueObjects, batchSize); // pull elements from queue to this given list // debug("Got " + queueObjects.size() + " records from queue."); for (Object item : queueObjects) { @@ -809,8 +812,8 @@ public final void setup() throws Exception { if (outputToTable) { createTargetInsertStatement(); } - final int batchSize = Integer.parseInt(properties.getProperty(TARGET_BATCHSIZE, "100")); - final int fetchSize = Integer.parseInt(properties.getProperty(SOURCE_FETCHSIZE, "100")); + final int batchSize = Integer.parseInt(properties.getProperty(TARGET_BATCHSIZE, "1000")); + final int fetchSize = Integer.parseInt(properties.getProperty(SOURCE_FETCHSIZE, "1000")); final int queueSize = Math.max(batchSize, fetchSize); if (outputToTable) { tableQueue = new ArrayBlockingQueue(queueSize);