org.apache.jackrabbit.oak.spi.whiteboard.WhiteboardExecutor类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(134)

本文整理了Java中org.apache.jackrabbit.oak.spi.whiteboard.WhiteboardExecutor类的一些代码示例,展示了WhiteboardExecutor类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WhiteboardExecutor类的具体详情如下:
包路径:org.apache.jackrabbit.oak.spi.whiteboard.WhiteboardExecutor
类名称:WhiteboardExecutor

WhiteboardExecutor介绍

[英]Dynamic Executor based on the available whiteboard services. The #execute(Runnable) method passes the given command to the first available executor service. Alternatively the command is run in the calling thread if no executor services are available.
[中]基于可用白板服务的动态执行器。#execute(Runnable)方法将给定的命令传递给第一个可用的executor服务。或者,如果没有可用的执行器服务,则在调用线程中运行该命令。

代码示例

代码示例来源:origin: apache/jackrabbit-oak

@Activate
protected void activate(ComponentContext componentContext) throws Exception {
  boolean enabled = PropertiesUtil.toBoolean(componentContext.getProperties().get(ENABLED), false);
  if (enabled) {
    BundleContext bundleContext = componentContext.getBundleContext();
    Whiteboard whiteboard = new OsgiWhiteboard(bundleContext);
    executor = new WhiteboardExecutor();
    executor.start(whiteboard);
    backgroundObserver = new BackgroundObserver(nodeStateSolrServersObserver, executor, 5);
    regs.add(bundleContext.registerService(Observer.class.getName(), backgroundObserver, null));
  }
}

代码示例来源:origin: apache/jackrabbit-oak

@Override
  public void unregister() {
    executor.stop();
  }
},

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

@Override
public void execute(@Nonnull Runnable command) {
  for (Executor executor : getServices()) {
    // use the first executor to run the command
    executor.execute(command);
    return;
  }
  // no executor services available, so use the current thread instead
  command.run();
}

代码示例来源:origin: org.apache.jackrabbit/oak-solr-core

@Activate
protected void activate(ComponentContext componentContext) throws Exception {
  boolean enabled = PropertiesUtil.toBoolean(componentContext.getProperties().get(ENABLED), false);
  if (enabled) {
    BundleContext bundleContext = componentContext.getBundleContext();
    Whiteboard whiteboard = new OsgiWhiteboard(bundleContext);
    executor = new WhiteboardExecutor();
    executor.start(whiteboard);
    backgroundObserver = new BackgroundObserver(nodeStateSolrServersObserver, executor, 5);
    regs.add(bundleContext.registerService(Observer.class.getName(), backgroundObserver, null));
  }
}

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

@Override
  public void unregister() {
    executor.stop();
  }
},

代码示例来源:origin: apache/jackrabbit-oak

@Override
public void execute(@NotNull Runnable command) {
  for (Executor executor : getServices()) {
    // use the first executor to run the command
    executor.execute(command);
    return;
  }
  // no executor services available, so use the current thread instead
  command.run();
}

代码示例来源:origin: org.apache.jackrabbit/oak-store-document

@Activate
protected void activate(ComponentContext context, Configuration config) throws Exception {
  closer = Closer.create();
  this.config = DocumentNodeStoreServiceConfiguration.create(context,
      configurationAdmin, preset.configuration, config);
  this.context = context;
  whiteboard = new OsgiWhiteboard(context.getBundleContext());
  executor = new WhiteboardExecutor();
  executor.start(whiteboard);
  customBlobStore = this.config.customBlobStore();
  documentStoreType = DocumentStoreType.fromString(this.config.documentStoreType());
  registerNodeStoreIfPossible();
}

代码示例来源:origin: org.apache.jackrabbit/oak-jcr

@Override
  public void unregister() {
    executor.stop();
  }
},

代码示例来源:origin: apache/jackrabbit-oak

@Activate
protected void activate(ComponentContext context, Configuration config) throws Exception {
  closer = Closer.create();
  this.config = DocumentNodeStoreServiceConfiguration.create(context,
      configurationAdmin, preset.configuration, config);
  this.context = context;
  whiteboard = new OsgiWhiteboard(context.getBundleContext());
  executor = new WhiteboardExecutor();
  executor.start(whiteboard);
  customBlobStore = this.config.customBlobStore();
  documentStoreType = DocumentStoreType.fromString(this.config.documentStoreType());
  registerNodeStoreIfPossible();
}

代码示例来源:origin: apache/jackrabbit-oak

@Deactivate
public void deactivate() throws IOException {
  if (indexRegistration != null) {
    indexRegistration.unregister();
  }
  if (executor != null) {
    executor.stop();
    executor = null;
  }
  //Close the task *after* unregistering the jobs
  closer.close();
}

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

executor = new WhiteboardExecutor();
executor.start(whiteboard);

代码示例来源:origin: org.apache.jackrabbit/oak-core

@Deactivate
public void deactivate() throws IOException {
  if (indexRegistration != null) {
    indexRegistration.unregister();
  }
  if (executor != null) {
    executor.stop();
    executor = null;
  }
  //Close the task *after* unregistering the jobs
  closer.close();
}

代码示例来源:origin: apache/jackrabbit-oak

executor = new WhiteboardExecutor();
executor.start(whiteboard);

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

@Deactivate
public void deactivate() throws IOException {
  if (indexRegistration != null) {
    indexRegistration.unregister();
  }
  if (executor != null) {
    executor.stop();
    executor = null;
  }
  //Close the task *after* unregistering the jobs
  closer.close();
}

代码示例来源:origin: org.apache.jackrabbit/oak-core

executor = new WhiteboardExecutor();
executor.start(whiteboard);

代码示例来源:origin: org.apache.jackrabbit/oak-solr-core

@Deactivate
  protected void deactivate() throws Exception {

    for (ServiceRegistration reg : regs) {
      reg.unregister();
    }

    if (backgroundObserver != null) {
      backgroundObserver.close();
    }

    if (executor != null) {
      executor.stop();
    }

  }
}

代码示例来源:origin: apache/jackrabbit-oak

@Activate
public void activate(BundleContext bundleContext, Configuration config) {
  List<AsyncConfig> asyncIndexerConfig = getAsyncConfig(config.asyncConfigs());
  Whiteboard whiteboard = new OsgiWhiteboard(bundleContext);
  indexRegistration = new IndexMBeanRegistration(whiteboard);
  indexEditorProvider.start(whiteboard);
  executor = new WhiteboardExecutor();
  executor.start(whiteboard);
  long leaseTimeOutMin = config.leaseTimeOutMinutes();
  if (!(nodeStore instanceof Clusterable)){
    leaseTimeOutMin = 0;
    log.info("Detected non clusterable setup. Lease checking would be disabled for async indexing");
  }
  TrackingCorruptIndexHandler corruptIndexHandler = createCorruptIndexHandler(config);
  for (AsyncConfig c : asyncIndexerConfig) {
    AsyncIndexUpdate task = new AsyncIndexUpdate(c.name, nodeStore, indexEditorProvider,
        statisticsProvider, false);
    task.setCorruptIndexHandler(corruptIndexHandler);
    task.setValidatorProviders(Collections.singletonList(validatorProvider));
    task.setLeaseTimeOut(TimeUnit.MINUTES.toMillis(leaseTimeOutMin));
    indexRegistration.registerAsyncIndexer(task, c.timeIntervalInSecs);
    closer.register(task);
  }
  registerAsyncReindexSupport(whiteboard);
  log.info("Configured async indexers {} ", asyncIndexerConfig);
  log.info("Lease time: {} mins and AsyncIndexUpdate configured with {}", leaseTimeOutMin, validatorProvider.getClass().getName());
}

代码示例来源:origin: apache/jackrabbit-oak

@Deactivate
  protected void deactivate() throws Exception {

    for (ServiceRegistration reg : regs) {
      reg.unregister();
    }

    if (backgroundObserver != null) {
      backgroundObserver.close();
    }

    if (executor != null) {
      executor.stop();
    }

  }
}

代码示例来源:origin: org.apache.jackrabbit/oak-core

@Activate
public void activate(BundleContext bundleContext, Configuration config) {
  List<AsyncConfig> asyncIndexerConfig = getAsyncConfig(config.asyncConfigs());
  Whiteboard whiteboard = new OsgiWhiteboard(bundleContext);
  indexRegistration = new IndexMBeanRegistration(whiteboard);
  indexEditorProvider.start(whiteboard);
  executor = new WhiteboardExecutor();
  executor.start(whiteboard);
  long leaseTimeOutMin = config.leaseTimeOutMinutes();
  if (!(nodeStore instanceof Clusterable)){
    leaseTimeOutMin = 0;
    log.info("Detected non clusterable setup. Lease checking would be disabled for async indexing");
  }
  TrackingCorruptIndexHandler corruptIndexHandler = createCorruptIndexHandler(config);
  for (AsyncConfig c : asyncIndexerConfig) {
    AsyncIndexUpdate task = new AsyncIndexUpdate(c.name, nodeStore, indexEditorProvider,
        statisticsProvider, false);
    task.setCorruptIndexHandler(corruptIndexHandler);
    task.setValidatorProviders(Collections.singletonList(validatorProvider));
    task.setLeaseTimeOut(TimeUnit.MINUTES.toMillis(leaseTimeOutMin));
    indexRegistration.registerAsyncIndexer(task, c.timeIntervalInSecs);
    closer.register(task);
  }
  registerAsyncReindexSupport(whiteboard);
  log.info("Configured async indexers {} ", asyncIndexerConfig);
  log.info("Lease time: {} mins and AsyncIndexUpdate configured with {}", leaseTimeOutMin, validatorProvider.getClass().getName());
}

代码示例来源:origin: apache/jackrabbit-oak

private void unregisterNodeStore() {
  if (mbeanReg != null) {
    mbeanReg.unregister();
    mbeanReg = null;
  }
  if (executor != null) {
    executor.stop();
    executor = null;
  }
  if (observerTracker != null) {
    observerTracker.stop();
    observerTracker = null;
  }
  if (nsReg != null) {
    LOG.info("Unregistering the COW node store");
    nsReg.unregister();
    nsReg = null;
  }
}

相关文章