@Override public void run() { super.run(); } }
"My thread" prio=10 tid=0x00007fffec015800 nid=0x1775 waiting for monitor entry [0x00007ffff15e5000] java.lang.Thread.State: BLOCKED (on object monitor) at LockTest.intrinsicLock(LockTest.java:9) - waiting to lock <0x00000007d6a33b10> (a LockTest) at LockTest$1.run(LockTest.java:11) at java.lang.Thread.run(Thread.java:662)
/** Kills this process, and kills the stream gobblers waiting on it. */ public void kill() { Runtime.getRuntime().removeShutdownHook(shutdownHoook); shutdownHoook.run(); }
@Override public void run() { Process.setThreadPriority(THREAD_PRIORITY_BACKGROUND); super.run(); } }
@Override public void run() { super.run(); if (file.exists()) { if (!file.delete()) { LOG.warn("JVM was not able to remove file {}", file); } } } }
@Override public void run() { try { super.run(); } finally { OtherThreadExecutor.this.thread = null; } } };
@Override public void run() { try { super.run(); } finally { monitor.threadFinished( threadNamePrefix ); } } };
private void setupCacheDir() { String cacheDirName = CACHE_DIR_BASE + "/file-cache-" + UUID.randomUUID().toString(); cacheDir = new File(cacheDirName); if (!cacheDir.mkdirs()) { throw new IllegalStateException("Failed to create cache dir"); } // Add shutdown hook to delete on exit synchronized (this) { shutdownHook = new Thread(() -> { CountDownLatch latch = new CountDownLatch(1); new Thread(() -> { try { deleteCacheDir(); } catch (IOException ignore) { } latch.countDown(); }).run(); try { latch.await(10, TimeUnit.SECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } }); Runtime.getRuntime().addShutdownHook(shutdownHook); } }
@Override public void run() { super.run(); while (mRunAsyncThread && count < 10000) { add(); sleepIgnoreInterrupt(0, 500); } }
@Override public void run() { super.run(); while (mRunSyncThread && count < 10000) { add(); sleepIgnoreInterrupt(0, 500); } }
public void foo19() { (new Thread(new Runnable() { @Override public void run() { } })). run(); // comment }
public void foo20() { (new Thread(new Runnable() { @Override public void run() { } })). run(); // violation }
@Override public void run() { super.run(); try { test.runTest(); } catch (Exception e) { exception = e; } } }
/** * Execute the thread's {@code Runnable}. Logs a trace message at the start and end of execution. */ public void run() { Messages.msg.tracef("Thread \"%s\" starting execution", this); try { super.run(); } finally { Messages.msg.tracef("Thread \"%s\" exiting", this); } }
@Override public void run() { super.run(); trigger(); }
@Override public void run() { super.run(); trigger(); }
@Signature public Memory run(Environment env, Memory... args){ invoker.setTrace(env.trace()); thread.run(); return Memory.NULL; }
"My thread" prio=10 tid=0x00007fffec082800 nid=0x17e8 waiting on condition [0x00007ffff14eb000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for <0x00000007d6a33d30> (a java.util.concurrent.locks.ReentrantLock$FairSync) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:156) at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:811) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:842) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1178) at java.util.concurrent.locks.ReentrantLock$FairSync.lock(ReentrantLock.java:201) at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:262) at LockTest.reentrantLock(LockTest.java:22) at LockTest$2.run(LockTest.java:25) at java.lang.Thread.run(Thread.java:662)
@Test public void test() { new Thread(() -> { testComplete(); try { fail(); } catch (Throwable ignore) { } latch.countDown(); }).run(); } }
@Override public void run() { // why PMD suppression is needed: https://github.com/pmd/pmd/issues/808 android.os.Process.setThreadPriority(DEFAULT_PRIORITY); //NOPMD AccessorMethodGeneration if (preventNetworkOperations) { StrictMode.setThreadPolicy( new ThreadPolicy.Builder() .detectNetwork() .penaltyDeath() .build()); } try { super.run(); } catch (Throwable t) { uncaughtThrowableStrategy.handle(t); } } };