I've written code something like this:


final static String //process status codes JUST_STARTING = "just starting", GETTING_ALONG_NOW = "going okay", DONE_BY_GOSH = "all wrapped up";

String processStatusCode = JUST_STARTING;

...

synchronized(processStatusCode){
  if (processStatusCode == JUST_STARTING){
    //do something
    processStatusCode = GETTING_ALONG_NOW;
  }else if (processStatusCode == GETTING_ALONG_NOW){
    //do something else
    processStatusCode = DONE_BY_GOSH;
  }
}

I think maybe I'm getting myself into trouble here, but I'm not quite sure. If I get a lock on the object assigned to processStatusCode and then reassign processStatusCode to point to a different object, where does my synchronization stand?

Thanks,
Rich Hammer


_______________________________________________ Juglist mailing list [EMAIL PROTECTED] http://trijug.org/mailman/listinfo/juglist_trijug.org

Reply via email to