0

私のアプリケーションでは、複数のスレッドを作成しました。各スレッドの値が変更されています。したがって、毎分すべてのスレッドをリストから同じ値に更新したい..このコーディングでは、値は更新されません。以前の値はすべてのスレッドでのみ保持されます。解決策は何ですか?

public static class updateClient implements Runnable {
    public static void doUpadte(Map<String, String> list) {
        final Map<String, String> liHashMap = list;
        SwingUtilities.invokeLater(new Runnable() {

            @Override
            public void run() {
                // TODO Auto-generated method stub
                for (Entry<String, String> entry : liHashMap.entrySet()) {
                    String client_Name=entry.getKey();
                    taNames.append(client_Name + "\n");
                }       
            }
        });
    }

    @Override
    public void run() {
        // TODO Auto-generated method stub
        while(true) {
            try {
                Thread.sleep(5000);
                doUpadte(list);
            }
            catch (Exception e) {
                // TODO: handle exception
                e.printStackTrace();
            }
        }
    }
}
4

0 に答える 0