I have a strange bug (Microsoft feature) that is driving me crazy
My application works fine in single user mode, however...
In network mode, I'm using a multi-threaded socket server.
The client portion is a new thread spawned from the GUI, this client thread waits until an object is received from the GUI, wakes up, sends this serialized object to the server via objectOutputStream.writeObject(message); objectOutputStream.flush();
The server is waiting (objectInputStream) to read an incomming message
When the server receives the message from the client, it figures out what type of message (object) this is and calls the corresponding remote data access wrapper method (with said message), which in turn calls the appropriate local data access method, the results from the local data access method are then attached to the message via setters, this message is then sent back to the client.
The issue is this, in the FindRemote class I have a String array inside the class that is initialized when the class in instantiated (from search criteria from the search screen), this FindRemote instance is then sent to the server via the client, (the criteria can be pretty complex), no matter how complex the search criteria, the correct records come back (the first try), on the second and subsequent attempts though, the same records that match the original criteria come back, I attempted to debug by printing out the search criteria before just sending the message to the server (Client objectOutputStream(message) and it is what is expected, on the server side the first time thru right after the objectInputStream the criteria matches what was sent from the client, however and subsequent tries, the client prints out the original search criteria.
I can even go and delete records, and then go back an search again, however the original search criteria still comes up.
Hard to tell from what you have described, and I don't think it is related to the code you have posted.
It sounds like you are doing something in your constructor of your FindRemote class (which will not get called since the instance of FindRemote is not constructed but deserialized) - possibly you could resolve this by overriding the readObject method.
Does that give you a hint?
If not, do you want to post some of the code for the FindRemote class?
Thanks It turned out to be objectOutputStream.reset(); after the write and flush after writing to the Stream. It drove me crazy for three days. It seems that the original object is sent even if you null it out and create and send a new one (unless you reset the Stream)
Live ordinary life in an extraordinary way. Details embedded in this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop