public String handleGet(KVMessage msg) throws KVException {
    	// wait until all slaves register before servicing any requests
    	if (slaves.size() < numSlaves) {
        	lock.lock();
        	try {
        		enoughSlaves.await();
        	}
        	catch (Exception ex) {        		
        	}
        	finally {
        		lock.unlock();
        	}
        }
    	
    	Lock lock = masterCache.getLock(msg.getKey());
    	String key = msg.getKey();
    	String value = null;
    	
    	try {
    		lock.lock();
    		
    		value = masterCache.get(msg.getKey());
    		
    		if (value == null) {
    			TPCSlaveInfo slave = findFirstReplica(key);
    			value = handleGetBySlave(msg , slave);
    			
    			if (value == null) {
    				slave = findSuccessor(slave);
    				value = handleGetBySlave(msg , slave);
    			}    		
    		}
    		
    		if (value != null) {
    			masterCache.put(key , value);
    		}
    	}
    	finally {
    		lock.unlock();
    	}
    	
    	if (value == null) {
    		throw new KVException(KVConstants.ERROR_NO_SUCH_KEY);
    	}
    	
        return value;
    }