From c665fed11821f24dc99f71f77f297d404316cb24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjetil=20=C3=98rbekk?= Date: Wed, 25 Apr 2012 11:18:51 +0200 Subject: Fix timeout bug. --- src/main/java/com/orbekk/protobuf/RpcChannel.java | 4 +++- src/test/java/com/orbekk/protobuf/ProtobufFunctionalTest.java | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/orbekk/protobuf/RpcChannel.java b/src/main/java/com/orbekk/protobuf/RpcChannel.java index 9c52651..594cff8 100644 --- a/src/main/java/com/orbekk/protobuf/RpcChannel.java +++ b/src/main/java/com/orbekk/protobuf/RpcChannel.java @@ -80,7 +80,9 @@ public class RpcChannel implements com.google.protobuf.RpcChannel { @Override public void run() { RequestMetadata request = ongoingRequests.remove(id); - cancelRequest(request, "timeout"); + if (request != null) { + cancelRequest(request, "timeout"); + } } } diff --git a/src/test/java/com/orbekk/protobuf/ProtobufFunctionalTest.java b/src/test/java/com/orbekk/protobuf/ProtobufFunctionalTest.java index a1661d2..55cb2cf 100644 --- a/src/test/java/com/orbekk/protobuf/ProtobufFunctionalTest.java +++ b/src/test/java/com/orbekk/protobuf/ProtobufFunctionalTest.java @@ -167,7 +167,7 @@ public class ProtobufFunctionalTest { final CountDownLatch stop = new CountDownLatch(1); final Rpc rpc = new Rpc(); - rpc.setTimout(1); + rpc.setTimeout(1); service.testC(rpc, request, new RpcCallback() { @Override public void run(Type2 result) { stop.countDown(); -- cgit v1.2.3