#MyEvent cannot be triggered asynchronously from another thread.

1 messages · Page 1 of 1 (latest)

fickle wharf
#

my code: https://github.com/austin1965/MinecraftHttpPlugin

I am getting the below error while trying to receive an HTTP request and trigger a time change in game

[14:30:06] [HTTP-Dispatcher/INFO]: [Testing] -------------BEGIN REQUEST-------------
[14:30:06] [HTTP-Dispatcher/INFO]: [Testing] Method:GET
[14:30:06] [HTTP-Dispatcher/INFO]: [Testing] URI:
/test
[14:30:06] [HTTP-Dispatcher/INFO]: [Testing] Headers:
Headers { {} }
[14:30:06] [HTTP-Dispatcher/INFO]: [Testing] Body:
sun.net.httpserver.FixedLengthInputStream@631c6c44
[14:30:06] [HTTP-Dispatcher/INFO]: [Testing] --------------END REQUEST--------------
[14:30:06] [HTTP-Dispatcher/INFO]: [Testing] before
[14:30:06] [HTTP-Dispatcher/INFO]: [Testing] MyEvent cannot be triggered asynchronously from another thread.
[14:30:06] [HTTP-Dispatcher/INFO]: [Testing] after

It looks related to an event in SimplePluginManager class. I am not sure why / what to do about it.

    @Override
    public void callEvent(@NotNull Event event) {
        if (event.isAsynchronous()) {
            if (Thread.holdsLock(this)) {
                throw new IllegalStateException(event.getEventName() + " cannot be triggered asynchronously from inside synchronized code.");
            }
            if (server.isPrimaryThread()) {
                throw new IllegalStateException(event.getEventName() + " cannot be triggered asynchronously from primary server thread.");
            }
        } else {
            if (!server.isPrimaryThread()) {
                throw new IllegalStateException(event.getEventName() + " cannot be triggered asynchronously from another thread.");
            }
        }

        fireEvent(event);
    }