|
|
@ -36,16 +36,16 @@ public class LiquidAdditionInstance { |
|
|
|
|
|
|
|
// lock liquid plate |
|
|
|
public void lockLiquidPlate( String lockName ) { |
|
|
|
MdbRuntimeLog.log("LiquidPlateLock", "加液盘锁定等待 : %s", lockName); |
|
|
|
MdbRuntimeLog.warn("LiquidPlateLock", "加液盘锁定等待 : %s", lockName); |
|
|
|
this.liquidPlateLocks.add(lockName); |
|
|
|
if ( 1 == this.liquidPlateLocks.size() ) { |
|
|
|
MdbRuntimeLog.log("LiquidPlateLock", "加液盘锁定成功 : %s", lockName); |
|
|
|
MdbRuntimeLog.warn("LiquidPlateLock", "加液盘锁定成功 : %s", lockName); |
|
|
|
return ; |
|
|
|
} |
|
|
|
synchronized ( lockName ) { |
|
|
|
try { |
|
|
|
lockName.wait(); |
|
|
|
MdbRuntimeLog.log("LiquidPlateLock", "加液盘锁定成功 : %s", lockName); |
|
|
|
MdbRuntimeLog.warn("LiquidPlateLock", "加液盘锁定成功 : %s", lockName); |
|
|
|
} catch (InterruptedException e) { |
|
|
|
throw new RuntimeException(e); |
|
|
|
} |
|
|
@ -54,7 +54,7 @@ public class LiquidAdditionInstance { |
|
|
|
|
|
|
|
// unlock liquid plate |
|
|
|
public void unlockLiquidPlate( String lockName ) { |
|
|
|
MdbRuntimeLog.log("LiquidPlateLock", "加液盘锁定解除 : %s", lockName); |
|
|
|
MdbRuntimeLog.warn("LiquidPlateLock", "加液盘锁定解除 : %s", lockName); |
|
|
|
String lock = null; |
|
|
|
for ( String lockItem : this.liquidPlateLocks ) { |
|
|
|
if ( lockItem.equals(lockName) ) { |
|
|
@ -65,7 +65,7 @@ public class LiquidAdditionInstance { |
|
|
|
if (this.liquidPlateLocks.isEmpty()) { |
|
|
|
return ; |
|
|
|
} |
|
|
|
Object nextLock = this.liquidPlateLocks.remove(0); |
|
|
|
Object nextLock = this.liquidPlateLocks.get(0); |
|
|
|
synchronized ( nextLock ) { |
|
|
|
nextLock.notify(); |
|
|
|
} |
|
|
|