I think that using an atomic integer for this is overkill. Why don't you extract the Closure to a private class and keep the counter as a member int you can get afterwards?