private void onShutdown() {
        synchronized (this) {
            triggerStop();

            // if we were cancelled, skip the status update since the task may have already been
            // started somewhere else
            if (!cancelled)
                statusListener.onShutdown(id);
        }
    }
Remove all metrics published by this task.
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/WorkerTask.java