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

Can we also clear this after the task is run? It might be good to expose a static `remove` method in the `TaskContext` class. We should also put a warning to users never to call that method.