poorbarcode commented on code in PR #25293:
URL: https://github.com/apache/pulsar/pull/25293#discussion_r2961148843
##########
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
TableView only used in `pulsar-transaction-snapshot-recover` threads; it is
safety enough
--
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]