flush_promise.setResult(Boolean.TRUE);
if(use_flush) { flush_promise.setResult(Boolean.TRUE); }
    public void down(Event evt) {        byte[] state;        Address target, requester;        StateTransferInfo info;        StateHeader hdr;        switch(evt.getType()) {            case Event.TMP_VIEW:            case Event.VIEW_CHANGE:                handleViewChange((View)evt.getArg());                break;            // generated by JChannel.getState(). currently, getting the state from more than 1 mbr is not implemented            case Event.GET_STATE:                info=(StateTransferInfo)evt.getArg();                if(info.target == null) {                    target=determineCoordinator();                }                else {                    target=info.target;                    if(target.equals(local_addr)) {                        if(log.isErrorEnabled()) log.error("GET_STATE: cannot fetch state from myself !");                        target=null;                    }                }                if(target == null) {                    if(log.isDebugEnabled()) log.debug("GET_STATE: first member (no state)");                    passUp(new Event(Event.GET_STATE_OK, new StateTransferInfo()));                }                else {                	if(use_flush)                	{                		startFlush(flush_timeout);                	}                    Message state_req=new Message(target, null, null);                    state_req.putHeader(name, new StateHeader(StateHeader.STATE_REQ, local_addr, state_id++, null, info.state_id));                    if(log.isDebugEnabled()) log.debug("GET_STATE: asking " + target + " for state");                    // suspend sending and handling of mesage garbage collection gossip messages,                    // fixes bugs #943480 and #938584). Wake up when state has been received                    if(log.isDebugEnabled())                        log.debug("passing down a SUSPEND_STABLE event");                    passDown(new Event(Event.SUSPEND_STABLE, new Long(info.timeout)));                    waiting_for_state_response=true;                    start=System.currentTimeMillis();                    passDown(new Event(Event.MSG, state_req));                }                return;                 // don't pass down any further !            case Event.GET_APPLSTATE_OK:                info=(StateTransferInfo)evt.getArg();                state=info.state;                String id=info.state_id;                synchronized(state_requesters) {                    if(state_requesters.size() == 0) {                        if(warn)                            log.warn("GET_APPLSTATE_OK: received application state, but there are no requesters !");                        return;                    }                    if(digest == null)                        if(warn) log.warn("GET_APPLSTATE_OK: received application state, but there is no digest !");                    else                        digest=digest.copy();                    if(stats) {                        num_state_reqs++;                        if(state != null)                            num_bytes_sent+=state.length;                        avg_state_size=num_bytes_sent / num_state_reqs;                    }                    Set requesters=(Set)state_requesters.get(id);                    if(requesters == null || requesters.size() == 0) {                        log.warn("received state for id=" + id + ", but there are no requesters for this ID");                    }                    else {                        for(Iterator it=requesters.iterator(); it.hasNext();) {                            requester=(Address)it.next();                            final Message state_rsp=new Message(requester, null, state);                            hdr=new StateHeader(StateHeader.STATE_RSP, local_addr, 0, digest, id);                            state_rsp.putHeader(name, hdr);                            if(trace)                                log.trace("sending state for ID=" + id + " to " + requester + " (" + state.length + " bytes)");                            // This has to be done in a separate thread, so we don't block on FC                            // (see http://jira.jboss.com/jira/browse/JGRP-225 for details). This will be reverted once                            // we have the threadless stack  (http://jira.jboss.com/jira/browse/JGRP-181)                            // and out-of-band messages (http://jira.jboss.com/jira/browse/JGRP-205)                            new Thread() {                                public void run() {                                   passDown(new Event(Event.MSG, state_rsp));                                }                            }.start();                            // passDown(new Event(Event.MSG, state_rsp));                        }                        state_requesters.remove(id);                    }                }                return;             // don't pass down any further !            case Event.SUSPEND_OK:            	flush_promise.setResult(Boolean.TRUE);            	break;                                        }        passDown(evt);              // pass on to the layer below us    }