public SubtransExecutor( String subTransName, Trans parentTrans, TransMeta subtransMeta, boolean shareVariables, TransExecutorParameters parameters, String subStep ) { this.subTransName = subTransName; this.parentTrans = parentTrans; this.subtransMeta = subtransMeta; this.shareVariables = shareVariables; this.parameters = parameters; this.subStep = subStep; this.statuses = new LinkedHashMap<>(); this.running = new ConcurrentHashSet<>(); }
private static WorkerHolder createWorkerHolder( ObjectMapper smileMapper, HttpClient httpClient, HttpRemoteTaskRunnerConfig config, ScheduledExecutorService workersSyncExec, WorkerHolder.Listener listener, Worker worker, // simulates task announcements received from worker on first sync call for the tasks that are already // running/completed on the worker. List<TaskAnnouncement> preExistingTaskAnnouncements, // defines behavior for what to do when a particular task is assigned Map<Task, List<TaskAnnouncement>> toBeAssignedTasks, // incremented on each runnable completion in workersSyncExec, useful for deterministically watching that some // work completed AtomicInteger ticks, // Updated each time a shutdown(taskId) call is received, useful for asserting that expected shutdowns indeed // happened. Set<String> actualShutdowns ) { return new WorkerHolder(smileMapper, httpClient, config, workersSyncExec, listener, worker) { private final String workerHost = worker.getHost().substring(0, worker.getHost().indexOf(':')); private final int workerPort = Integer.parseInt(worker.getHost().substring(worker.getHost().indexOf(':') + 1)); @Override
/** * Creates a mock of a LockService that only gives out a lock once per unique request and never releases it, even * if unlock is called. The returned tokens are monotonically increasing in the tokenId. */ private TimelockService createStickyLockService() { AtomicLong lockToken = new AtomicLong(0); Set<LockDescriptor> requestedLocks = new ConcurrentHashSet<>(); TimelockService stickyLockService = mock(TimelockService.class); doAnswer(invocation -> { LockRequest request = invocation.getArgument(0); if (requestedLocks.add(Iterables.getOnlyElement(request.getLockDescriptors()))) { return (LockResponse) () -> Optional.of(LockToken.of(new UUID(lockToken.getAndIncrement(), 0L))); } else { return (LockResponse) Optional::empty; } }).when(stickyLockService).lock(any()); return stickyLockService; }
public GuildSettings() { this.deleteCommands = true; this.channelBlacklist = new ConcurrentHashSet<>(); this.userBlacklist = new ConcurrentHashSet<>(); }
public WorkerPool(final String name) { sleepingWorkers = new ConcurrentHashSet<>(); connectedWorkers = new ConcurrentHashSet<>(); numberOfConnectedWorkers = new AtomicLong(0); }
public JobThread(IJobHandler handler) { this.handler = handler; triggerQueue = new LinkedBlockingQueue<TriggerParam>(); triggerLogIdSet = new ConcurrentHashSet<String>(); } public IJobHandler getHandler() {
public NINO() { this.whitelistedUrls = new ConcurrentHashSet<>(); this.whitelistedChannels = new ConcurrentHashSet<>(); this.whitelistedUrls.add("discord.gg/discord-developers"); this.whitelistedUrls.add("discord.gg/TTAUGvZ"); this.removeMessages.add("No no no, you post not an invite here!\nYes, hmmm."); }
private Set<EngineClient> getClientsForUniqueId(String uniqueID) { if(uniqueIdClients.containsKey(uniqueID)) return uniqueIdClients.get(uniqueID); else { Set<EngineClient> clients = new ConcurrentHashSet<>(); uniqueIdClients.put(uniqueID, clients); return clients; } }
@Override public Set<EngineClient> clientsForUniqueId(String uniqueId) { if(uniqueIdClients.containsKey(uniqueId)) return uniqueIdClients.get(uniqueId); else { Set<EngineClient> clients = new ConcurrentHashSet<>(); uniqueIdClients.put(uniqueId, clients); return clients; } }
public JobManager(JobQueueFactory jobQueueFactory, JobHandleFactory jobHandleFactory, UniqueIdFactory uniqueIdFactory, ExceptionStorageEngine exceptionStorageEngine, QueueMetrics queueMetrics) { this.activeJobHandles = new ConcurrentHashMap<>(); this.activeUniqueIds = new ConcurrentHashMap<>(); this.uniqueIdClients = new ConcurrentHashMap<>(); this.jobQueues = new ConcurrentHashMap<>(); this.workers = new ConcurrentHashSet<>(); this.workerJobs = new ConcurrentHashMap<>(); this.jobWorker = new ConcurrentHashMap<>(); this.workerPools = new ConcurrentHashMap<>(); this.metrics = queueMetrics; this.jobQueueFactory = jobQueueFactory; this.jobHandleFactory = jobHandleFactory; this.uniqueIdFactory = uniqueIdFactory; this.exceptionStorageEngine = exceptionStorageEngine; }
public static void pushAction(String userID, RunnableWrapper action) { Set<RunnableWrapper> actions = confirmCache.getIfPresent(userID); if (actions != null) { if (actions.stream().noneMatch(wrapper -> wrapper.getOrigin().equals(action.getOrigin()))) { actions.add(action); } } else { Set<RunnableWrapper> newActions = new ConcurrentHashSet<>(); newActions.add(action); confirmCache.put(userID, newActions); } }
public void handleConcurrencyExceeded(CallableWrapper<?> command) { String type = command.getElement().getType(); Set<CallableWrapper<?>> commandsForType = pendingCommandsPerType.get(type); if (commandsForType == null) { commandsForType = new ConcurrentHashSet<>(); Set<CallableWrapper<?>> oldCommandForType; oldCommandForType = pendingCommandsPerType.putIfAbsent(type, commandsForType); if (oldCommandForType != null) { // a different thread was faster commandsForType = oldCommandForType; } } commandsForType.add(command); }
public void handleConcurrencyExceeded(CallableWrapper<?> command) { String type = command.getElement().getType(); Set<CallableWrapper<?>> commandsForType = pendingCommandsPerType.get(type); if (commandsForType == null) { commandsForType = new ConcurrentHashSet<>(); Set<CallableWrapper<?>> oldCommandForType; oldCommandForType = pendingCommandsPerType.putIfAbsent(type, commandsForType); if (oldCommandForType != null) { // a different thread was faster commandsForType = oldCommandForType; } } commandsForType.add(command); }
final ConcurrentHashSet<Thread> threads = new ConcurrentHashSet<Thread>();
final ConcurrentHashSet<Thread> threads = new ConcurrentHashSet<Thread>();