synchronize on final object

This commit is contained in:
Milos Kozak 2016-08-03 18:34:24 +02:00
parent c20026c15a
commit 3e5eb85b88

View file

@ -96,6 +96,7 @@ public class ExecutionService extends Service {
private Treatment bolusingTreatment = null; private Treatment bolusingTreatment = null;
private static Boolean connectionInProgress = false; private static Boolean connectionInProgress = false;
private static final Object connectionLock = new Object();
private static final UUID SPP_UUID = UUID.fromString("00001101-0000-1000-8000-00805f9b34fb"); private static final UUID SPP_UUID = UUID.fromString("00001101-0000-1000-8000-00805f9b34fb");
@ -186,8 +187,8 @@ public class ExecutionService extends Service {
return; return;
} }
final long maxConnectionTime = 5 * 60 * 1000L; // 5 min final long maxConnectionTime = 5 * 60 * 1000L; // 5 min
synchronized (connectionInProgress) { synchronized (connectionLock) {
log.debug("entering connection whie loop"); //log.debug("entering connection while loop");
connectionInProgress = true; connectionInProgress = true;
mWakeLock.acquire(); mWakeLock.acquire();
getBTSocketForSelectedPump(); getBTSocketForSelectedPump();