class ReIndexerManagement implements ReIndexerManagementMBean {

    @Override
    public void reIndex(String namespace, String user, String name) throws MailboxException {
        try (Closeable closeable =
                 MDCBuilder.create()
                     .addContext(MDCBuilder.PROTOCOL, "CLI")
                     .addContext(MDCBuilder.ACTION, "reIndex")
                     .build()) {
            TaskId taskId = taskManager.submit(reIndexer.reIndex(new MailboxPath(namespace, Username.of(user), name), RunningOptions.DEFAULT));
            taskManager.await(taskId, Duration.ofMillis(Long.MAX_VALUE));
        } catch (IOException | TaskManager.ReachedTimeoutException e) {
            throw new RuntimeException(e);
        }
    }

    @Inject public  ReIndexerManagement(TaskManager taskManager, @Named("reindexer") ReIndexer reIndexer);

}