if(block_sending && evt.getType() == Event.MSG) { synchronized(flow_control_mutex) { while(block_sending) try { if(log.isInfoEnabled()) log.info("down() blocks because block_sending == true"); flow_control_mutex.wait(); } catch(Exception ex) { } }
if(evt.getType() == Event.MSG) {  Runnable r=new Runnable() { public void run() { block_sending.whenFalse(null); } };  block_sending.whenTrue(r);
    public void down(Event evt) {        if(evt == null) return;        // only block for messages; all other events are passed through        if(block_sending && evt.getType() == Event.MSG) {            synchronized(flow_control_mutex) {                while(block_sending)                    try {                        if(log.isInfoEnabled()) log.info("down() blocks because block_sending == true");                        flow_control_mutex.wait();                    }                    catch(Exception ex) {                    }            }        }        // handle setting of additional data (kludge, will be removed soon)        if(evt.getType() == Event.CONFIG) {            try {                Map m=(Map)evt.getArg();                if(m != null && m.containsKey("additional_data")) {                    additional_data=(byte[])m.get("additional_data");                }            }            catch(Throwable t) {                if(log.isErrorEnabled()) log.error("CONFIG event did not contain a hashmap: " + t);            }        }        if(prot_stack != null)            prot_stack.down(evt);        else            if(log.isErrorEnabled()) log.error("no protocol stack available");    }