[SPARK-22454][CORE] ExternalShuffleClient.close() should check clientFactory null
authorYuming Wang <wgyumg@gmail.com>
Tue, 7 Nov 2017 08:30:58 +0000 (08:30 +0000)
committerSean Owen <sowen@cloudera.com>
Tue, 7 Nov 2017 08:30:58 +0000 (08:30 +0000)
commit9df08e218cfd4dd91bc407b98528b74f452f34f8
tree058ca14351789c53973dad2f16c9f2c5e8a05cc4
parent14a32a647a019ed45793784069fbf077b9c45e60
[SPARK-22454][CORE] ExternalShuffleClient.close() should check clientFactory null

## What changes were proposed in this pull request?

`ExternalShuffleClient.close()` should check `clientFactory` null. otherwise it will throw NPE sometimes:
```
17/11/06 20:08:05 ERROR Utils: Uncaught exception in thread main
java.lang.NullPointerException
at org.apache.spark.network.shuffle.ExternalShuffleClient.close(ExternalShuffleClient.java:152)
at org.apache.spark.storage.BlockManager.stop(BlockManager.scala:1407)
at org.apache.spark.SparkEnv.stop(SparkEnv.scala:89)
at org.apache.spark.SparkContext$$anonfun$stop$11.apply$mcV$sp(SparkContext.scala:1849)
```

## How was this patch tested?
manual tests

Author: Yuming Wang <wgyumg@gmail.com>

Closes #19670 from wangyum/SPARK-22454.
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleClient.java