[SPARK-36611] Remove unused listener in HiveThriftServer2AppStatusStore

### What changes were proposed in this pull request?

Remove unused listener in HiveThriftServer2AppStatusStore.

### Why are the changes needed?

`HiveThriftServer2AppStatusStore` provides a view of a KVStore with methods that make it easy to query SQL-specific state.

`HiveThriftServer2Listener` has no function in this class, and it should not appear in this class. We can remove it.

### Does this PR introduce _any_ user-facing change?

### How was this patch tested?

Closes #33866 from timothy65535/master.

Authored-by: timothy65535 <timothy65535@163.com>
Signed-off-by: Kent Yao <yao@apache.org>
This commit is contained in:
timothy65535 2021-08-31 11:40:34 +08:00 committed by Kent Yao
parent ebe7bb6217
commit aae7310698
4 changed files with 4 additions and 6 deletions

View file

@ -73,7 +73,7 @@ object HiveThriftServer2 extends Logging {
listener = new HiveThriftServer2Listener(kvStore, sc.conf, Some(server))
sc.listenerBus.addToStatusQueue(listener)
uiTab = if (sc.getConf.get(UI_ENABLED)) {
Some(new ThriftServerTab(new HiveThriftServer2AppStatusStore(kvStore, Some(listener)),
Some(new ThriftServerTab(new HiveThriftServer2AppStatusStore(kvStore),
ThriftServerTab.getSparkUI(sc)))
} else {
None

View file

@ -29,9 +29,7 @@ import org.apache.spark.util.kvstore.{KVIndex, KVStore}
* Provides a view of a KVStore with methods that make it easy to query SQL-specific state. There's
* no state kept in this class, so it's ok to have multiple instances of it in an application.
*/
class HiveThriftServer2AppStatusStore(
store: KVStore,
val listener: Option[HiveThriftServer2Listener] = None) {
class HiveThriftServer2AppStatusStore(store: KVStore) {
def getSessionList: Seq[SessionInfo] = {
store.view(classOf[SessionInfo]).asScala.toSeq

View file

@ -173,7 +173,7 @@ class HiveThriftServer2ListenerSuite extends SparkFunSuite with BeforeAndAfter {
if (live) {
val server = mock(classOf[HiveThriftServer2], RETURNS_SMART_NULLS)
val listener = new HiveThriftServer2Listener(kvstore, sparkConf, Some(server))
(new HiveThriftServer2AppStatusStore(kvstore, Some(listener)), listener)
(new HiveThriftServer2AppStatusStore(kvstore), listener)
} else {
(new HiveThriftServer2AppStatusStore(kvstore),
new HiveThriftServer2Listener(kvstore, sparkConf, None, false))

View file

@ -50,7 +50,7 @@ class ThriftServerPageSuite extends SparkFunSuite with BeforeAndAfter {
val sparkConf = new SparkConf
val listener = new HiveThriftServer2Listener(kvstore, sparkConf, Some(server))
val statusStore = new HiveThriftServer2AppStatusStore(kvstore, Some(listener))
val statusStore = new HiveThriftServer2AppStatusStore(kvstore)
listener.onOtherEvent(SparkListenerThriftServerSessionCreated("localhost", "sessionid", "user",
System.currentTimeMillis()))