use of io.joynr.exceptions.JoynrTimeoutException in project joynr by bmwcarit.
the class ReplyCallerDirectory method removeExpiredReplyCaller.
private void removeExpiredReplyCaller(String requestReplyId) {
ReplyCaller outstandingReplyCaller = remove(requestReplyId);
if (outstandingReplyCaller == null) {
// this happens, when a reply was already received and the replyCaller has been removed.
return;
}
logger.debug("Replycaller with requestReplyId {} was removed because TTL expired", requestReplyId);
// notify the caller that the request has expired now
outstandingReplyCaller.error(new JoynrTimeoutException(System.currentTimeMillis()));
}
use of io.joynr.exceptions.JoynrTimeoutException in project joynr by bmwcarit.
the class AbstractProviderProxyEnd2EndTest method asyncMethodCallWithTtlExpiring.
@Ignore
@Test(timeout = CONST_DEFAULT_TEST_TIMEOUT)
public void asyncMethodCallWithTtlExpiring() throws DiscoveryException, JoynrIllegalStateException, InterruptedException, ApplicationException {
ProxyBuilder<testProxy> proxyBuilder = consumerRuntime.getProxyBuilder(domain, testProxy.class);
long ttl = 2000L;
MessagingQos testMessagingQos = new MessagingQos(ttl);
DiscoveryQos testDiscoveryQos = new DiscoveryQos(30000, ArbitrationStrategy.HighestPriority, Long.MAX_VALUE);
testProxy proxyShortTll = proxyBuilder.setMessagingQos(testMessagingQos).setDiscoveryQos(testDiscoveryQos).build();
// the provider waits ttl before responding, causing a ttl
boolean timeoutExceptionThrown = false;
// the ttl parameter tells the provider to wait this long before
// replying, thereby forcing a ttl exception
Future<String> waitTooLongFuture = proxyShortTll.waitTooLong(callback, ttl * 2);
try {
// should never have to wait
waitTooLongFuture.get(10 * ttl);
// this long
// the JoynWaitExpiredException should not be thrown.
} catch (JoynrWaitExpiredException e) {
timeoutExceptionThrown = false;
} catch (JoynrTimeoutException e) {
timeoutExceptionThrown = true;
}
assertEquals(true, timeoutExceptionThrown);
assertEquals(RequestStatusCode.ERROR, waitTooLongFuture.getStatus().getCode());
verify(callback).onFailure(any(JoynrRuntimeException.class));
verifyNoMoreInteractions(callback);
}
use of io.joynr.exceptions.JoynrTimeoutException in project joynr by bmwcarit.
the class SerializationTest method serializeReplyWithJoynrTimeoutException.
@Test
public void serializeReplyWithJoynrTimeoutException() throws IOException {
JoynrTimeoutException error = new JoynrTimeoutException(42);
Reply reply = new Reply(UUID.randomUUID().toString(), error);
String writeValueAsString = objectMapper.writeValueAsString(reply);
System.out.println(writeValueAsString);
Reply receivedReply = objectMapper.readValue(writeValueAsString, Reply.class);
Assert.assertEquals(reply, receivedReply);
}
Aggregations