Skip to content

Android java.lang.IllegalMonitorStateException #2

@AndrewRogers1994

Description

@AndrewRogers1994

Hey I've Just come across this library as I was looking for an alternative to SignalR as I wasn't able to get it to work without requiring admin permissions or adding a urlacl.

I copied the test service (See below)

package org.GPCSL.ColourCorrector.Networking.SignalGO;

import signalgo.client.ClientDuplex;
import signalgo.client.Connector;
import signalgo.client.GoResponseHandler;
import signalgo.client.MyClass;
import signalgo.client.annotations.GoMethodName;
import signalgo.client.annotations.GoServiceName;


@GoServiceName(name = "SignalGoTestService", type = GoServiceName.GoClientType.Android, usage = GoServiceName.GoUsageType.both)
public class TestService implements ClientDuplex {
    static int a = 0;
    Connector connector = new Connector();

    public TestService() {
    }

    @GoMethodName(name = "Login", type = GoMethodName.MethodType.invoke)
    public void Login(String username, String Password) {
        connector.autoInvokeAsync(new GoResponseHandler<MyClass>() {
            @Override
            public void onResponse(MyClass t) {

            }
        }, username, Password);
    }

    void destroy() {
        connector.destroyCallBack(this);
    }


    public void getConnector(Connector c) {
        connector = c;

    }

}

And also copied the code to setup the connection (See below)

private void Register()
    {
           service = new TestService();
            connector = new Connector();
            connector.setTimeout(20000);
            connector.registerService(service);
            connector.onSocketChangeListener(new GoSocketListener() {
                @Override
                public void onSocketChange(SocketState lastState, SocketState currentState) {
                    if (lastState == SocketState.Disconnected && currentState == SocketState.Connected) {
                        service.Login("admin", "admin");
                    }
                }

                @Override
                public void socketExeption(Exception e) {

                }
            });
            connector.connectAsync("http://192.168.1.103:1199/SignalGoTestServicesProject");

        }

The issue Im having is that the application crashes after making successfully connection and issuing the request (The result is as expected server side). The exception is as follows:

FATAL EXCEPTION: Thread-8 Process: org.name, PID: 19035
va.lang.IllegalMonitorStateException: object not locked by thread before notify() 
at java.lang.Object.notify(Native Method)
at signalgo.client.util.GoClientHelper.dispose(GoClientHelper.java:92)
at signalgo.client.Connector$2.run(Connector.java:152)
at java.lang.Thread.run(Thread.java:762)

The only change I've made is to the type of the Service (type =GoServiceName.GoClientType.Android) but its the same issue if I leave it on GoServiceName.GoClientType.Java

Any Suggestions?

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