Hi.. I am asking this because I need to shutdown some pubsub queues only 
after all requests being served are completed (Some request might consume 
or produce messages). Right now I implemented a filter to count those 
requests and here is its code:

public class CurrentRequestCountFilter implements ContainerRequestFilter, 
ContainerResponseFilter {

private final AtomicInteger currentRequestCount;

@Inject
public CurrentRequestCountFilter(AtomicInteger currentRequestCount) {
this.currentRequestCount = currentRequestCount;
}

public void filter(ContainerRequestContext containerRequestContext) {
int currentCount = currentRequestCount.incrementAndGet();
}

@Override
public void filter(
ContainerRequestContext containerRequestContext,
ContainerResponseContext containerResponseContext) {
int currentCount = currentRequestCount.decrementAndGet();
}
}

-- 
You received this message because you are subscribed to the Google Groups 
"dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dropwizard-user/fa376b7f-2587-45c7-863c-3593351b5c02n%40googlegroups.com.

Reply via email to