Skip to content

UsingLatches always prints All services up and running #11

Description

@HalfWeight

The UsingLatches implementation always prints "All services up and running!", regardless of whether all services have actually started.

The code calls latch.await(2, TimeUnit.SECONDS) but does not check its boolean return value. If await() returns false, it indicates that not all services have completed initialization within the timeout, yet the message "All services up and running!" is still printed.

Expected Behavior:

If await() returns true, then print "All services up and running!".
If await() returns false, print that not all services are up and running

boolean awaitResult = latch.await(2, TimeUnit.SECONDS);
if(awaitResult)
System.out.println("All services up and running!");
else
System.out.println("No all services are up and running! Missing: " + (totalServices - latch.getCount()));

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions