BundleContext getBundleContext() {
   final BundleComponentActivator activator = getActivator();
   if (activator != null) {
     return activator.getBundleContext();
   }
   return null;
 }
 final long getLockTimeout() {
   BundleComponentActivator activator = getActivator();
   if (activator != null) {
     return activator.getConfiguration().lockTimeout();
   }
   return ScrConfiguration.DEFAULT_LOCK_TIMEOUT_MILLISECONDS;
 }
 <T> void registerMissingDependency(
     DependencyManager<S, T> dm, ServiceReference<T> ref, int trackingCount) {
   BundleComponentActivator activator = getActivator();
   if (activator != null) {
     activator.registerMissingDependency(dm, ref, trackingCount);
   }
 }
 void unregisterComponentId() {
   if (this.m_componentId >= 0) {
     final BundleComponentActivator activator = getActivator();
     if (activator != null) {
       activator.unregisterComponentId(this);
     }
     this.m_componentId = -1;
   }
 }
  public final void disable(final boolean async) {
    if (!m_enabled) {
      return;
    }
    CountDownLatch enableLatch = null;
    try {
      enableLatch = enableLatchWait();
      if (!async) {
        deactivateInternal(
            ComponentConstants.DEACTIVATION_REASON_DISABLED, true, m_trackingCount.get());
      }
      disableInternal();
    } finally {
      if (!async) {
        enableLatch.countDown();
      }
      m_enabled = false;
    }

    if (async) {
      final CountDownLatch latch = enableLatch;
      m_activator.schedule(
          new Runnable() {

            long count = taskCounter.incrementAndGet();

            public void run() {
              try {
                deactivateInternal(
                    ComponentConstants.DEACTIVATION_REASON_DISABLED, true, m_trackingCount.get());
              } finally {
                latch.countDown();
              }
            }

            public String toString() {
              return "Async Deactivate: " + getComponentMetadata().getName() + " id: " + count;
            }
          });
    }
  }
  public final void enable(final boolean async) {
    if (m_enabled) {
      return;
    }
    CountDownLatch enableLatch = null;
    try {
      enableLatch = enableLatchWait();
      enableInternal();
      if (!async) {
        activateInternal(m_trackingCount.get());
      }
    } finally {
      if (!async) {
        enableLatch.countDown();
      }
      m_enabled = true;
    }

    if (async) {
      final CountDownLatch latch = enableLatch;
      m_activator.schedule(
          new Runnable() {

            long count = taskCounter.incrementAndGet();

            public void run() {
              try {
                activateInternal(m_trackingCount.get());
              } finally {
                latch.countDown();
              }
            }

            public String toString() {
              return "Async Activate: " + getComponentMetadata().getName() + " id: " + count;
            }
          });
    }
  }
 synchronized void clear() {
   // for some testing, the activator may be null
   if (m_activator != null) {
     m_activator.unregisterComponentId(this);
   }
 }
 boolean isActivatorActive() {
   BundleComponentActivator activator = getActivator();
   return activator != null && activator.isActive();
 }
 void registerComponentId() {
   final BundleComponentActivator activator = getActivator();
   if (activator != null) {
     this.m_componentId = activator.registerComponentId(this);
   }
 }
 public void log(int level, String message, Object[] arguments, Throwable ex) {
   BundleComponentActivator activator = getActivator();
   if (activator != null) {
     activator.log(level, message, arguments, getComponentMetadata(), m_componentId, ex);
   }
 }