lhotari commented on code in PR #25293:
URL: https://github.com/apache/pulsar/pull/25293#discussion_r2958630156
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SystemTopicTxnBufferSnapshotService.java:
##########
@@ -173,4 +177,14 @@ public void close() throws Exception {
refCountedWriterMap.clear();
}
+ public TableView<T> getTableView(ScheduledExecutorService
scheduledExecutor) {
+ TableView<T> tableView = tableViewThreadLocal.get();
+ if (tableView == null) {
+ tableView = new TableView<>(this::createReader,
+ pulsarClient.getConfiguration().getOperationTimeoutMs(),
scheduledExecutor);
+ tableViewThreadLocal.set(tableView);
+ }
+ return tableView;
+ }
Review Comment:
Using a ThreadLocal for this purpose seems brittle. Is there really a need
to have independent TableView instances for different threads? If there isn't,
this doesn't seem to be the correct solution.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]