Skip to content

Commit

Permalink
Harden test
Browse files Browse the repository at this point in the history
  • Loading branch information
thegridman committed Nov 22, 2023
1 parent df94946 commit fa27ce2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
Expand Up @@ -1310,12 +1310,12 @@ protected void complete(BatchingOperationsQueue<Request, ?> queueRequest,
ReceiveRequest receiveRequest = (ReceiveRequest) request;
if (!receiveRequest.isBatch())
{
// this is a single request, i.e subscriber.receive();
// this is a single request, i.e. subscriber.receive();
aValues.set(cValues, null);
}
else
{
// this is a batch request, i.e subscriber.receive(100);
// this is a batch request, i.e. subscriber.receive(100);
aValues.set(cValues, Collections.emptyList());
}
cValues++;
Expand Down Expand Up @@ -1361,7 +1361,7 @@ protected void complete(BatchingOperationsQueue<Request, ?> queueRequest,
}
else
{
// this is a single request, i.e subscriber.receive();
// this is a single request, i.e. subscriber.receive();
element = queuePrefetched.poll();
// ensure we still own the channel
if (element != null && !element.isEmpty() && isOwner(element.getChannel()))
Expand Down
Expand Up @@ -58,7 +58,7 @@ public static void main(String[] args) throws Exception
catch (Throwable t)
{
Logger.info("Exception occurred waiting on receive: "
+ t.getMessage() + "\n" + subscriber);
+ t.getClass().getSimpleName() + " " + t.getMessage() + "\n" + subscriber);
if (future != null && !future.isDone())
{
try
Expand All @@ -69,8 +69,7 @@ public static void main(String[] args) throws Exception
{
try
{
Logger.info("Future completed before cancellation. message = "
+ future.get(1, TimeUnit.SECONDS));
Logger.info("Future completed before cancellation");
}
catch (Throwable e)
{
Expand All @@ -87,6 +86,16 @@ public static void main(String[] args) throws Exception
Logger.err(t);
}
}
else
{
Logger.info("Future completed after exception");
}
if (future != null && future.isDone() && !future.isCancelled() && !future.isCompletedExceptionally())
{
Element<String> element = future.get(cWaitSeconds, TimeUnit.SECONDS);
Logger.info("Received message: " + element);
s_cReceived++;
}
}
}
}
Expand Down

0 comments on commit fa27ce2

Please sign in to comment.