projectodd/jboss-polyglot — pull request #6 by goldmann (2013-03-21 17:52:53+00:00)
Title: Change to make replaceService returning ExecutorCompletionService

Added a way to watch the task completion in the replaceService method outside of it. The service removal is asynchronius and sometimes we need to wait for the completion. Not always the actionOnRemove parameter is sufficient.

The change introduces the use of ExecutorCompletionService and Future's in general. We use the RemoveListener to submit the task to the ExecutorCompletionService and return it in the replaceService method. This makes it possible to query ExecutorCompletionService for the completion of the task (and wait if necessary).

Additionally the RemoveListener was prepared to be extended in the future.