It looks like SerialSessionImpl.java is the class that actually handles reading 
and writing for serial data.

There is one place where it fires the messageSent event.  However, it looks 
like the equality check prevents it from actually firing that event to the 
filters unless the buffer is empty...I'm guess the == should instead be >=.

See below for the method, with the pertintent lines in red.  I haven't actually 
tried changing this and seeing if it allows writes to be logged, but it seems 
like it could be the problem.

    private void flushWrites() {
        for (; ;) {
            WriteRequest req = getCurrentWriteRequest();
            if (req == null) {
                req = getWriteRequestQueue().poll(this);
                if (req == null) {
                    break;
                }
            }

            IoBuffer buf = (IoBuffer) req.getMessage();
            if (buf.remaining() == 0) {
                setCurrentWriteRequest(null);
                buf.reset();

                this.getFilterChain().fireMessageSent(req);
                continue;
            }

            int writtenBytes = buf.remaining();
            try {
                outputStream.write(buf.array(), buf.position(), writtenBytes);
                buf.position(buf.position() + writtenBytes);
                req.getFuture().setWritten();
            } catch (IOException e) {
                this.getFilterChain().fireExceptionCaught(e);
            }
        }
    }


Christopher Popp 


      

Reply via email to