Github user francisco-perez-sorrosal commented on a diff in the pull request:
https://github.com/apache/incubator-omid/pull/3#discussion_r73977366
--- Diff:
tso-server/src/main/java/org/apache/omid/tso/PersistenceProcessorImpl.java ---
@@ -83,7 +86,9 @@
ThreadFactoryBuilder threadFactory = new
ThreadFactoryBuilder().setNameFormat("persist-%d");
this.disruptorExec =
Executors.newFixedThreadPool(config.getNumConcurrentCTWriters(),
threadFactory.build());
- this.disruptor = new Disruptor<>(EVENT_FACTORY, 1 << 20,
disruptorExec , SINGLE, new BusySpinWaitStrategy());
+ this.disruptor = new Disruptor<>(EVENT_FACTORY, 1 << 20,
disruptorExec , SINGLE,
--- End diff --
I think you forgot to add the first part of my comment. Instead of creating
each strategy explicitly in each *ProcessorImpl class, we inject the
WaitStrategy in it (that's why we add it to the `DisruptorModule` above.) So
for this class should be:
```java
@Inject
PersistenceProcessorImpl(TSOServerConfig config,
@Named("PersistenceStrategy") WaitStrategy
strategy, // <-- Strategy is injected here
CommitTable commitTable,
ObjectPool<Batch> batchPool,
Panicker panicker,
PersistenceProcessorHandler[] handlers,
MetricsRegistry metrics)
throws Exception {
//
------------------------------------------------------------------------------------------------------------
// Disruptor initialization
//
------------------------------------------------------------------------------------------------------------
ThreadFactoryBuilder threadFactory = new
ThreadFactoryBuilder().setNameFormat("persist-%d");
this.disruptorExec =
Executors.newFixedThreadPool(config.getNumConcurrentCTWriters(),
threadFactory.build());
this.disruptor = new Disruptor<>(EVENT_FACTORY, 1 << 20,
disruptorExec , SINGLE, strategy); // <-- Use injected strategy here
...
```
Please remove my comments, if you cut and paste.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---