refactor; and add completexContext/failedContext/ContextMessage handlers

you can probably use `java.util.Collections.synchronizedMap()`