From 187b7bb43a6e1c7f4a64a3d0f8fb0a9ce68855a5 Mon Sep 17 00:00:00 2001 From: "jungwook.ryu" Date: Fri, 28 Mar 2014 16:53:34 +0900 Subject: MISC: fix potential bug - misuse concurrency method (synchronized, wait, notify) Change-Id: I7d8dc216aff4a7b3b68ee6ae1cc043bef9292d33 Signed-off-by: jungwook.ryu --- .../ide/eplugin/communication/DAServerManager.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/org.tizen.dynamicanalysis.ide.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/communication/DAServerManager.java b/org.tizen.dynamicanalysis.ide.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/communication/DAServerManager.java index 67d508f..cfee34b 100644 --- a/org.tizen.dynamicanalysis.ide.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/communication/DAServerManager.java +++ b/org.tizen.dynamicanalysis.ide.eplugin/src/org/tizen/dynamicanalysis/ide/eplugin/communication/DAServerManager.java @@ -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) { -- cgit v1.2.3