[SPARK-3543] Write TaskContext in Java and expose it through a static accessor.

We don't have the deprecation instructions any more - can you add them to the Javadoc? We should direct users to addTaskCompletionListener