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

any reason to drop the naming for `runningLocally`? the correct style is to name all optional paremeters.