コード例 #1
0
 BundleContext getBundleContext() {
   final BundleComponentActivator activator = getActivator();
   if (activator != null) {
     return activator.getBundleContext();
   }
   return null;
 }
コード例 #2
0
 final long getLockTimeout() {
   BundleComponentActivator activator = getActivator();
   if (activator != null) {
     return activator.getConfiguration().lockTimeout();
   }
   return ScrConfiguration.DEFAULT_LOCK_TIMEOUT_MILLISECONDS;
 }
コード例 #3
0
 <T> void registerMissingDependency(
     DependencyManager<S, T> dm, ServiceReference<T> ref, int trackingCount) {
   BundleComponentActivator activator = getActivator();
   if (activator != null) {
     activator.registerMissingDependency(dm, ref, trackingCount);
   }
 }
コード例 #4
0
 void unregisterComponentId() {
   if (this.m_componentId >= 0) {
     final BundleComponentActivator activator = getActivator();
     if (activator != null) {
       activator.unregisterComponentId(this);
     }
     this.m_componentId = -1;
   }
 }
コード例 #5
0
  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;
            }
          });
    }
  }
コード例 #6
0
  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;
            }
          });
    }
  }
コード例 #7
0
 synchronized void clear() {
   // for some testing, the activator may be null
   if (m_activator != null) {
     m_activator.unregisterComponentId(this);
   }
 }
コード例 #8
0
 boolean isActivatorActive() {
   BundleComponentActivator activator = getActivator();
   return activator != null && activator.isActive();
 }
コード例 #9
0
 void registerComponentId() {
   final BundleComponentActivator activator = getActivator();
   if (activator != null) {
     this.m_componentId = activator.registerComponentId(this);
   }
 }
コード例 #10
0
 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);
   }
 }