synchronized (ErrorManager.class)
synchronized (this)
  public void error(String message, Exception ex, int errorCode)  {    if (everUsed)      return;    synchronized (ErrorManager.class)    {      /* The double check is intentional. If the first check was       * omitted, the monitor would have to be entered every time       * error() method was called. If the second check was       * omitted, the code below could be executed by multiple       * threads simultaneously.       */      if (everUsed)	return;      everUsed = true;    }    String codeMsg;    switch (errorCode)    {    case GENERIC_FAILURE:      codeMsg = "GENERIC_FAILURE";      break;    case WRITE_FAILURE:      codeMsg = "WRITE_FAILURE";      break;    case FLUSH_FAILURE:      codeMsg = "FLUSH_FAILURE";      break;    case CLOSE_FAILURE:      codeMsg = "CLOSE_FAILURE";      break;    case OPEN_FAILURE:      codeMsg = "OPEN_FAILURE";      break;    case FORMAT_FAILURE:      codeMsg = "FORMAT_FAILURE";      break;    default:      codeMsg = String.valueOf(errorCode);      break;    }    System.err.println("Error upon logging: " + codeMsg);    if ((message != null) && (message.length() > 0))      System.err.println(message);    if (ex != null)      ex.printStackTrace();  }