9 Replies Latest reply: Nov 27, 2009 3:07 AM by 807580 RSS

    Is this the correct way to synchronize a block of code?

    807580
      When my classes are singletons, I simply used "synchronized(this)". However, when my class isn't a singleton I'm doing this:

      synchronized(MyClass.class) {
      //code
      }

      Is this the best way?