log.trace("service state was set successfully (" + service_state.size() + " entries");
log.trace("service state was set successfully (" + service_state.size() + " entries)");
    public void fetchServiceInformation() throws Exception {        while(true) {            Address coord=getCoordinator(), local_address=channel != null? channel.getLocalAddress() : null;            boolean is_coord=coord != null && local_address != null && local_address.equals(coord);            if(is_coord) {                if(log.isTraceEnabled())                    log.trace("I'm coordinator, will not fetch service state information");                break;            }            ServiceInfo si=new ServiceInfo(ServiceInfo.STATE_REQ, null, null, null);            MuxHeader hdr=new MuxHeader(si);            Message state_req=new Message(coord, null, null);            state_req.putHeader(NAME, hdr);            service_state_promise.reset();            channel.send(state_req);            try {                byte[] state=(byte[])service_state_promise.getResultWithTimeout(2000);                if(state != null) {                    Map new_state=(Map)Util.objectFromByteBuffer(state);                    synchronized(service_state) {                        service_state.clear();                        service_state.putAll(new_state);                    }                    if(log.isTraceEnabled())                        log.trace("service state was set successfully (" + service_state.size() + " entries");                }                else {                    if(log.isWarnEnabled())                        log.warn("received service state was null");                }                break;            }            catch(TimeoutException e) {                if(log.isTraceEnabled())                    log.trace("timed out waiting for service state from " + coord + ", retrying");            }        }    }