code: public static synchronized AccountManager getInstance(XMPPConnection connection) {
          AccountManager accountManager = INSTANCES.get(connection);
          if (accountManager == null) {
              accountManager = new AccountManager(connection);
              INSTANCES.put(connection, accountManager);
          }
          return accountManager;
      }
docs: Returns the AccountManager instance associated with a given XMPPConnection.
  
  @param connection the connection used to look for the proper ServiceDiscoveryManager.
  @return the AccountManager associated with a given XMPPConnection.