I'm a beginner and I have an assignment of making a basic chat app of two clients and a server exchanging strings which are destination+message.
I have written some code, but when I use it I'm getting this "long monitor contention event with owner method" at the other end.
Can anyone help me with how this can occur? Or can anyone tell me the cause of this in general?
It is caused by one thread holding a monitor / mutex for a long time, and blocking other threads. For example:
synchronized(lock) { /* do something that takes a long time */ }
In this case, "a long time" is 100 milliseconds or more. (This pull request is where this check was added.)
It is a warning ... but you would be advised to look into it as it is likely to lead your application being unresponsive.
In general, the cure is to reduce the length of time your application needs to hold mutexes. But, without seeing your code, it is hard to advise how you would do this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With