Skip to content

Events can be delivered in the wrong order due to multi-threading #3

@garethrandall

Description

@garethrandall

When using this library to monitor events coming from a barcode scanner (which simulates keyboard keystrokes) it was found that events were delivered in the wrong order when there was high CPU load. This is because the use of a thread pool (Executors.newCachedThreadPool) to deliver each event means that delivery order is subject to when threads get run, which is not guaranteed by the JVM.

I have submitted the following pull request to change the "globalListener" to use a single thread for event delivery, which resolves the problem for the case I was dealing with. You may prefer to make wider modifications to enable in-order event delivery for "eventListeners" as well.

See: #2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions