[KYUUBI #6627] Using concurrent collections for session operation handle set

# 🔍 Description
## Issue References 🔗

As mentioned in https://github.com/apache/kyuubi/pull/6626, the operation never idle because of periodical get operation status, but in my opinion, the operations should be closed after session closed, but it did not.

Currently, for session operation handles set, it does not use concurrent collections, I wonder there is concurrent update issue.

## Describe Your Solution 🔧

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

## Types of changes 🔖

- [x] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Test Plan 🧪

#### Behavior Without This Pull Request ⚰️

#### Behavior With This Pull Request 🎉

#### Related Unit Tests
Not needed.

---

# Checklist 📝

- [x] This patch was not authored or co-authored using [Generative Tooling](https://www.apache.org/legal/generative-tooling.html)

**Be nice. Be informative.**

Closes #6627 from turboFei/operation_set.

Closes #6627

2b80c25e1 [Wang, Fei] revert
57e4dbfa2 [Wang, Fei] using concurrent
bbd9ecf6a [Wang, Fei] use concurrent hash map

Authored-by: Wang, Fei <fwang12@ebay.com>
Signed-off-by: Wang, Fei <fwang12@ebay.com>
(cherry picked from commit 9a82eb5c12)
Signed-off-by: Wang, Fei <fwang12@ebay.com>
This commit is contained in:
Wang, Fei 2024-08-18 22:25:52 -07:00
parent 8ba7781150
commit ceb665ab67

View File

@ -17,6 +17,8 @@
package org.apache.kyuubi.session
import java.util.concurrent.ConcurrentHashMap
import scala.collection.JavaConverters._
import org.apache.kyuubi.{KyuubiSQLException, Logging}
@ -59,7 +61,7 @@ abstract class AbstractSession(
override lazy val name: Option[String] = normalizedConf.get(SESSION_NAME.key)
final private val opHandleSet = new java.util.HashSet[OperationHandle]
final private val opHandleSet = ConcurrentHashMap.newKeySet[OperationHandle]()
private def acquire(userAccess: Boolean): Unit = synchronized {
if (userAccess) {