Commit e4b21611 authored by Matija Obreza's avatar Matija Obreza

Need at least 2 threads (for single institute upload)

parent 0704a8f0
......@@ -76,7 +76,7 @@ import swing2swt.layout.BorderLayout;
public class PushDialog extends Dialog {
private static final Logger _log = Logger.getLogger(PushDialog.class);
protected static final int BATCH_SIZE = 50;
protected static final int MAX_UPLOAD_THREADS = 2;
protected static final int MAX_UPLOAD_THREADS = 4;
public static enum GenesysOp {
UPSERT, DELETE
......@@ -95,7 +95,7 @@ public class PushDialog extends Dialog {
protected DataSourceLoader dataSourceLoader;
BlockingQueue<Runnable> linkedBlockingDeque = new LinkedBlockingDeque<Runnable>(MAX_UPLOAD_THREADS * 3);
private ThreadPoolExecutor executorService = new ThreadPoolExecutor(1, MAX_UPLOAD_THREADS + 1, 30, TimeUnit.SECONDS, linkedBlockingDeque, new ThreadPoolExecutor.CallerRunsPolicy());
private ThreadPoolExecutor executorService = new ThreadPoolExecutor(2, MAX_UPLOAD_THREADS + 2, 30, TimeUnit.SECONDS, linkedBlockingDeque, new ThreadPoolExecutor.CallerRunsPolicy());
protected Object result;
protected Shell shell;
......@@ -379,12 +379,13 @@ public class PushDialog extends Dialog {
// Ping the server
genesysClient.me();
for (String instCode : instCodesOrder) {
_log.warn("Queueing upload for " + instCode);
Future<?> instFuture = executorService.submit(new Runnable() {
final Map<String, List<ObjectNode>> instCodeMap = new HashMap<String, List<ObjectNode>>();
@Override
public void run() {
_log.warn("Running upload for " + instCode);
try (RowReader rowReader = dataSourceLoader.createRowReader(dataSourceSheet, dataSource)) {
rowReader.setSkipRows(dataSourceSheet.getHeaderRowIndex() + 1);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment