package gov.nasa.jpl.mbee.ems.sync;

import com.nomagic.magicdraw.core.Application;

import gov.nasa.jpl.mbee.ems.ExportUtility;
import gov.nasa.jpl.mbee.lib.Utils;

public class OutputSyncRunner implements Runnable {

    @Override
    public void run() {
        OutputQueue q = OutputQueue.getInstance();
        while(true) {
            Request r;
            try {
                r = q.take();
                if (r.getMethod().equals("LOG"))
                    Utils.guilog(r.getJson());
                else if (r.getMethod().equals("DELETE"))
                    ExportUtility.delete(r.getUrl(), r.isFeedback());
                else if (r.getMethod().equals("DELETEALL"))
                    ExportUtility.deleteWithBody(r.getUrl(), r.getJson(), r.isFeedback());
                else if (r.getPm() != null)
                    ExportUtility.send(r.getUrl(), r.getPm());
                else
                    ExportUtility.send(r.getUrl(), r.getJson(), null, false, r.isSuppressGui());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        
    }

}

@@ -30,16 +30,49 @@
 .sync;%0A%0A
+import org.apache.log4j.Logger;%0A%0A
 import c
@@ -248,46 +248,164 @@
 e %7B%0A
-%0A    @Override%0A    public void run() %7B
+    public static Logger log = Logger.getLogger(OutputSyncRunner.class);%0A    %0A    @Override%0A    public void run() %7B%0A        log.info(%22sync runner started%22);
 %0A   
@@ -541,24 +541,67 @@
 = q.take();%0A
+                log.info(%22got a request%22);%0A
             
@@ -1243,26 +1243,23 @@
     
-e.printStackTrace(
+log.error(%22%22, e
 );%0A 

add some log for sync runner