From 09e1e3ee68b34fdb282251c2c12c05f78619d906 Mon Sep 17 00:00:00 2001 From: Puneet Gupta Date: Tue, 16 Dec 2014 15:37:43 -0800 Subject: [PATCH] Fixed a bug in the listener waiting too long to pick up files --- pom.xml | 4 ++-- src/main/java/com/sforce/dataset/DatasetUtilMain.java | 6 +++++- src/main/java/com/sforce/dataset/DatasetUtilParams.java | 1 + .../dataset/loader/file/listener/FileListenerThread.java | 2 +- src/main/java/com/sforce/dataset/util/DatasetUtils.java | 7 ++++--- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 443c960..0c2cf46 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ Analytics Cloud Datatset Utils datasetutils jar - 32.0.5-SNAPSHOT + 32.0.5 https://github.com/forcedotcom/Analytics-Cloud-Dataset-Utils salesforce.com @@ -37,7 +37,7 @@ scm:git:git@github.com:forcedotcom/Analytics-Cloud-Dataset-Utils.git scm:git:git@github.com:forcedotcom/Analytics-Cloud-Dataset-Utils.git scm:git:git@github.com:forcedotcom/Analytics-Cloud-Dataset-Utils.git - HEAD + datasetutils-32.0.5 diff --git a/src/main/java/com/sforce/dataset/DatasetUtilMain.java b/src/main/java/com/sforce/dataset/DatasetUtilMain.java index a30ee27..201fc40 100644 --- a/src/main/java/com/sforce/dataset/DatasetUtilMain.java +++ b/src/main/java/com/sforce/dataset/DatasetUtilMain.java @@ -113,6 +113,10 @@ else if(args[i-1].equalsIgnoreCase("--action")) { action = args[i]; } + else if(args[i-1].equalsIgnoreCase("--debug")) + { + params.debug = true; + } else if(args[i-1].equalsIgnoreCase("--inputFile")) { String tmp = args[i]; @@ -283,7 +287,7 @@ else if(args[i-1].equalsIgnoreCase("--codingErrorAction")) if(params.username!=null || params.sessionId != null) { try { - partnerConnection = DatasetUtils.login(0, params.username, params.password, params.token, params.endpoint, params.sessionId); + partnerConnection = DatasetUtils.login(0, params.username, params.password, params.token, params.endpoint, params.sessionId, params.debug); } catch (ConnectionException e) { e.printStackTrace(); System.exit(-1); diff --git a/src/main/java/com/sforce/dataset/DatasetUtilParams.java b/src/main/java/com/sforce/dataset/DatasetUtilParams.java index a8e6919..c44eefa 100644 --- a/src/main/java/com/sforce/dataset/DatasetUtilParams.java +++ b/src/main/java/com/sforce/dataset/DatasetUtilParams.java @@ -44,5 +44,6 @@ public class DatasetUtilParams { String Operation = null; int rowLimit = 0; boolean useBulkAPI = false; + boolean debug = false; CodingErrorAction codingErrorAction = CodingErrorAction.REPORT; } diff --git a/src/main/java/com/sforce/dataset/loader/file/listener/FileListenerThread.java b/src/main/java/com/sforce/dataset/loader/file/listener/FileListenerThread.java index 032d07e..9b1ab0f 100644 --- a/src/main/java/com/sforce/dataset/loader/file/listener/FileListenerThread.java +++ b/src/main/java/com/sforce/dataset/loader/file/listener/FileListenerThread.java @@ -75,7 +75,7 @@ public void run() { while (!isDone) { try { - long cutOff = System.currentTimeMillis() - (1000*fileListener.fileAge); + long cutOff = System.currentTimeMillis() - (fileListener.fileAge); IOFileFilter ageFilter = FileFilterUtils.ageFileFilter(cutOff); IOFileFilter nameFilter = FileFilterUtils.nameFileFilter(fileListener.inputFilePattern, IOCase.INSENSITIVE); // IOFileFilter suffixFileFilter1 = FileFilterUtils.suffixFileFilter(".zip", IOCase.INSENSITIVE); diff --git a/src/main/java/com/sforce/dataset/util/DatasetUtils.java b/src/main/java/com/sforce/dataset/util/DatasetUtils.java index 6f232f8..321501d 100644 --- a/src/main/java/com/sforce/dataset/util/DatasetUtils.java +++ b/src/main/java/com/sforce/dataset/util/DatasetUtils.java @@ -316,7 +316,7 @@ public static boolean downloadEM(String EM_NAME, PartnerConnection connection) t } - public static PartnerConnection login(int retryCount,String username,String password, String token, String endpoint, String sessionId) throws ConnectionException { + public static PartnerConnection login(int retryCount,String username,String password, String token, String endpoint, String sessionId, boolean debug) throws ConnectionException { if(sessionId==null) { @@ -357,7 +357,8 @@ public static PartnerConnection login(int retryCount,String username,String pass @SuppressWarnings("unused") GetUserInfoResult userInfo = connection.getUserInfo(); System.out.println("Service Endpoint: " + config.getServiceEndpoint()); - System.out.println("SessionId Endpoint: " + config.getSessionId()); + if(debug) + System.out.println("SessionId: " + config.getSessionId()); // System.out.println("User Id: " + userInfo.getUserName()); // System.out.println("User Email: " + userInfo.getUserEmail()); System.out.println(); @@ -378,7 +379,7 @@ public static PartnerConnection login(int retryCount,String username,String pass } catch (InterruptedException e1) { e1.printStackTrace(); } - return login(retryCount,username, password, null, endpoint, sessionId); + return login(retryCount,username, password, null, endpoint, sessionId, debug); } throw new ConnectionException(e.toString()); }