Skip to content

Commit

Permalink
fixed log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
datasetutil committed Nov 21, 2014
1 parent 2161683 commit fc4d2c9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
7 changes: 6 additions & 1 deletion src/main/java/com/sforce/dataset/loader/DatasetLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ public static boolean uploadDataset(String inputFileString,
// CsvReader reader = new CsvReader(new InputStreamReader(new BOMInputStream(new FileInputStream(inputFile), false), DatasetUtils.utf8Decoder(codingErrorAction, inputFileCharset)));
CsvListReader reader = new CsvListReader(new InputStreamReader(new BOMInputStream(new FileInputStream(inputFile), false), DatasetUtils.utf8Decoder(codingErrorAction , inputFileCharset )), CsvPreference.STANDARD_PREFERENCE);
WriterThread writer = new WriterThread(q, w, ew);
Thread th = new Thread(writer);
Thread th = new Thread(writer,"Writer-Thread");
th.setDaemon(true);
th.start();

Expand Down Expand Up @@ -331,6 +331,11 @@ public static boolean uploadDataset(String inputFileString,
System.err.println("Row {"+totalRowCount+"} has error {"+t+"}");
if(t instanceof MalformedInputException)
{
while(!writer.isDone())
{
q.put(new String[0]);
Thread.sleep(1000);
}
System.err.println("\n*******************************************************************************");
System.err.println("The input file is not utf8 encoded. Please save it as UTF8 file first");
System.err.println("*******************************************************************************\n");
Expand Down
21 changes: 3 additions & 18 deletions src/main/java/com/sforce/dataset/loader/WriterThread.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class WriterThread implements Runnable {
{
if(q==null || w == null || ew == null)
{
throw new IllegalArgumentException("Constrictor input cannot be null");
throw new IllegalArgumentException("Constructor input cannot be null");
}
queue = q;
this.w = w;
Expand All @@ -53,10 +53,8 @@ public class WriterThread implements Runnable {

public void run() {
try {

System.out.println("Start: " + Thread.currentThread().getName());

String[] row = queue.take();
System.out.println("Start: " + Thread.currentThread().getName());
while (row != null && row.length!=0) {
try
{
Expand Down Expand Up @@ -86,33 +84,20 @@ public void run() {
}catch (Throwable t) {
System.out.println (Thread.currentThread().getName() + " " + t.getMessage());
}
isDone = true;
System.out.println("END: " + Thread.currentThread().getName());
isDone = true;
}

public boolean isDone() {
return isDone;
}

public void setDone(boolean isDone) {
this.isDone = isDone;
}

public int getErrorRowCount() {
return errorRowCount;
}

public void setErrorRowCount(int errorRowCount) {
this.errorRowCount = errorRowCount;
}

public int getTotalRowCount() {
return totalRowCount;
}

public void setTotalRowCount(int totalRowCount) {
this.totalRowCount = totalRowCount;
}


}

0 comments on commit fc4d2c9

Please sign in to comment.