[zb4osgi-changeset] [scm] ZigBee 4 OSGi repository change: r564 - /projects/zb4osgi/trunk/zigbee.CC2530.driver/src/main/java/it/cnr/isti/zigbee/dongle/CC2530/impl/DriverCC2530.java
scm-notify at zb4osgi.aaloa.org
scm-notify at zb4osgi.aaloa.org
Tue Oct 23 18:01:21 CEST 2012
Author: stefano.lenzi
Date: Tue Oct 23 18:01:21 2012
New Revision: 564
Log:
Better log messages for identifying deadlocks
Fixed deadlock issue when exception thrown by sendSynchrouns method ( refs #159 )
Modified:
projects/zb4osgi/trunk/zigbee.CC2530.driver/src/main/java/it/cnr/isti/zigbee/dongle/CC2530/impl/DriverCC2530.java
Modified: projects/zb4osgi/trunk/zigbee.CC2530.driver/src/main/java/it/cnr/isti/zigbee/dongle/CC2530/impl/DriverCC2530.java
==============================================================================
--- projects/zb4osgi/trunk/zigbee.CC2530.driver/src/main/java/it/cnr/isti/zigbee/dongle/CC2530/impl/DriverCC2530.java (original)
+++ projects/zb4osgi/trunk/zigbee.CC2530.driver/src/main/java/it/cnr/isti/zigbee/dongle/CC2530/impl/DriverCC2530.java Tue Oct 23 18:01:21 2012
@@ -388,7 +388,16 @@
Class<?> clz = request.getClass();
Thread requestor = null;
while( (requestor = conversation3Way.get(clz) ) != null ){
- logger.debug("Waiting for {} issued by {} to complete", clz, requestor);
+ if ( requestor.isAlive() == false ) {
+ logger.error("Thread {} whom requested {} DIED before unlocking the conversation");
+ logger.debug("The thread {} who was waiting for {} to complete DIED, so we have to remove the lock");
+ conversation3Way.put(clz, null);
+ break;
+ }
+ logger.debug(
+ "{} is waiting for {} to complete which was issued by {} to complete",
+ new Object[]{Thread.currentThread(), clz, requestor}
+ );
try{
conversation3Way.wait();
}catch(InterruptedException ex){
@@ -1187,6 +1196,15 @@
}
private ZToolPacket sendSynchrouns(final HWHighLevelDriver hwDriver, final ZToolPacket request) {
+ try{
+ return uncatcheSendSynchrouns(hwDriver,request);
+ }catch(Exception ex){
+ logger.error("Catched internal exception", ex);
+ return null;
+ }
+ }
+
+ private ZToolPacket uncatcheSendSynchrouns(final HWHighLevelDriver hwDriver, final ZToolPacket request) {
final ZToolPacket[] response = new ZToolPacket[]{null};
// final int TIMEOUT = 1000, MAX_SEND = 3;
int sending = 1;
More information about the Commit
mailing list