MISC: fix potential bug - misuse concurrency method (synchronized, wait, notify) 95/18695/1
authorjungwook.ryu <jungwook.ryu@samsung.com>
Fri, 28 Mar 2014 07:53:34 +0000 (16:53 +0900)
committerjungwook.ryu <jungwook.ryu@samsung.com>
Fri, 28 Mar 2014 07:53:57 +0000 (16:53 +0900)
Change-Id: I7d8dc216aff4a7b3b68ee6ae1cc043bef9292d33
Signed-off-by: jungwook.ryu <jungwook.ryu@samsung.com>
org.tizen.dynamicanalysis.ide.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/communication/DAServerManager.java

index 67d508f..cfee34b 100644 (file)
@@ -73,7 +73,6 @@ public class DAServerManager extends Thread {
        private final String CURRENT_ACTIVE_IDE_PORT = "current_active_ide_port"; //$NON-NLS-1$
 
        private static boolean recvDAReadyStatus = false;
-       private final static Object recvDataEvent = new Object();       // Lock for synchronous communication
 
        public synchronized static DAServerManager getInstance() {
                if (instance == null) {
@@ -315,9 +314,9 @@ public class DAServerManager extends Thread {
                        DALog.dlgErrorMessage(Labels.MESSAGE_ERROR,
                                        Labels.MESSAGE_FAIL_TO_LAUNCH_PROJECT);
                }
-               synchronized (recvDataEvent) {
+               synchronized (this) {
                        try {
-                               recvDataEvent.wait(10000);
+                               this.wait(10000);
                        } catch (InterruptedException e) {
                                DALog.printLog("DAServerManager - sendDAStatusMessage - getRecvDAReadyStatus().wait(10000)");
                                // TODO Auto-generated catch block
@@ -362,7 +361,7 @@ public class DAServerManager extends Thread {
                }
        }
 
-       private void setDAStatus(final String[] msgArray) { // DA Status
+       private synchronized void setDAStatus(final String[] msgArray) { // DA Status
                if (msgArray[1].equals(IDE_DA_COMMUNICATION_TYPE_1_RECORD)) {
                        setRecvDAReadyStatus(false);
                } else if (msgArray[1].equals(IDE_DA_COMMUNICATION_TYPE_1_STOP)) {
@@ -370,9 +369,7 @@ public class DAServerManager extends Thread {
                } else {
                        DALog.printLog("receive message is not valid");//$NON-NLS-1$
                }
-               synchronized (recvDataEvent) {
-                       recvDataEvent.notify();
-               }
+               this.notify();
        }
 
        private void viewSouceLine(final String[] msgArray) {