private void receivePaymentAck(Protos.PaymentAck paymentAck) { SettableFuture<PaymentIncrementAck> future; Coin value; lock.lock(); try { if (increasePaymentFuture == null) return; checkNotNull(increasePaymentFuture, "Server sent a PAYMENT_ACK with no outstanding payment"); log.info("Received a PAYMENT_ACK from the server"); future = increasePaymentFuture; value = lastPaymentActualAmount; } finally { lock.unlock(); } // Ensure the future runs without the client lock held. future.set(new PaymentIncrementAck(value, paymentAck.getInfo())); }
assertTrue(future.isDone()); final PaymentIncrementAck paymentIncrementAck = future.get(); assertEquals("Wrong value returned from increasePayment", CENT, paymentIncrementAck.getValue()); assertEquals("Wrong info returned from increasePayment", ByteString.copyFromUtf8(CENT.toPlainString()), paymentIncrementAck.getInfo());
final PaymentIncrementAck ack = client.incrementPayment(CENT, bytes, userKeySetup).get(); if (info != null) { final ByteString ackInfo = ack.getInfo(); assertNotNull("Ack info is null", ackInfo); assertEquals("Ack info differs ", info, ackInfo.toStringUtf8());
private void receivePaymentAck(Protos.PaymentAck paymentAck) { SettableFuture<PaymentIncrementAck> future; Coin value; lock.lock(); try { if (increasePaymentFuture == null) return; checkNotNull(increasePaymentFuture, "Server sent a PAYMENT_ACK with no outstanding payment"); log.info("Received a PAYMENT_ACK from the server"); future = increasePaymentFuture; value = lastPaymentActualAmount; } finally { lock.unlock(); } // Ensure the future runs without the client lock held. future.set(new PaymentIncrementAck(value, paymentAck.getInfo())); }
private void receivePaymentAck(Protos.PaymentAck paymentAck) { SettableFuture<PaymentIncrementAck> future; Coin value; lock.lock(); try { if (increasePaymentFuture == null) return; checkNotNull(increasePaymentFuture, "Server sent a PAYMENT_ACK with no outstanding payment"); log.info("Received a PAYMENT_ACK from the server"); future = increasePaymentFuture; value = lastPaymentActualAmount; } finally { lock.unlock(); } // Ensure the future runs without the client lock held. future.set(new PaymentIncrementAck(value, paymentAck.getInfo())); } }
private void receivePaymentAck(Protos.PaymentAck paymentAck) { SettableFuture<PaymentIncrementAck> future; Coin value; lock.lock(); try { if (increasePaymentFuture == null) return; checkNotNull(increasePaymentFuture, "Server sent a PAYMENT_ACK with no outstanding payment"); log.info("Received a PAYMENT_ACK from the server"); future = increasePaymentFuture; value = lastPaymentActualAmount; } finally { lock.unlock(); } // Ensure the future runs without the client lock held. future.set(new PaymentIncrementAck(value, paymentAck.getInfo())); } }