Skip to content

Improvement of sleep in loop #90

@o0lwj0o

Description

@o0lwj0o

Hi, I found an interesting case in this project.
It has “Thread.sleep()” in a “while(true)” loop. I found some discussion in Stackoverflow and other website. It can be refactored by using a executor service.
https://ejrh.wordpress.com/2012/07/13/sleeping-in-loops-considered-harmful/
https://stackoverflow.com/questions/3535754/netbeans-java-new-hint-thread-sleep-called-in-loop
or
Maybe use CountDownLatch.await to automatically awake and shutdown.

Detailed websites and lines:
286 | https://github.com/yahoo/storm-yarn/blob/master/src/main/java/com/yahoo/storm/yarn/StormOnYarn.java
160 | https://github.com/yacy/yacy_grid_mcp/blob/development/src/main/java/net/yacy/grid/mcp/Service.java
37 | https://github.com/yacy/yacy_grid_mcp/blob/development/src/main/java/net/yacy/grid/mcp/Caretaker.java

Best regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions