Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perform Actions need to be a queue and thread-safe. #1

Open
dravenk opened this issue Feb 29, 2020 · 0 comments
Open

Perform Actions need to be a queue and thread-safe. #1

dravenk opened this issue Feb 29, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@dravenk
Copy link
Owner

dravenk commented Feb 29, 2020

In the base release, of course, I marked unsafe handling for Perform actions.

// Perform an Action in a goroutine.
go action.Start()

Goroutine is not a queue. Not ensuring that actions are executed in order is the wrong way to handle multiple concurrent action requests. Channels are often used in Golang to handle communication or to implement a task queue. I plan is to create a runner similar to the Java version to execute actions.

    /**
     * Thread to perform an action.
     */
    private static class ActionRunner extends Thread {
        private Action action;

        /**
         * Initialize the object.
         *
         * @param action The action to perform
         */
        public ActionRunner(Action action) {
            this.action = action;
        }

        /**
         * Perform the action.
         */
        public void run() {
            this.action.start();
        }
    }
@dravenk dravenk added the enhancement New feature or request label Feb 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant