for (int i = 0; i < categories.length; i++) if (categories[i].isInstance(provider)) { ok = true; registerServiceProvider(provider, i); }
category = categories[cat]; if (!category.isInstance(provider)) throw new ClassCastException(category.getName());
  public synchronized void registerServiceProvider(Object provider)  {    boolean ok = false;    if (provider == null)      throw new IllegalArgumentException();    for (int i = 0; i < categories.length; i++)      if (categories[i].isInstance(provider))        {          ok = true;          registerServiceProvider(provider, i);        }    if (!ok)      throw new IllegalArgumentException();  }