• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java WorkQueue类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.gerrit.server.git.WorkQueue的典型用法代码示例。如果您正苦于以下问题:Java WorkQueue类的具体用法?Java WorkQueue怎么用?Java WorkQueue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



WorkQueue类属于com.google.gerrit.server.git包,在下文中一共展示了WorkQueue类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: CreateBatchUser

import com.google.gerrit.server.git.WorkQueue; //导入依赖的package包/类
@Inject
public CreateBatchUser(@PluginName String pluginName, SchemaFactory<ReviewDb> schema,
					   PluginConfigFactory configFactory, SshKeyCache sshKeyCache, VersionedAuthorizedKeys.Accessor authorizedKeys,
					   AccountCache accountCache, AccountByEmailCache byEmailCache, AccountLoader.Factory infoLoader,
					   GroupsCollection groupsCollection, WorkQueue queue, ThreadLocalRequestContext context,
					   IdentifiedUser.GenericFactory userFactory) {
	this.schema = schema;
	this.sshKeyCache = sshKeyCache;
	this.authorizedKeys = authorizedKeys;
	this.accountCache = accountCache;
	this.byEmailCache = byEmailCache;
	this.infoLoader = infoLoader;
	this.groupsCollection = groupsCollection;
	this.context = context;
	this.userFactory = userFactory;
	pluginConfig = configFactory.getFromGerritConfig(pluginName);
	username = pluginConfig.getString("username", "jenkins");
	sshKey = pluginConfig.getString("sshKey");
	name = pluginConfig.getString("name", "Batch user");
	executor = queue.getDefaultQueue();

	createBatchUserIfNotExistsYet();
}
 
开发者ID:atteo,项目名称:jfactory,代码行数:24,代码来源:CreateBatchUser.java


示例2: PushAll

import com.google.gerrit.server.git.WorkQueue; //导入依赖的package包/类
@Inject
protected PushAll(
    WorkQueue wq,
    ProjectCache projectCache,
    ReplicationQueue rq,
    ReplicationStateListener stateLog,
    @Assisted @Nullable String urlMatch,
    @Assisted ReplicationFilter filter,
    @Assisted ReplicationState state,
    @Assisted boolean now) {
  this.workQueue = wq;
  this.projectCache = projectCache;
  this.replication = rq;
  this.stateLog = stateLog;
  this.urlMatch = urlMatch;
  this.filter = filter;
  this.state = state;
  this.now = now;
}
 
开发者ID:GerritCodeReview,项目名称:plugins_replication,代码行数:20,代码来源:PushAll.java


示例3: CommandExecutorQueueProvider

import com.google.gerrit.server.git.WorkQueue; //导入依赖的package包/类
@Inject
public CommandExecutorQueueProvider(
    @GerritServerConfig Config config,
    ThreadSettingsConfig threadsSettingsConfig,
    WorkQueue queues) {
  poolSize = threadsSettingsConfig.getSshdThreads();
  batchThreads =
      config.getInt("sshd", "batchThreads", threadsSettingsConfig.getSshdBatchTreads());
  if (batchThreads > poolSize) {
    poolSize += batchThreads;
  }
  int interactiveThreads = Math.max(1, poolSize - batchThreads);
  interactiveExecutor =
      queues.createQueue(interactiveThreads, "SSH-Interactive-Worker", Thread.MIN_PRIORITY);
  if (batchThreads != 0) {
    batchExecutor = queues.createQueue(batchThreads, "SSH-Batch-Worker", Thread.MIN_PRIORITY);
  } else {
    batchExecutor = interactiveExecutor;
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:21,代码来源:CommandExecutorQueueProvider.java


示例4: CommandFactoryProvider

import com.google.gerrit.server.git.WorkQueue; //导入依赖的package包/类
@Inject
CommandFactoryProvider(
    @CommandName(Commands.ROOT) DispatchCommandProvider d,
    @GerritServerConfig Config cfg,
    WorkQueue workQueue,
    SshLog l,
    SshScope s,
    SchemaFactory<ReviewDb> sf) {
  dispatcher = d;
  log = l;
  sshScope = s;
  schemaFactory = sf;

  int threads = cfg.getInt("sshd", "commandStartThreads", 2);
  startExecutor = workQueue.createQueue(threads, "SshCommandStart");
  destroyExecutor =
      Executors.newSingleThreadExecutor(
          new ThreadFactoryBuilder()
              .setNameFormat("SshCommandDestroy-%s")
              .setDaemon(true)
              .build());
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:23,代码来源:CommandFactoryProvider.java


示例5: applyAsync

import com.google.gerrit.server.git.WorkQueue; //导入依赖的package包/类
private Response.Accepted applyAsync(Project.NameKey project, Input input) {
  Runnable job =
      new Runnable() {
        @Override
        public void run() {
          runGC(project, input, null);
        }

        @Override
        public String toString() {
          return "Run "
              + (input.aggressive ? "aggressive " : "")
              + "garbage collection on project "
              + project.get();
        }
      };

  @SuppressWarnings("unchecked")
  WorkQueue.Task<Void> task = (WorkQueue.Task<Void>) workQueue.getDefaultQueue().submit(job);

  String location =
      canonicalUrl.get() + "a/config/server/tasks/" + IdGenerator.format(task.getTaskId());

  return Response.accepted(location);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:26,代码来源:GarbageCollect.java


示例6: ReviewerRecommender

import com.google.gerrit.server.git.WorkQueue; //导入依赖的package包/类
@Inject
ReviewerRecommender(
    ChangeQueryBuilder changeQueryBuilder,
    DynamicMap<ReviewerSuggestion> reviewerSuggestionPluginMap,
    Provider<InternalChangeQuery> queryProvider,
    WorkQueue workQueue,
    Provider<ReviewDb> dbProvider,
    ApprovalsUtil approvalsUtil,
    @GerritServerConfig Config config) {
  Set<FillOptions> fillOptions = EnumSet.of(FillOptions.SECONDARY_EMAILS);
  fillOptions.addAll(AccountLoader.DETAILED_OPTIONS);
  this.changeQueryBuilder = changeQueryBuilder;
  this.config = config;
  this.queryProvider = queryProvider;
  this.reviewerSuggestionPluginMap = reviewerSuggestionPluginMap;
  this.workQueue = workQueue;
  this.dbProvider = dbProvider;
  this.approvalsUtil = approvalsUtil;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:20,代码来源:ReviewerRecommender.java


示例7: getInteractiveIndexExecutor

import com.google.gerrit.server.git.WorkQueue; //导入依赖的package包/类
@Provides
@Singleton
@IndexExecutor(INTERACTIVE)
ListeningExecutorService getInteractiveIndexExecutor(
    @GerritServerConfig Config config, WorkQueue workQueue) {
  if (interactiveExecutor != null) {
    return interactiveExecutor;
  }
  int threads = this.threads;
  if (threads <= 0) {
    threads = config.getInt("index", null, "threads", 0);
  }
  if (threads <= 0) {
    threads = Runtime.getRuntime().availableProcessors() / 2 + 1;
  }
  return MoreExecutors.listeningDecorator(workQueue.createQueue(threads, "Index-Interactive"));
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:18,代码来源:IndexModule.java


示例8: ChangeUpdatedListener

import com.google.gerrit.server.git.WorkQueue; //导入依赖的package包/类
@Inject
ChangeUpdatedListener(final SmartReviewers.Factory smartReviewersFactory,
    final GitRepositoryManager repoManager, final WorkQueue workQueue,
    final IdentifiedUser.GenericFactory identifiedUserFactory,
    final ThreadLocalRequestContext tl,
    final SchemaFactory<ReviewDb> schemaFactory,
    final PluginConfigFactory cfg,
    final @PluginName String pluginName) {
  this.smartReviewersFactory = smartReviewersFactory;
  this.repoManager = repoManager;
  this.workQueue = workQueue;
  this.identifiedUserFactory = identifiedUserFactory;
  this.tl = tl;
  this.schemaFactory = schemaFactory;
  this.cfg = cfg;
  this.pluginName = pluginName;
}
 
开发者ID:Intersec,项目名称:smart-reviewers,代码行数:18,代码来源:ChangeUpdatedListener.java


示例9: UserEventWorker

import com.google.gerrit.server.git.WorkQueue; //导入依赖的package包/类
@Inject
public UserEventWorker(
    ChangeHooks hooks,
    WorkQueue workQueue,
    AccountResolver accountResolver,
    IdentifiedUser.GenericFactory userFactory,
    ThreadLocalRequestContext threadLocalRequestContext,
    PluginUser pluginUser,
    SchemaFactory<ReviewDb> schemaFactory) {
  this.hooks = hooks;
  this.workQueue = workQueue;
  this.accountResolver = accountResolver;
  this.userFactory = userFactory;
  this.threadLocalRequestContext = threadLocalRequestContext;
  this.pluginUser = pluginUser;
  this.schemaFactory = schemaFactory;
}
 
开发者ID:rinrinne,项目名称:gerrit-rabbitmq-plugin,代码行数:18,代码来源:UserEventWorker.java


示例10: AutoReloadConfigDecorator

import com.google.gerrit.server.git.WorkQueue; //导入依赖的package包/类
@Inject
public AutoReloadConfigDecorator(
    SitePaths site, WorkQueue workQueue, DestinationFactory destinationFactory)
    throws ConfigInvalidException, IOException {
  this.site = site;
  this.destinationFactory = destinationFactory;
  this.currentConfig = loadConfig();
  this.currentConfigTs = getLastModified(currentConfig);
  this.workQueue = workQueue;
}
 
开发者ID:GerritCodeReview,项目名称:plugins_replication,代码行数:11,代码来源:AutoReloadConfigDecorator.java


示例11: ReplicationQueue

import com.google.gerrit.server.git.WorkQueue; //导入依赖的package包/类
@Inject
ReplicationQueue(
    WorkQueue wq,
    SshHelper sh,
    GerritSshApi ga,
    ReplicationConfig rc,
    DynamicItem<EventDispatcher> dis,
    ReplicationStateListener sl) {
  workQueue = wq;
  sshHelper = sh;
  dispatcher = dis;
  config = rc;
  stateLog = sl;
  gerritAdmin = ga;
}
 
开发者ID:GerritCodeReview,项目名称:plugins_replication,代码行数:16,代码来源:ReplicationQueue.java


示例12: GarbageCollect

import com.google.gerrit.server.git.WorkQueue; //导入依赖的package包/类
@Inject
GarbageCollect(
    GitRepositoryManager repoManager,
    GarbageCollection.Factory garbageCollectionFactory,
    WorkQueue workQueue,
    @CanonicalWebUrl Provider<String> canonicalUrl) {
  this.workQueue = workQueue;
  this.canonicalUrl = canonicalUrl;
  this.canGC = repoManager instanceof LocalDiskRepositoryManager;
  this.garbageCollectionFactory = garbageCollectionFactory;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:12,代码来源:GarbageCollect.java


示例13: createReceiveCommitsExecutor

import com.google.gerrit.server.git.WorkQueue; //导入依赖的package包/类
@Provides
@Singleton
@ReceiveCommitsExecutor
public ExecutorService createReceiveCommitsExecutor(
    @GerritServerConfig Config config, WorkQueue queues) {
  int poolSize =
      config.getInt(
          "receive", null, "threadPoolSize", Runtime.getRuntime().availableProcessors());
  return queues.createQueue(poolSize, "ReceiveCommits");
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:11,代码来源:ReceiveCommitsExecutorModule.java


示例14: createSendEmailExecutor

import com.google.gerrit.server.git.WorkQueue; //导入依赖的package包/类
@Provides
@Singleton
@SendEmailExecutor
public ExecutorService createSendEmailExecutor(
    @GerritServerConfig Config config, WorkQueue queues) {
  int poolSize = config.getInt("sendemail", null, "threadPoolSize", 1);
  if (poolSize == 0) {
    return MoreExecutors.newDirectExecutorService();
  }
  return queues.createQueue(poolSize, "SendEmail");
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:12,代码来源:ReceiveCommitsExecutorModule.java


示例15: Builder

import com.google.gerrit.server.git.WorkQueue; //导入依赖的package包/类
@Inject
Builder(
    GerritServerConfigProvider configProvider,
    SitePaths sitePaths,
    SchemaFactory<ReviewDb> schemaFactory,
    GitRepositoryManager repoManager,
    NoteDbUpdateManager.Factory updateManagerFactory,
    ChangeBundleReader bundleReader,
    AllProjectsName allProjects,
    ThreadLocalRequestContext requestContext,
    InternalUser.Factory userFactory,
    ChangeRebuilderImpl rebuilder,
    WorkQueue workQueue,
    MutableNotesMigration globalNotesMigration,
    PrimaryStorageMigrator primaryStorageMigrator,
    DynamicSet<NotesMigrationStateListener> listeners) {
  // Reload gerrit.config/notedb.config on each migrator invocation, in case a previous
  // migration in the same process modified the on-disk contents. This ensures the defaults for
  // trial/autoMigrate get set correctly below.
  this.cfg = configProvider.get();
  this.sitePaths = sitePaths;
  this.schemaFactory = schemaFactory;
  this.repoManager = repoManager;
  this.updateManagerFactory = updateManagerFactory;
  this.bundleReader = bundleReader;
  this.allProjects = allProjects;
  this.requestContext = requestContext;
  this.userFactory = userFactory;
  this.rebuilder = rebuilder;
  this.workQueue = workQueue;
  this.globalNotesMigration = globalNotesMigration;
  this.primaryStorageMigrator = primaryStorageMigrator;
  this.listeners = listeners;
  this.trial = getTrialMode(cfg);
  this.autoMigrate = getAutoMigrate(cfg);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:37,代码来源:NoteDbMigrator.java


示例16: getBatchIndexExecutor

import com.google.gerrit.server.git.WorkQueue; //导入依赖的package包/类
@Provides
@Singleton
@IndexExecutor(BATCH)
ListeningExecutorService getBatchIndexExecutor(
    @GerritServerConfig Config config, WorkQueue workQueue) {
  if (batchExecutor != null) {
    return batchExecutor;
  }
  int threads = config.getInt("index", null, "batchThreads", 0);
  if (threads <= 0) {
    threads = Runtime.getRuntime().availableProcessors();
  }
  return MoreExecutors.listeningDecorator(workQueue.createQueue(threads, "Index-Batch"));
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:15,代码来源:IndexModule.java


示例17: Lifecycle

import com.google.gerrit.server.git.WorkQueue; //导入依赖的package包/类
@Inject
Lifecycle(WorkQueue queue, AccountDeactivator deactivator, @GerritServerConfig Config cfg) {
  this.queue = queue;
  this.deactivator = deactivator;
  scheduleConfig = new ScheduleConfig(cfg, "accountDeactivation");
  supportAutomaticAccountActivityUpdate =
      cfg.getBoolean("auth", "autoUpdateAccountActiveStatus", false);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:9,代码来源:AccountDeactivator.java


示例18: ListTasks

import com.google.gerrit.server.git.WorkQueue; //导入依赖的package包/类
@Inject
public ListTasks(
    PermissionBackend permissionBackend, WorkQueue workQueue, Provider<CurrentUser> self) {
  this.permissionBackend = permissionBackend;
  this.workQueue = workQueue;
  this.self = self;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:8,代码来源:ListTasks.java


示例19: TasksCollection

import com.google.gerrit.server.git.WorkQueue; //导入依赖的package包/类
@Inject
TasksCollection(
    DynamicMap<RestView<TaskResource>> views,
    ListTasks list,
    WorkQueue workQueue,
    Provider<CurrentUser> self,
    PermissionBackend permissionBackend) {
  this.views = views;
  this.list = list;
  this.workQueue = workQueue;
  this.self = self;
  this.permissionBackend = permissionBackend;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:14,代码来源:TasksCollection.java


示例20: waitForEmails

import com.google.gerrit.server.git.WorkQueue; //导入依赖的package包/类
private void waitForEmails() {
  // TODO(dborowitz): This is brittle; consider forcing emails to use
  // a single thread in tests (tricky because most callers just use the
  // default executor).
  for (WorkQueue.Task<?> task : workQueue.getTasks()) {
    if (task.toString().contains("send-email")) {
      try {
        task.get();
      } catch (ExecutionException | InterruptedException e) {
        log.warn("error finishing email task", e);
      }
    }
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:15,代码来源:FakeEmailSender.java



注:本文中的com.google.gerrit.server.git.WorkQueue类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Style类代码示例发布时间:2022-05-22
下一篇:
Java Crossing类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap