List of usage examples for java.lang Runnable getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:org.diorite.impl.scheduler.DioriteTaskImpl.java
DioriteTaskImpl(final Runnable task) { this(task.getClass().getName() + "@" + System.identityHashCode(task), null, task, null, false, -1, STATE_SINGLE);//w w w .ja v a 2 s . c o m }
From source file:fr.itinerennes.bundler.cli.GtfsItinerennesBundler.java
private <T extends Runnable> void execute(final Collection<T> tasks) throws IOException { // execute tasks for (final Runnable t : tasks) { LOGGER.info("Running task {}...", t.getClass().getSimpleName()); t.run();//from w w w. j ava 2s . c o m LOGGER.info("Task {} finished", t.getClass().getSimpleName()); } }
From source file:org.apache.hadoop.util.concurrent.HadoopScheduledThreadPoolExecutor.java
@Override protected void beforeExecute(Thread t, Runnable r) { if (LOG.isDebugEnabled()) { LOG.debug("beforeExecute in thread: " + Thread.currentThread().getName() + ", runnable type: " + r.getClass().getName()); }/*from w w w . ja va2s .c o m*/ }
From source file:com.navercorp.pinpoint.collector.receiver.thrift.udp.UDPReceiverTest.java
private Executor mockDispatchWorker(CountDownLatch latch) { Executor mockWorker = new Executor() { @Override/*from ww w .j a v a 2s . co m*/ public void execute(Runnable runnable) { logger.info("execute:{}", runnable.getClass()); try { runnable.run(); } finally { latch.countDown(); } } }; return Mockito.spy(mockWorker); }
From source file:com.linuxbox.enkive.server.ArchivingThreadPoolServer.java
/** * When a new thread starts, add it to our own internal collection, so we * have the opportunity to query it as it's running. */// w w w . j a va2s . c om @Override public void beforeExecute(Thread thread, Runnable runnable) { if (LOGGER.isTraceEnabled()) LOGGER.trace("in beforeExecute for " + runnable.getClass().getName()); if (runnable instanceof AbstractMailProcessor) { final AbstractMailProcessor processor = (AbstractMailProcessor) runnable; synchronized (liveProcessors) { liveProcessors.add(processor); } } }
From source file:com.linuxbox.enkive.server.ArchivingThreadPoolServer.java
/** * When a running thread finishes, remove it from our own internal * collection, and incorporate it's data to the historic data. *///from w w w . j a v a2s. co m @Override public void afterExecute(Runnable runnable, Throwable throwable) { if (LOGGER.isTraceEnabled()) LOGGER.trace("in afterExecute for " + runnable.getClass().getName()); if (runnable instanceof AbstractMailProcessor) { final AbstractMailProcessor processor = (AbstractMailProcessor) runnable; synchronized (liveProcessors) { liveProcessors.remove(processor); final int threadMessagesProcessed = processor.getMessagesProcessed(); historicMillisecondsPerMessage = (historicMillisecondsPerMessage * historicMessagesProcessed + processor.getMillisecondsPerMessage() * threadMessagesProcessed) / (historicMessagesProcessed + threadMessagesProcessed); historicMessagesProcessed += threadMessagesProcessed; } } }
From source file:org.xenmaster.monitoring.MonitoringAgent.java
protected final void setUpEngine() { engine = Executors.newCachedThreadPool(new ThreadFactory() { @Override/*from w ww. j a va 2 s . c o m*/ public Thread newThread(Runnable r) { Thread t = new Thread(r); t.setName("Monitoring engine " + r.getClass().getSimpleName()); return t; } }); SequenceBarrier collectorBarrier = ringBuffer.newBarrier(); BatchEventProcessor<Record> cr = new BatchEventProcessor<>(ringBuffer, collectorBarrier, collector); SequenceBarrier correlatorBarrier = ringBuffer.newBarrier(cr.getSequence()); BatchEventProcessor<Record> cb = new BatchEventProcessor<>(ringBuffer, correlatorBarrier, correl); ringBuffer.setGatingSequences(cb.getSequence()); engine.execute(cr); engine.execute(cb); }
From source file:org.red5.service.httpstream.SegmenterService.java
public Future<?> submitJob(Runnable task) { log.debug("submitJob: {}", task.getClass().getName()); return segmentExecutor.submit(task); }
From source file:com.rest4j.impl.UtilTest.java
@Test public void testGetParameterNames_nested_class() throws IOException { Runnable some = new Runnable() { public void run() { }/*ww w.j a v a2 s . co m*/ public void test(String a) { } }; String[] names = Util.getParameterNames(some.getClass(), "test"); assertArrayEquals(new String[] { "a" }, names); }
From source file:org.red5.service.httpstream.SegmenterService.java
public Future<?> submitJob(Runnable task, long period) { log.debug("submitJob: {} period: {}", task.getClass().getName(), period); return segmentExecutor.scheduleAtFixedRate(task, period); }