synchronized (clusterToInstance) { List instances = (List) clusterToInstance.get (getClusterName ()); if (instances == null) { clusterToInstance.put (getClusterName (), instances = new ArrayList ()); } instances.add (this); }
  protected void setProblemName () {    synchronized (clusterToInstance) {      List instances = (List) clusterToInstance.get (getClusterName ());      if (instances == null) {	clusterToInstance.put (getClusterName (), instances = new ArrayList ());      }      instances.add (this);    }    try {      if (getMyParams().hasParam("problemName"))	myProblem = getMyParams().getStringParam("problemName");      else { 	myProblem = getClusterName();	synchronized (clusterToInstance) {	  if (((List) clusterToInstance.get (getClusterName ())).size () > 1) {	    myProblem = myProblem + "_" + 	      ((List) clusterToInstance.get (getClusterName ())).indexOf (this);	    if (logger.isDebugEnabled())	      logger.debug (getName ()+ ".localSetup - this " + this + " is " + 			    ((List) clusterToInstance.get (getClusterName ())).indexOf (this) +			    " of " + 			    ((List) clusterToInstance.get (getClusterName ())).size ());	  }	}	// mysql doesn't like -'s	myProblem = myProblem.replace('-', '_');      }    } catch (Exception e) {}	    try {      String machineName = java.net.InetAddress.getLocalHost().getHostName ().replace('-', '_');      if (machineName.indexOf('.') != -1) {	machineName = machineName.substring (0, machineName.indexOf('.'));      }      machineName = machineName.replace('.', '_');      myProblem = myProblem + "_" + machineName;    }    catch (UnknownHostException uhe) {      logger.error (getName () + ".localSetup - Huh? Could not find localhost? " +		    uhe.getMessage (), uhe);    }  }