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

I think Patrick meant putting it in executor or in Task's run method