別のクラスからの計算結果に基づくメッセージを送信するサーバーを作成しようとしています。
私の質問は、計算結果が別のクラスからのものであるため、結果の準備が整うまでサーバーを一時停止するにはどうすればよいですか? また、結果をサーバー クラスに渡し、結果を送信するにはどうすればよいですか?
public class MyServer {
    ServerSocket providerSocket;
    Socket connection = null;
    static ObjectOutputStream out;
    ObjectInputStream in;
    String message;
    public static String myServerSend;
    BufferedReader data = new BufferedReader(data);
    MyServer() {}
    void run() {
        try {
        providerSocket = new ServerSocket(2013, 10);
        System.out.println("Waiting for connection");
        connection = providerSocket.accept();
        out = new ObjectOutputStream(connection.getOutputStream());
        out.flush();
        in = new ObjectInputStream(connection.getInputStream());
        do {
            try {
                message = (String) in.readObject();
                System.out.println("server receive>" + message);
                // HERE IS MY QUESTION
                // myServerSend is the result from other class, 
                                    //How can I pause the server here till myServerSend is ready???????
                sendMessage(myServerSend);
            } catch (ClassNotFoundException classnot) {
                System.err.println("Data received in unknown format");
            }
        } while (!message.equals("bye"));
    } catch (IOException ioException) {
        ioException.printStackTrace();
    }
}
    //write msg into ObjectOutputStream
public static void sendMessage(String msg) {
    try {
        out.writeObject(msg);
        out.flush();
        System.out.println("server send>" + msg);
    } catch (IOException ioException) {
        ioException.printStackTrace();
    }
}