I have a big problem to resolve and I don’t know how to resolve it. In a thread server I call on a object the method wait() after using ObjectOutputStream send the object to a client thread that is connected to the server. When the object arrives on the other side I call on the object the method notify() but the object doesn’t wake up from his state of waiting. This is caused because the object sent it isn’t the same. How can I resolve this big issue?
I have a big problem to resolve and I don’t know how to resolve
Share
Irrespective of whether the client and server are on two different machines / JVMs, the object you get after serialization – deserialization is different than the original object.
When you call “wait()” on one object, the thread blocks until some other thread call notify() on the SAME object.
You are having two different objects here and so, wait-notify mechanism won’t work.
You have to send some acknowledgement to the server using network communication ( sockets may be).