本文整理了Java中java.util.concurrent.BlockingQueue.removeIf()
方法的一些代码示例,展示了BlockingQueue.removeIf()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BlockingQueue.removeIf()
方法的具体详情如下:
包路径:java.util.concurrent.BlockingQueue
类名称:BlockingQueue
方法名:removeIf
暂无
代码示例来源:origin: kiegroup/optaplanner
@Test
public void addProblemFactChangesWithoutDaemon() {
AtomicInteger count = new AtomicInteger(0);
BasicPlumbingTermination basicPlumbingTermination = new BasicPlumbingTermination(false);
assertEquals(false, basicPlumbingTermination.waitForRestartSolverDecision());
basicPlumbingTermination.addProblemFactChanges(Arrays.asList(
scoreDirector -> count.getAndIncrement(),
scoreDirector -> count.getAndAdd(20)
));
assertEquals(true, basicPlumbingTermination.waitForRestartSolverDecision());
assertEquals(0, count.get());
basicPlumbingTermination.startProblemFactChangesProcessing().removeIf(problemFactChange -> {
problemFactChange.doChange(null);
return true;
});
assertEquals(false, basicPlumbingTermination.waitForRestartSolverDecision());
assertEquals(21, count.get());
}
代码示例来源:origin: kiegroup/optaplanner
@Test
public void addProblemFactChangeWithoutDaemon() {
AtomicInteger count = new AtomicInteger(0);
BasicPlumbingTermination basicPlumbingTermination = new BasicPlumbingTermination(false);
assertEquals(false, basicPlumbingTermination.waitForRestartSolverDecision());
basicPlumbingTermination.addProblemFactChange(scoreDirector -> count.getAndIncrement());
assertEquals(true, basicPlumbingTermination.waitForRestartSolverDecision());
assertEquals(0, count.get());
basicPlumbingTermination.startProblemFactChangesProcessing().removeIf(problemFactChange -> {
problemFactChange.doChange(null);
return true;
});
assertEquals(false, basicPlumbingTermination.waitForRestartSolverDecision());
assertEquals(1, count.get());
}
代码示例来源:origin: org.apache.wicket/wicket-core
@Override
public void unbind(String sessionId)
{
entries.removeIf(entry -> entry.sessionId.equals(sessionId));
delegate.unbind(sessionId);
}
代码示例来源:origin: apache/wicket
@Override
public void unbind(String sessionId)
{
entries.removeIf(entry -> entry.sessionId.equals(sessionId));
delegate.unbind(sessionId);
}
代码示例来源:origin: semuxproject/semux-core
protected void resetTimeout(long timeout) {
timer.timeout(timeout);
events.removeIf(e -> e.type == Type.TIMEOUT);
}
代码示例来源:origin: de.tudarmstadt.ukp.inception.app/inception-scheduling
/**
* Removes all task for the user with name {@code aUsername} from the scheduler's queue.
* @param aUserName The name of the user whose tasks will be removed.
*/
public synchronized void stopAllTasksForUser(String aUserName)
{
// TODO: Stop the running tasks also
executor.getQueue().removeIf(e -> {
Task task = (Task) e;
return task.getUser().getUsername().equals(aUserName);
});
}
代码示例来源:origin: inception-project/inception
/**
* Removes all task for the user with name {@code aUsername} from the scheduler's queue.
* @param aUserName The name of the user whose tasks will be removed.
*/
public synchronized void stopAllTasksForUser(String aUserName)
{
// TODO: Stop the running tasks also
executor.getQueue().removeIf(e -> {
Task task = (Task) e;
return task.getUser().getUsername().equals(aUserName);
});
}
内容来源于网络,如有侵权,请联系作者删除!