I have a Java class that starts up 2 separate threads. The first thread starts up fine and all the variables are correct.
When I start the second thread the global variables from thread one changes to the values set in thread 2.
I have tried adding synchronized blocks where the global variables are updated, but this did not work.
Is there a way to solve this issue? I want each thread to start up and use its own values without interference in other thread values.
EDIT:
Snippet of my Thread class:
  public abstract class ConsumerIF implements Runnable {
      public static Element root = null;
      public static String name = null;
      public static String type = null;
      public static String location = null;
      public final synchronized void reconfigure() throws FatalDistributionException {
            Document doc = builder.build(new StringReader(xmlCollector));
            root = doc.getRootElement();
            Element nameElement = root.getChild("name");
            Element typeElement = root.getChild("type");
            Element locationElement = root.getChild("location");
            Element scheduleElement = root.getChild("schedule");
            if (nameElement != null && typeElement != null && locationElement != null){
                name = nameElement.getTextTrim();
                type = typeElement.getTextTrim();
                location = locationElement.getTextTrim();
            }
      }
  }



staticthat you may have used