org.eclipse.osgi_3.8.2.v20130124-134944

edServiceListener)localIterator.next();
      oldFilteredListener.markRemoved();
    }
    notifyListenerHooks(asListenerInfos(removedListeners), false);
  }
  
  private static Collection<ListenerHook.ListenerInfo> asListenerInfos(Collection<? extends ListenerHook.ListenerInfo> c)
  {
    return c;
  }
  
  public void publishServiceEvent(final ServiceEvent event)
  {
    if (System.getSecurityManager() == null) {
      publishServiceEventPrivileged(event);
    } else {
      AccessController.doPrivileged(new PrivilegedAction()
      {
        public Object run()
        {
          publishServiceEventPrivileged(event);
          return null;
        }
      });
    }
  }
  
  void publishServiceEventPrivileged(ServiceEvent event)
  {
    synchronized (serviceEventListeners)
    {
      Map<BundleContextImpl, Set<Map.Entry<ServiceListener, FilteredServiceListener>>> listenerSnapshot = new HashMap(serviceEventListeners.size());
      for (Iterator localIterator1 = serviceEventListeners.entrySet().iterator(); localIterator1.hasNext();)
      {
        Map.Entry<BundleContextImpl, CopyOnWriteIdentityMap<ServiceListener, FilteredServiceListener>> entry = (Map.Entry)localIterator1.next();
        CopyOnWriteIdentityMap<ServiceListener, FilteredServiceListener> listeners = (CopyOnWriteIdentityMap)entry.getValue();
        if (!listeners.isEmpty()) {
          listenerSnapshot.put((BundleContextImpl)entry.getKey(), listeners.entrySet());
        }
      }
    }
    Map<BundleContextImpl, Set<Map.Entry<ServiceListener, FilteredServiceListener>>> listenerSnapshot;
    Collection<BundleContext> contexts = asBundleContexts(listenerSnapshot.keySet());
    notifyEventHooksPrivileged(event, contexts);
    if (listenerSnapshot.isEmpty()) {
      return;
    }
    Map<BundleContext, Collection<ListenerHook.ListenerInfo>> listeners = new ShrinkableValueCollectionMap(listenerSnapshot);
    notifyEventListenerHooksPrivileged(event, listeners);
    if (listenerSnapshot.isEmpty()) {
      return;
    }
    Object queue = framework.newListenerQueue();
    for (Iterator localIterator2 = listenerSnapshot.entrySet().iterator(); localIterator2.hasNext();)
    {
      Map.Entry<BundleContextImpl, Set<Map.Entry<ServiceListener, FilteredServiceListener>>> entry = (Map.Entry)localIterator2.next();
      
      EventDispatcher<ServiceListener, FilteredServiceListener, ServiceEvent> dispatcher = (EventDispatcher)entry.getKey();
      Set<Map.Entry<ServiceListener, FilteredServiceListener>> listenerSet = (Set)entry.getValue();
      ((ListenerQueue)queue).queueListeners(listenerSet, dispatcher);
    }
    ((ListenerQueue)queue).dispatchEventSynchronous(3, event);
  }
  
  private static Collection<BundleContext> asBundleContexts(Collection<? extends BundleContext> c)
  {
    return c;
  }
  
  synchronized long getNextServiceId()
  {
    long id = serviceid;
    serviceid = (id + 1L);
    return id;
  }
  
  void addServiceRegistration(BundleContextImpl context, ServiceRegistrationImpl<?> registration)
  {
    assert (Thread.holdsLock(this));
    
    List<ServiceRegistrationImpl<?>> contextServices = (List)publishedServicesByContext.get(context);
    if (contextServices == null)
    {
      contextServices = new ArrayList(10);
      publishedServicesByContext.put(context, contextServices);
    }
    contextServices.add(registration);
    String[] arrayOfString;
    int j = (arrayOfString = registration.getClasses()).length;
    for (int i = 0; i < j; i++)
    {
      String clazz = arrayOfString[i];
      List<ServiceRegistrationImpl<?>> services = (List)publishedServicesByClass.get(clazz);
      if (services == null)
      {
        services = new ArrayList(10);
        publishedServicesByClass.put(clazz, services);
      }
      int insertIndex = -Collections.binarySearch(services, registration) - 1;
      services.add(insertIndex, registration);
    }
    int insertIndex = -Collections.binarySearch(allPublishedServices, registration) - 1;
    allPublishedServices.add(insertIndex, registration);
  }
  
  void modifyServiceRegistration(BundleContextImpl context, ServiceRegistrationImpl<?> registration)
  {
    assert (Thread.holdsLock(this));
    String[] arrayOfString;
    int j = (arrayOfString = registration.getClasses()).length;
    for (int i = 0; i < j; i++)
    {
      String clazz = arrayOfString[i];
      List<ServiceRegistrationImpl<?>> services = (List)publishedServicesByClass.get(clazz);
      services.remove(registration);
      
      int insertIndex = -Collections.binarySearch(services, registration) - 1;
      services.add(insertIndex, registration);
    }
    allPublishedServices.remove(registration);
    
    int insertIndex = -Collections.binarySearch(allPublishedServices, registration) - 1;
    allPublishedServices.add(insertIndex, registration);
  }
  
  void removeServiceRegistration(BundleContextImpl context, ServiceRegistrationImpl<?> registration)
  {
    assert (Thread.holdsLock(this));
    
    List<ServiceRegistrationImpl<?>> contextServices = (List)publishedServicesByContext.get(context);
    if (contextServices != null) {
      contextServices.remove(registration);
    }
    String[] arrayOfString;
    int j = (arrayOfString = registration.getClasses()).length;
    for (int i = 0; i < j; i++)
    {
      String clazz = arrayOfString[i];
      List<ServiceRegistrationImpl<?>> services = (List)publishedServicesByClass.get(clazz);
      services.remove(registration);
      if (services.isEmpty()) {
        publishedServicesByClass.remove(clazz);
      }
    }
    allPublishedServices.remove(registration);
  }
  
  private List<ServiceRegistrationImpl<?>> lookupServiceRegistrations(String clazz, Filter filter)
  {
    synchronized (this)
    {
      List<ServiceRegistrationImpl<?>> result;
      if (clazz == null) {
        result = allPublishedServices;
      } else {
        result = (List)publishedServicesByClass.get(clazz);
      }
      if ((result == null) || (result.isEmpty()))
      {
        List<ServiceRegistrationImpl<?>> empty = Collections.EMPTY_LIST;
        return empty;
      }
      List<ServiceRegistrationImpl<?>> result = new LinkedList(result);
    }
    List<ServiceRegistrationImpl<?>> result;
    if (filter == null) {
      return result;
    }
    for (Iterator<ServiceRegistrationImpl<?>> iter = result.iterator(); iter.hasNext();)
    {
      ServiceRegistrationImpl<?> registration = (ServiceRegistrationImpl)iter.next();
      try
      {
        reference = registration.getReferenceImpl();
      }
      catch (IllegalStateException localIllegalStateException)
      {
        ServiceReferenceImpl<?> reference;
        iter.remove();
        continue;
      }
      ServiceReferenceImpl<?> reference;
      if (!filter.match(reference)) {
        iter.remove();
      }
    }
    return result;
  }
  
  private synchronized List<ServiceRegistrationImpl<?>> lookupServiceRegistrations(BundleContextImpl context)
  {
    List<ServiceRegistrationImpl<?>> result = (List)publishedServicesByContext.get(context);
    if ((result == null) || (result.isEmpty()))
    {
      List<ServiceRegistrationImpl<?>> empty = Collections.EMPTY_LIST;
      return empty;
    }
    return new ArrayList(result);
  }
  
  private synchronized void removeServiceRegistrations(BundleContextImpl context)
  {
    publishedServicesByContext.remove(context);
  }
  
  private static void checkRegisterServicePermission(String[] names)
  {
    SecurityManager sm = System.getSecurityManager();
    if (sm == null) {
      return;
    }
    int i = 0;
    for (int len = names.length; i < len; i++) {
      sm.checkPermission(new ServicePermission(names[i], "register"));
    }
  }
  
  private static void checkGetServicePermission(ServiceReference<?> reference)
  {
    SecurityManager sm = System.getSecurityManager();
    if (sm == null) {
      return;
    }
    sm.checkPermission(new ServicePermission(reference, "get"));
  }
  
  static boolean hasListenServicePermission(ServiceEvent event, BundleContextImpl context)
  {
    ProtectionDomain domain = context.getBundleImpl().getProtectionDomain();
    if (domain == null) {
      return true;
    }
    return domain.implies(new ServicePermission(event.getServiceReference(), "get"));
  }
  
  static String checkServiceClass(String[] clazzes, Object serviceObject)
  {
    ClassLoader cl = (ClassLoader)AccessController.doPrivileged(new PrivilegedAction()
    {
      public ClassLoader run()
      {
        return getClass().getClassLoader();
      }
    });
    int i = 0;
    for (int len = clazzes.length; i < len; i++) {
      try
      {
        Class<?> serviceClazz = cl == null ? Class.forName(clazzes[i]) : cl.loadClass(clazzes[i]);
        if (!serviceClazz.isInstance(serviceObject)) {
          return clazzes[i];
        }
      }
      catch (ClassNotFoundException localClassNotFoundException)
      {
        if (extensiveCheckServiceClass(clazzes[i], serviceObject.getClass())) {
          return clazzes[i];
        }
      }
    }
    return null;
  }
  
  private static boolean extensiveCheckServiceClass(String clazz, Class<?> serviceClazz)
  {
    if (clazz.equals(serviceClazz.getName())) {
      return false;
    }
    Class[] interfaces = serviceClazz.getInterfaces();
    int i = 0;
    for (int len = interfaces.length; i < len; i++) {
      if (!extensiveCheckServiceClass(clazz, interfaces[i])) {
        return false;
      }
    }
    Class<?> superClazz = serviceClazz.getSuperclass();
    if ((superClazz != null) && 
      (!extensiveCheckServiceClass(clazz, superClazz))) {
      return false;
    }
    return true;
  }
  
  static boolean isAssignableTo(BundleContextImpl context, ServiceReferenceImpl<?> reference)
  {
    Bundle bundle = context.getBundleImpl();
    String[] clazzes = reference.getClasses();
    int i = 0;
    for (int len = clazzes.length; i < len; i++) {
      if (!reference.isAssignableTo(bundle, clazzes[i])) {
        return false;
      }
    }
    return true;
  }
  
  private void notifyFindHooks(final BundleContextImpl context, final String clazz, final String filterstring, final boolean allservices, final Collection<ServiceReference<?>> result)
  {
    if (System.getSecurityManager() == null) {
      notifyFindHooksPrivileged(context, clazz, filterstring, allservices, result);
    } else {
      AccessController.doPrivileged(new PrivilegedAction()
      {
        public Object run()
        {
          notifyFindHooksPrivileged(context, clazz, filterstring, allservices, result);
          return null;
        }
      });
    }
  }
  
  void notifyFindHooksPrivileged(final BundleContextImpl context, final String clazz, final String filterstring, final boolean allservices, final Collection<ServiceReference<?>> result)
  {
    if (Debug.DEBUG_HOOKS) {
      Debug.println("notifyServiceFindHooks(" + context.getBundleImpl() + "," + clazz + "," + filterstring + "," + allservices + "," + result + ")");
    }
    notifyHooksPrivileged(new HookContext()
    {
      public void call(Object hook, ServiceRegistration<?> hookRegistration)
        throws Exception
      {
        if ((hook instanceof FindHook)) {
          ((FindHook)hook).find(context, clazz, filterstring, allservices, result);
        }
      }
      
      public String getHookClassName()
      {
        return ServiceRegistry.findHookName;
      }
      
      public String getHookMethodName()
      {
        return "find";
      }
    });
  }
  
  private void notifyEventHooksPrivileged(final ServiceEvent event, final Collection<BundleContext> result)
  {
    if (Debug.DEBUG_HOOKS) {
      Debug.println("notifyServiceEventHooks(" + event.getType() + ":" + event.getServiceReference() + "," + result + ")");
    }
    notifyHooksPrivileged(new HookContext()
    {
      public void call(Object hook, ServiceRegistration<?> hookRegistration)
        throws Exception
      {
        if ((hook instanceof EventHook)) {
          ((EventHook)hook).event(event, result);
        }
      }
      
      public String getHookClassName()
      {
        return ServiceRegistry.eventHookName;
      }
      
      public String getHookMethodName()
      {
        return "event";
      }
    });
  }
  
  private void notifyEventListenerHooksPrivileged(final ServiceEvent event, final Map<BundleContext, Collection<ListenerHook.ListenerInfo>> result)
  {
    if (Debug.DEBUG_HOOKS) {
      Debug.println("notifyServiceEventListenerHooks(" + event.getType() + ":" + event.getServiceReference() + "," + result + ")");
    }
    notifyHooksPrivileged(new HookContext()
    {
      public void call(Object hook, ServiceRegistration<?> hookRegistration)
        throws Exception
      {
        if ((hook instanceof EventListenerHook)) {
          ((EventListenerHook)hook).event(event, result);
        }
      }
      
      public String getHookClassName()
      {
        return ServiceRegistry.eventListenerHookName;
      }
      
      public String getHookMethodName()
      {
        return "event";
      }
    });
  }
  
  public void notifyHooksPrivileged(HookContext hookContext)
  {
    BundleContextImpl systemBundleContext = framework.getSystemBundleContext();
    if (systemBundleContext == null) {
      return;
    }
    List<ServiceRegistrationImpl<?>> hooks = lookupServiceRegistrations(hookContext.getHookClassName(), null);
    for (Iterator localIterator = hooks.iterator(); localIterator.hasNext();)
    {
      ServiceRegistrationImpl<?> registration = (ServiceRegistrationImpl)localIterator.next();
      notifyHookPrivileged(systemBundleContext, registration, hookContext);
    }
  }
  
  /* Error */
  private void notifyHookPrivileged(BundleContextImpl context, ServiceRegistrationImpl<?> registration, HookContext hookContext)
  {
    // Byte code:
    //   0: aload_2
    //   1: aload_1
    //   2: invokevirtual 811	org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl:getSafeService	(Lorg/eclipse/osgi/framework/internal/core/BundleContextImpl;)Ljava/lang/Object;
    //   5: astore 4
    //   7: aload 4
    //   9: ifnonnull +4 -> 13
    //   12: return
    //   13: aload_3
    //   14: aload 4
    //   16: aload_2
    //   17: invokeinterface 885 3 0
    //   22: goto +148 -> 170
    //   25: astore 5
    //   27: getstatic 725	org/eclipse/osgi/framework/debug/Debug:DEBUG_HOOKS	Z
    //   30: ifeq +61 -> 91
    //   33: new 351	java/lang/StringBuffer
    //   36: dup
    //   37: aload 4
    //   39: invokevirtual 758	java/lang/Object:getClass	()Ljava/lang/Class;
    //   42: invokevirtual 751	java/lang/Class:getName	()Ljava/lang/String;
    //   45: invokestatic 762	java/lang/String:valueOf	(Ljava/lang/Object;)Ljava/lang/String;
    //   48: invokespecial 764	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   51: ldc_w 319
    //   54: invokevirtual 768	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   57: aload_3
    //   58: invokeinterface 884 1 0
    //   63: invokevirtual 768	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   66: ldc_w 316
    //   69: invokevirtual 768	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   72: aload 5
    //   74: invokevirtual 772	java/lang/Throwable:getMessage	()Ljava/lang/String;
    //   77: invokevirtual 768	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   80: invokevirtual 763	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   83: invokestatic 782	org/eclipse/osgi/framework/debug/Debug:println	(Ljava/lang/String;)V
    //   86: aload 5
    //   88: invokestatic 783	org/eclipse/osgi/framework/debug/Debug:printStackTrace	(Ljava/lang/Throwable;)V
    //   91: aload_0
    //   92: getfield 745	org/eclipse/osgi/internal/serviceregistry/ServiceRegistry:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   95: invokevirtual 795	org/eclipse/osgi/framework/internal/core/Framework:getAdaptor	()Lorg/eclipse/osgi/framework/adaptor/FrameworkAdaptor;
    //   98: aload 5
    //   100: invokeinterface 882 2 0
    //   105: new 397	org/osgi/framework/ServiceException
    //   108: dup
    //   109: getstatic 729	org/eclipse/osgi/framework/internal/core/Msg:SERVICE_FACTORY_EXCEPTION	Ljava/lang/String;
    //   112: aload 4
    //   114: invokevirtual 758	java/lang/Object:getClass	()Ljava/lang/Class;
    //   117: invokevirtual 751	java/lang/Class:getName	()Ljava/lang/String;
    //   120: aload_3
    //   121: invokeinterface 884 1 0
    //   126: invokestatic 850	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/String;
    //   129: aload 5
    //   131: invokespecial 854	org/osgi/framework/ServiceException:<init>	(Ljava/lang/String;Ljava/lang/Throwable;)V
    //   134: astore 6
    //   136: aload_0
    //   137: getfield 745	org/eclipse/osgi/internal/serviceregistry/ServiceRegistry:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   140: iconst_2
    //   141: aload_2
    //   142: invokevirtual 810	org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl:getBundle	()Lorg/osgi/framework/Bundle;
    //   145: aload 6
    //   147: invokevirtual 798	org/eclipse/osgi/framework/internal/core/Framework:publishFrameworkEvent	(ILorg/osgi/framework/Bundle;Ljava/lang/Throwable;)V
    //   150: aload_2
    //   151: aload_1
    //   152: invokevirtual 808	org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl:ungetService	(Lorg/eclipse/osgi/framework/internal/core/BundleContextImpl;)Z
    //   155: pop
    //   156: goto +20 -> 176
    //   159: astore 7
    //   161: aload_2
    //   162: aload_1
    //   163: invokevirtual 808	org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl:ungetService	(Lorg/eclipse/osgi/framework/internal/core/BundleContextImpl;)Z
    //   166: pop
    //   167: aload 7
    //   169: athrow
    //   170: aload_2
    //   171: aload_1
    //   172: invokevirtual 808	org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl:ungetService	(Lorg/eclipse/osgi/framework/internal/core/BundleContextImpl;)Z
    //   175: pop
    //   176: return
    // Line number table:
    //   Java source line #1234	-> byte code offset #0
    //   Java source line #1235	-> byte code offset #7
    //   Java source line #1236	-> byte code offset #12
    //   Java source line #1239	-> byte code offset #13
    //   Java source line #1240	-> byte code offset #22
    //   Java source line #1241	-> byte code offset #27
    //   Java source line #1242	-> byte code offset #33
    //   Java source line #1243	-> byte code offset #86
    //   Java source line #1246	-> byte code offset #91
    //   Java source line #1247	-> byte code offset #105
    //   Java source line #1248	-> byte code offset #136
    //   Java source line #1250	-> byte code offset #150
    //   Java source line #1249	-> byte code offset #159
    //   Java source line #1250	-> byte code offset #161
    //   Java source line #1251	-> byte code offset #167
    //   Java source line #1250	-> byte code offset #170
    //   Java source line #1252	-> byte code offset #176
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	177	0	this	ServiceRegistry
    //   0	177	1	context	BundleContextImpl
    //   0	177	2	registration	ServiceRegistrationImpl<?>
    //   0	177	3	hookContext	HookContext
    //   5	108	4	hook	Object
    //   25	105	5	t	Throwable
    //   134	12	6	se	org.osgi.framework.ServiceException
    //   159	9	7	localObject1	Object
    // Exception table:
    //   from	to	target	type
    //   13	22	25	java/lang/Throwable
    //   13	150	159	finally
  }
  
  private void notifyNewListenerHook(final ServiceRegistrationImpl<?> registration)
  {
    if (System.getSecurityManager() == null) {
      notifyNewListenerHookPrivileged(registration);
    } else {
      AccessController.doPrivileged(new PrivilegedAction()
      {
        public Object run()
        {
          notifyNewListenerHookPrivileged(registration);
          return null;
        }
      });
    }
  }
  
  void notifyNewListenerHookPrivileged(ServiceRegistrationImpl<?> registration)
  {
    BundleContextImpl systemBundleContext = framework.getSystemBundleContext();
    if (systemBundleContext == null) {
      return;
    }
    if (Debug.DEBUG_HOOKS) {
      Debug.println("notifyServiceNewListenerHook(" + registration + ")");
    }
    Collection<ListenerHook.ListenerInfo> addedListeners = new ArrayList(50);
    synchronized (serviceEventListeners)
    {
      for (Iterator localIterator = serviceEventListeners.values().iterator(); localIterator.hasNext();)
      {
        CopyOnWriteIdentityMap<ServiceListener, FilteredServiceListener> listeners = (CopyOnWriteIdentityMap)localIterator.next();
        if (!listeners.isEmpty()) {
          addedListeners.addAll(listeners.values());
        }
      }
    }
    final Collection<ListenerHook.ListenerInfo> listeners = Collections.unmodifiableCollection(addedListeners);
    notifyHookPrivileged(systemBundleContext, registration, new HookContext()
    {
      public void call(Object hook, ServiceRegistration<?> hookRegistration)
        throws Exception
      {
        if ((hook instanceof ListenerHook)) {
          ((ListenerHook)hook).added(listeners);
        }
      }
      
      public String getHookClassName()
      {
        return ServiceRegistry.listenerHookName;
      }
      
      public String getHookMethodName()
      {
        return "added";
      }
    });
  }
  
  private void notifyListenerHooks(final Collection<ListenerHook.ListenerInfo> listeners, final boolean added)
  {
    if (System.getSecurityManager() == null) {
      notifyListenerHooksPrivileged(listeners, added);
    } else {
      AccessController.doPrivileged(new PrivilegedAction()
      {
        public Object run()
        {
          notifyListenerHooksPrivileged(listeners, added);
          return null;
        }
      });
    }
  }
  
  void notifyListenerHooksPrivileged(final Collection<ListenerHook.ListenerInfo> listeners, final boolean added)
  {
    assert (!listeners.isEmpty());
    if (Debug.DEBUG_HOOKS) {
      Debug.println("notifyServiceListenerHooks(" + listeners + "," + (added ? "added" : "removed") + ")");
    }
    notifyHooksPrivileged(new HookContext()
    {
      public void call(Object hook, ServiceRegistration<?> hookRegistration)
        throws Exception
      {
        if ((hook instanceof ListenerHook)) {
          if (added) {
            ((ListenerHook)hook).added(listeners);
          } else {
            ((ListenerHook)hook).removed(listeners);
          }
        }
      }
      
      public String getHookClassName()
      {
        return ServiceRegistry.listenerHookName;
      }
      
      public String getHookMethodName()
      {
        return added ? "added" : "removed";
      }
    });
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.serviceregistry.ServiceRegistry
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.serviceregistry;

import java.security.PrivilegedAction;
import org.eclipse.osgi.framework.internal.core.BundleContextImpl;
import org.osgi.framework.ServiceFactory;

class ServiceUse$1
  implements PrivilegedAction<S>
{
  final ServiceUse this$0;
  
  ServiceUse$1(ServiceUse paramServiceUse) {}
  
  public S run()
  {
    return (S)this$0.factory.getService(this$0.context.getBundleImpl(), this$0.registration);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.serviceregistry.ServiceUse.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.serviceregistry;

import java.security.PrivilegedAction;
import org.eclipse.osgi.framework.internal.core.BundleContextImpl;
import org.osgi.framework.ServiceFactory;

class ServiceUse$2
  implements PrivilegedAction<S>
{
  final ServiceUse this$0;
  
  ServiceUse$2(ServiceUse paramServiceUse, Object paramObject) {}
  
  public S run()
  {
    this$0.factory.ungetService(this$0.context.getBundleImpl(), this$0.registration, val$service);
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.serviceregistry.ServiceUse.2
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.serviceregistry;

import java.security.PrivilegedAction;
import org.eclipse.osgi.framework.internal.core.BundleContextImpl;
import org.osgi.framework.ServiceFactory;

class ServiceUse$3
  implements PrivilegedAction<S>
{
  final ServiceUse this$0;
  
  ServiceUse$3(ServiceUse paramServiceUse, Object paramObject) {}
  
  public S run()
  {
    this$0.factory.ungetService(this$0.context.getBundleImpl(), this$0.registration, val$service);
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.serviceregistry.ServiceUse.3
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.serviceregistry;

import java.security.AccessController;
import java.security.PrivilegedAction;
import org.eclipse.osgi.framework.debug.Debug;
import org.eclipse.osgi.framework.internal.core.BundleContextImpl;
import org.eclipse.osgi.framework.internal.core.Framework;
import org.eclipse.osgi.framework.internal.core.Msg;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.ServiceException;
import org.osgi.framework.ServiceFactory;

public class ServiceUse<S>
{
  final ServiceFactory<S> factory;
  final BundleContextImpl context;
  final ServiceRegistrationImpl<S> registration;
  private S cachedService;
  private int useCount;
  private boolean factoryInUse;
  
  static
  {
    try {}catch (ClassNotFoundException localClassNotFoundException)
    {
      throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
    }
  }
  
  ServiceUse(BundleContextImpl context, ServiceRegistrationImpl<S> registration)
  {
    useCount = 0;
    factoryInUse = false;
    S service = registration.getServiceObject();
    if ((service instanceof ServiceFactory))
    {
      ServiceFactory<S> f = (ServiceFactory)service;
      factory = f;
      cachedService = null;
    }
    else
    {
      factory = null;
      cachedService = service;
    }
    this.context = context;
    this.registration = registration;
  }
  
  /* Error */
  S getService()
  {
    // Byte code:
    //   0: getstatic 217	org/eclipse/osgi/internal/serviceregistry/ServiceUse:$assertionsDisabled	Z
    //   3: ifne +18 -> 21
    //   6: aload_0
    //   7: invokestatic 235	java/lang/Thread:holdsLock	(Ljava/lang/Object;)Z
    //   10: ifne +11 -> 21
    //   13: new 106	java/lang/AssertionError
    //   16: dup
    //   17: invokespecial 223	java/lang/AssertionError:<init>	()V
    //   20: athrow
    //   21: aload_0
    //   22: getfield 216	org/eclipse/osgi/internal/serviceregistry/ServiceUse:useCount	I
    //   25: ifgt +10 -> 35
    //   28: aload_0
    //   29: getfield 222	org/eclipse/osgi/internal/serviceregistry/ServiceUse:factory	Lorg/osgi/framework/ServiceFactory;
    //   32: ifnonnull +38 -> 70
    //   35: aload_0
    //   36: getfield 216	org/eclipse/osgi/internal/serviceregistry/ServiceUse:useCount	I
    //   39: ldc 1
    //   41: if_icmpne +14 -> 55
    //   44: new 127	org/osgi/framework/ServiceException
    //   47: dup
    //   48: getstatic 215	org/eclipse/osgi/framework/internal/core/Msg:SERVICE_USE_OVERFLOW	Ljava/lang/String;
    //   51: invokespecial 253	org/osgi/framework/ServiceException:<init>	(Ljava/lang/String;)V
    //   54: athrow
    //   55: aload_0
    //   56: dup
    //   57: getfield 216	org/eclipse/osgi/internal/serviceregistry/ServiceUse:useCount	I
    //   60: iconst_1
    //   61: iadd
    //   62: putfield 216	org/eclipse/osgi/internal/serviceregistry/ServiceUse:useCount	I
    //   65: aload_0
    //   66: getfield 219	org/eclipse/osgi/internal/serviceregistry/ServiceUse:cachedService	Ljava/lang/Object;
    //   69: areturn
    //   70: getstatic 210	org/eclipse/osgi/framework/debug/Debug:DEBUG_SERVICES	Z
    //   73: ifeq +60 -> 133
    //   76: new 111	java/lang/StringBuffer
    //   79: dup
    //   80: ldc 11
    //   82: invokespecial 232	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   85: aload_0
    //   86: getfield 221	org/eclipse/osgi/internal/serviceregistry/ServiceUse:registration	Lorg/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl;
    //   89: invokevirtual 246	org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl:getBundle	()Lorg/osgi/framework/Bundle;
    //   92: invokevirtual 233	java/lang/StringBuffer:append	(Ljava/lang/Object;)Ljava/lang/StringBuffer;
    //   95: ldc 9
    //   97: invokevirtual 234	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   100: aload_0
    //   101: getfield 220	org/eclipse/osgi/internal/serviceregistry/ServiceUse:context	Lorg/eclipse/osgi/framework/internal/core/BundleContextImpl;
    //   104: invokevirtual 240	org/eclipse/osgi/framework/internal/core/BundleContextImpl:getBundleImpl	()Lorg/eclipse/osgi/framework/internal/core/AbstractBundle;
    //   107: invokevirtual 233	java/lang/StringBuffer:append	(Ljava/lang/Object;)Ljava/lang/StringBuffer;
    //   110: ldc 3
    //   112: invokevirtual 234	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   115: aload_0
    //   116: getfield 221	org/eclipse/osgi/internal/serviceregistry/ServiceUse:registration	Lorg/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl;
    //   119: invokevirtual 233	java/lang/StringBuffer:append	(Ljava/lang/Object;)Ljava/lang/StringBuffer;
    //   122: ldc 2
    //   124: invokevirtual 234	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   127: invokevirtual 231	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   130: invokestatic 238	org/eclipse/osgi/framework/debug/Debug:println	(Ljava/lang/String;)V
    //   133: aload_0
    //   134: getfield 218	org/eclipse/osgi/internal/serviceregistry/ServiceUse:factoryInUse	Z
    //   137: ifeq +84 -> 221
    //   140: getstatic 210	org/eclipse/osgi/framework/debug/Debug:DEBUG_SERVICES	Z
    //   143: ifeq +28 -> 171
    //   146: new 111	java/lang/StringBuffer
    //   149: dup
    //   150: invokespecial 230	java/lang/StringBuffer:<init>	()V
    //   153: aload_0
    //   154: getfield 222	org/eclipse/osgi/internal/serviceregistry/ServiceUse:factory	Lorg/osgi/framework/ServiceFactory;
    //   157: invokevirtual 233	java/lang/StringBuffer:append	(Ljava/lang/Object;)Ljava/lang/StringBuffer;
    //   160: ldc 5
    //   162: invokevirtual 234	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   165: invokevirtual 231	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   168: invokestatic 238	org/eclipse/osgi/framework/debug/Debug:println	(Ljava/lang/String;)V
    //   171: new 127	org/osgi/framework/ServiceException
    //   174: dup
    //   175: getstatic 213	org/eclipse/osgi/framework/internal/core/Msg:SERVICE_FACTORY_RECURSION	Ljava/lang/String;
    //   178: aload_0
    //   179: getfield 222	org/eclipse/osgi/internal/serviceregistry/ServiceUse:factory	Lorg/osgi/framework/ServiceFactory;
    //   182: invokevirtual 229	java/lang/Object:getClass	()Ljava/lang/Class;
    //   185: invokevirtual 225	java/lang/Class:getName	()Ljava/lang/String;
    //   188: ldc 10
    //   190: invokestatic 252	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/String;
    //   193: bipush 6
    //   195: invokespecial 254	org/osgi/framework/ServiceException:<init>	(Ljava/lang/String;I)V
    //   198: astore_1
    //   199: aload_0
    //   200: getfield 220	org/eclipse/osgi/internal/serviceregistry/ServiceUse:context	Lorg/eclipse/osgi/framework/internal/core/BundleContextImpl;
    //   203: invokevirtual 241	org/eclipse/osgi/framework/internal/core/BundleContextImpl:getFramework	()Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   206: bipush 16
    //   208: aload_0
    //   209: getfield 221	org/eclipse/osgi/internal/serviceregistry/ServiceUse:registration	Lorg/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl;
    //   212: invokevirtual 246	org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl:getBundle	()Lorg/osgi/framework/Bundle;
    //   215: aload_1
    //   216: invokevirtual 243	org/eclipse/osgi/framework/internal/core/Framework:publishFrameworkEvent	(ILorg/osgi/framework/Bundle;Ljava/lang/Throwable;)V
    //   219: aconst_null
    //   220: areturn
    //   221: aload_0
    //   222: iconst_1
    //   223: putfield 218	org/eclipse/osgi/internal/serviceregistry/ServiceUse:factoryInUse	Z
    //   226: new 123	org/eclipse/osgi/internal/serviceregistry/ServiceUse$1
    //   229: dup
    //   230: aload_0
    //   231: invokespecial 248	org/eclipse/osgi/internal/serviceregistry/ServiceUse$1:<init>	(Lorg/eclipse/osgi/internal/serviceregistry/ServiceUse;)V
    //   234: invokestatic 237	java/security/AccessController:doPrivileged	(Ljava/security/PrivilegedAction;)Ljava/lang/Object;
    //   237: astore_1
    //   238: goto +126 -> 364
    //   241: astore_2
    //   242: getstatic 210	org/eclipse/osgi/framework/debug/Debug:DEBUG_SERVICES	Z
    //   245: ifeq +39 -> 284
    //   248: new 111	java/lang/StringBuffer
    //   251: dup
    //   252: invokespecial 230	java/lang/StringBuffer:<init>	()V
    //   255: aload_0
    //   256: getfield 222	org/eclipse/osgi/internal/serviceregistry/ServiceUse:factory	Lorg/osgi/framework/ServiceFactory;
    //   259: invokevirtual 233	java/lang/StringBuffer:append	(Ljava/lang/Object;)Ljava/lang/StringBuffer;
    //   262: ldc 4
    //   264: invokevirtual 234	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   267: aload_2
    //   268: invokevirtual 236	java/lang/Throwable:getMessage	()Ljava/lang/String;
    //   271: invokevirtual 234	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   274: invokevirtual 231	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   277: invokestatic 238	org/eclipse/osgi/framework/debug/Debug:println	(Ljava/lang/String;)V
    //   280: aload_2
    //   281: invokestatic 239	org/eclipse/osgi/framework/debug/Debug:printStackTrace	(Ljava/lang/Throwable;)V
    //   284: aload_0
    //   285: getfield 220	org/eclipse/osgi/internal/serviceregistry/ServiceUse:context	Lorg/eclipse/osgi/framework/internal/core/BundleContextImpl;
    //   288: invokevirtual 241	org/eclipse/osgi/framework/internal/core/BundleContextImpl:getFramework	()Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   291: invokevirtual 242	org/eclipse/osgi/framework/internal/core/Framework:getAdaptor	()Lorg/eclipse/osgi/framework/adaptor/FrameworkAdaptor;
    //   294: aload_2
    //   295: invokeinterface 256 2 0
    //   300: new 127	org/osgi/framework/ServiceException
    //   303: dup
    //   304: getstatic 211	org/eclipse/osgi/framework/internal/core/Msg:SERVICE_FACTORY_EXCEPTION	Ljava/lang/String;
    //   307: aload_0
    //   308: getfield 222	org/eclipse/osgi/internal/serviceregistry/ServiceUse:factory	Lorg/osgi/framework/ServiceFactory;
    //   311: invokevirtual 229	java/lang/Object:getClass	()Ljava/lang/Class;
    //   314: invokevirtual 225	java/lang/Class:getName	()Ljava/lang/String;
    //   317: ldc 10
    //   319: invokestatic 252	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/String;
    //   322: iconst_3
    //   323: aload_2
    //   324: invokespecial 255	org/osgi/framework/ServiceException:<init>	(Ljava/lang/String;ILjava/lang/Throwable;)V
    //   327: astore_3
    //   328: aload_0
    //   329: getfield 220	org/eclipse/osgi/internal/serviceregistry/ServiceUse:context	Lorg/eclipse/osgi/framework/internal/core/BundleContextImpl;
    //   332: invokevirtual 241	org/eclipse/osgi/framework/internal/core/BundleContextImpl:getFramework	()Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   335: iconst_2
    //   336: aload_0
    //   337: getfield 221	org/eclipse/osgi/internal/serviceregistry/ServiceUse:registration	Lorg/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl;
    //   340: invokevirtual 246	org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl:getBundle	()Lorg/osgi/framework/Bundle;
    //   343: aload_3
    //   344: invokevirtual 243	org/eclipse/osgi/framework/internal/core/Framework:publishFrameworkEvent	(ILorg/osgi/framework/Bundle;Ljava/lang/Throwable;)V
    //   347: aload_0
    //   348: iconst_0
    //   349: putfield 218	org/eclipse/osgi/internal/serviceregistry/ServiceUse:factoryInUse	Z
    //   352: aconst_null
    //   353: areturn
    //   354: astore 4
    //   356: aload_0
    //   357: iconst_0
    //   358: putfield 218	org/eclipse/osgi/internal/serviceregistry/ServiceUse:factoryInUse	Z
    //   361: aload 4
    //   363: athrow
    //   364: aload_0
    //   365: iconst_0
    //   366: putfield 218	org/eclipse/osgi/internal/serviceregistry/ServiceUse:factoryInUse	Z
    //   369: aload_1
    //   370: ifnonnull +81 -> 451
    //   373: getstatic 210	org/eclipse/osgi/framework/debug/Debug:DEBUG_SERVICES	Z
    //   376: ifeq +28 -> 404
    //   379: new 111	java/lang/StringBuffer
    //   382: dup
    //   383: invokespecial 230	java/lang/StringBuffer:<init>	()V
    //   386: aload_0
    //   387: getfield 222	org/eclipse/osgi/internal/serviceregistry/ServiceUse:factory	Lorg/osgi/framework/ServiceFactory;
    //   390: invokevirtual 233	java/lang/StringBuffer:append	(Ljava/lang/Object;)Ljava/lang/StringBuffer;
    //   393: ldc 6
    //   395: invokevirtual 234	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   398: invokevirtual 231	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   401: invokestatic 238	org/eclipse/osgi/framework/debug/Debug:println	(Ljava/lang/String;)V
    //   404: new 127	org/osgi/framework/ServiceException
    //   407: dup
    //   408: getstatic 214	org/eclipse/osgi/framework/internal/core/Msg:SERVICE_OBJECT_NULL_EXCEPTION	Ljava/lang/String;
    //   411: aload_0
    //   412: getfield 222	org/eclipse/osgi/internal/serviceregistry/ServiceUse:factory	Lorg/osgi/framework/ServiceFactory;
    //   415: invokevirtual 229	java/lang/Object:getClass	()Ljava/lang/Class;
    //   418: invokevirtual 225	java/lang/Class:getName	()Ljava/lang/String;
    //   421: invokestatic 251	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
    //   424: iconst_2
    //   425: invokespecial 254	org/osgi/framework/ServiceException:<init>	(Ljava/lang/String;I)V
    //   428: astore_2
    //   429: aload_0
    //   430: getfield 220	org/eclipse/osgi/internal/serviceregistry/ServiceUse:context	Lorg/eclipse/osgi/framework/internal/core/BundleContextImpl;
    //   433: invokevirtual 241	org/eclipse/osgi/framework/internal/core/BundleContextImpl:getFramework	()Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   436: bipush 16
    //   438: aload_0
    //   439: getfield 221	org/eclipse/osgi/internal/serviceregistry/ServiceUse:registration	Lorg/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl;
    //   442: invokevirtual 246	org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl:getBundle	()Lorg/osgi/framework/Bundle;
    //   445: aload_2
    //   446: invokevirtual 243	org/eclipse/osgi/framework/internal/core/Framework:publishFrameworkEvent	(ILorg/osgi/framework/Bundle;Ljava/lang/Throwable;)V
    //   449: aconst_null
    //   450: areturn
    //   451: aload_0
    //   452: getfield 221	org/eclipse/osgi/internal/serviceregistry/ServiceUse:registration	Lorg/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl;
    //   455: invokevirtua
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd