Improvement #19

Bug #18: ZToolPacketParser hard to kill

Detecting if blocking IO degrad has any drawback compared to pooling

Added by Stefano Lenzi over 7 years ago. Updated about 7 years ago.

Status:New Start date:09/23/2010
Priority:Low Due date:
Assignee:Stefano Lenzi % Done:

0%

Category:zigbee.cc2480.datalink Spent time: 0.15 hour
Target version:org.aaloa.zb4osgi.zigbee.cc2480.datalink-1.X Estimated time:2.00 hours
Has a patch:No Has license agreement signed:No

Description

At the moment the internal Thread of ZToolPacketParser pool every 10 minutes the bytes from the InputStream (usally an serial port). We should cosider to used the Blocking IO instead if it doesn't degrade performance or has other drawbacks.

References:
while(!done){
        try {
                if (in.available() > 0) {
                        val = in.read();
                        [...]
                }else{
                        [...]
                        synchronized (this) {
                                // There's a chance that we got notified after the first in.available check
                                if (in.available() > 0) {
                                        continue;
                                }

                                // serial event will wake us up
                                this.wait( 10 minutes );
                        }
                        [...]
                }
        } catch(InterruptedException ie) {
                break;
        }
}

in

    int read(InputStream in) throws IOException {

        int b;
        while ((b=in.read()) == -1) {
            try { Thread.sleep(10); } catch (InterruptedException e) { }

        }

        return b;

    }

History

#1 Updated by Stefano Lenzi over 7 years ago

Idenfied the issue while working on r32

#2 Updated by Stefano Lenzi over 7 years ago

  • Target version changed from org.aal-persona.zigbee.cc2480.datalink-0.6.0 to unplanned

Deadline for release has been expired moving this issue to next release

#3 Updated by Stefano Lenzi over 7 years ago

  • Target version changed from unplanned to org.aaloa.zb4osgi.zigbee.cc2480.datalink-0.7.0

#4 Updated by Stefano Lenzi about 7 years ago

  • Target version changed from org.aaloa.zb4osgi.zigbee.cc2480.datalink-0.7.0 to org.aaloa.zb4osgi.zigbee.cc2480.datalink-1.X

Moved to the next release cycle

Also available in: Atom PDF