Server's MySQL DB is updated only in Debug mode
<p>I have the following server-client relationship:</p>

<p>This is the relevant part of the Server's code:</p>

<pre><code>public class Server {
public static void main(String[] args) throws IOException{
    ServerSocket server=new ServerSocket(7000);
    final ControllerInterface iController=new ControllerInterface();
    iController.initializeDatabase();
    while(true){
        final Socket socket=server.accept();
        new Thread(new Runnable() {
            public void run(){
                try{

                    PrintStream outputStream=new PrintStream(socket.getOutputStream());
                    ObjectInput objectInputStream=new ObjectInputStream(socket.getInputStream());
                    int choose=inputStream.readInt();
                    while(choose!=0){
                        switch(choose){
                        case 1:
                            Document doc=(Document)objectInputStream.readObject();
                            iController.readFromFile(doc);
                            break;
</code></pre>

<p>And this is the relevant part from the Client's code:</p>

<pre><code>private void scanBuilding(){
    String xmlFilePath=Console.readString("Please enter xml file path:");

    try{
        //get the xml file
        SAXBuilder builder = new SAXBuilder();
        File xmlFile = new File(xmlFilePath);
        Document document = (Document) builder.build(xmlFile);
        //pass xml file to controller
        objectOutputStream.writeObject(document);
        Console.printPrompt("The buildings was inserted successfully.");
    }
</code></pre>

<p>Problem is, that when I run the program normally, the Server does not recieve the object the Client is sending to it.</p>

<p>But, in debug mode, if I put breakpoint INSIDE iController's readFromFile method, it does.</p>

<p>Any ideas?</p>
