Open jonfinanger opened 4 years ago
What Restlet version is this? I see some problems with the most recent code, but I don't see an Object.wait
in HttpProtocolHelper.registerMethods
.
To work around this, call Engine.getInstance
in each thread before calling any other Restlet methods.
Restlet folks: Probably best not to use static synchronized
to guard access to the singleton. Also, the call to an abstract method in the constructor of ProtocolHelper
looks a bit dicey.
@jonfinanger @Tembrel you may be interested in joining the "Unofficial Restlet Community" https://gitter.im/restlet-framework/community?utm_source=share-link&utm_medium=link&utm_campaign=share-link
I have to modules (different threads) accessing restlet api in my java application. The first module uses the ClientResource and connects to a remte server. The other acts as a restserver using new Component() waiting for requests.....
The modules starts about at the same time. Once a while i experience a "freeze" in the startup of the modules. And the stacktrace shows this every time it hangs:
Module 1: ` #46 daemon prio=5 os_prio=0 tid=0x15e72000 nid=0x3444 waiting for monitor entry [0x1684f000] java.lang.Thread.State: BLOCKED (on object monitor) at org.restlet.engine.Engine.getInstance(Engine.java:249)
Module2: ` #50 daemon prio=5 os_prio=0 tid=0x15e6f400 nid=0x3774 in Object.wait() [0x167bf000] java.lang.Thread.State: RUNNABLE at org.restlet.engine.connector.HttpProtocolHelper.registerMethods(HttpProtocolHelper.java:39) at org.restlet.engine.connector.ProtocolHelper.(ProtocolHelper.java:42)
at org.restlet.engine.connector.HttpProtocolHelper.(HttpProtocolHelper.java:35)
at org.restlet.engine.Engine.registerDefaultProtocols(Engine.java:867)
at org.restlet.engine.Engine.discoverProtocols(Engine.java:680)
at org.restlet.engine.Engine.(Engine.java:492)
at org.restlet.engine.Engine.register(Engine.java:382)
The first thread is waiting for the second in a blocked state. It looks to me that the second thread is causing the blocking, but i'm not clear on why the second thread never releases the monitor