kevinrr888 commented on issue #4609:
URL: https://github.com/apache/accumulo/issues/4609#issuecomment-2138219654

   Yes, and also 
https://github.com/apache/accumulo/blob/0e3ed1d31fc61a981f7d05928b4696e4d737d4de/core/src/main/java/org/apache/accumulo/core/fate/Fate.java#L356
   I'm not sure about `scheduleAtFixedRate` vs `schedule` (could very well be 
better here, I'm just not familiar).
   It is scheduled to run 3 seconds later and starting the `workFinder` is done 
at the end of the constructor, so I don't think either of these are technically 
a problem. The issue came about from working on 
https://github.com/apache/accumulo/pull/4524 where I need to start a new thread 
in Fate. I can't do this from the constructor (e.g., similar to how 
`workFinder` is started) without a build failure complaining about starting a 
thread in the constructor:
   ```
   [INFO] BugInstance size is 1
   [INFO] Error size is 0
   [INFO] Total bugs: 1
   [ERROR] Medium: new org.apache.accumulo.core.fate.Fate(Object, FateStore, 
Function, AccumuloConfiguration) invokes Thread.start() 
[org.apache.accumulo.core.fate.Fate] At Fate.java:[line 353] SC_START_IN_CTOR
   [INFO] 
   ```
   Why this causes a build failure and not `workFinder.start()`, I'm not sure. 
Regardless, since I can't do it in the constructor, I call a method after 
creating the Fate to start the thread. To stay consistent, it would be better 
if all the threads were started in one method after the creation of Fate. It 
would also be safer, and I think would be more readable to create the Fate then 
call something like `startup()` (it's not obvious that the Fate constructor 
creates threads unless you look at the code)


-- 
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]

Reply via email to