Commit a512cb1
committed
Optimize addMonitoredItem with O(1) lookup and fix concurrency
- Change itemsToDelete from ArrayList to ConcurrentHashMap-backed Set
for thread-safe operations and O(1) removal
- Rewrite addMonitoredItem to use direct map lookup instead of
containsValue O(n) scan
- Handle three cases explicitly: item already in map, item pending
deletion, and brand-new item1 parent a46410f commit a512cb1
File tree
1 file changed
+23
-10
lines changed- opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/subscriptions
1 file changed
+23
-10
lines changedLines changed: 23 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
| 72 | + | |
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
| |||
313 | 314 | | |
314 | 315 | | |
315 | 316 | | |
316 | | - | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
317 | 328 | | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
322 | 336 | | |
323 | | - | |
| 337 | + | |
324 | 338 | | |
325 | | - | |
326 | | - | |
327 | | - | |
| 339 | + | |
| 340 | + | |
328 | 341 | | |
329 | 342 | | |
330 | 343 | | |
| |||
0 commit comments