[Prévia] [Próxima] [Prévia por assunto] [Próxima por assunto]
[Índice cronológico] [Índice de assunto]

Metodos static com synchronized




Alguem pode me dizer se isto esta certo?

Quero fazer metodos "static" de uma classe serem synchronized.

class Test 
{
  private static boolean lock = false;
  
  public static lock()
  {
    synchronized(Test.class)
    {
     lock = true;
    }
  }
  
  public static unlock()
  {
    synchronized(Test.class)
    {
     lock = false;
    }
  }
}


-- 
There is no limit to what you can do
if you don't care who gets the credit.
 - Keynote