0

In my application i have created multiple Threads, In that in each thread value has been changed. so every minute i want update all threads the same value from the list..In this coding, values are not updated. previous values only retained in every thread. What is the solution?

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();
            }
        }
    }
}
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
kanna
  • 469
  • 2
  • 6
  • 10

0 Answers0