public Tuple2<MessageState, T> get(long timeout) throws InterruptedException {
        long barrier = System.currentTimeMillis() + timeout;
        synchronized (lock) {
            while (!received) {
                long t = System.currentTimeMillis();
                if (t >= barrier) {
                    return new Tuple2<>(MessageState.TIMEOUT, null);
                }
                lock.wait(barrier - t);
            }
            return new Tuple2<>(MessageState.VALID, message);
        }
    }
Wait for up to "timeout" milliseconds for an incoming message. This hides
spurious wakeup, but InterruptedException will be propagated.

@param timeout
           maximum time to wait for message in milliseconds
@return a Pair instance containing the reason for returning and the
        message possible received
@throws InterruptedException if the waiting thread is interrupted
vespajlib/src/main/java/com/yahoo/concurrent/Receiver.java