congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
Thread.suspend
Code IndexAdd Tabnine to your IDE (free)

How to use
suspend
method
in
java.lang.Thread

Best Java code snippets using java.lang.Thread.suspend (Showing top 20 results out of 315)

origin: robovm/robovm

/**
 * Suspends every thread in this group and recursively in all its
 * subgroups.
 *
 * @see Thread#suspend
 * @see #resume
 *
 * @deprecated Requires deprecated method {@link Thread#suspend()}.
 */
@SuppressWarnings("deprecation")
@Deprecated
public final void suspend() {
  if (suspendHelper()) {
    Thread.currentThread().suspend();
  }
}
origin: robovm/robovm

@SuppressWarnings("deprecation")
private boolean suspendHelper() {
  boolean suspendCurrent = false;
  synchronized (threadRefs) {
    Thread current = Thread.currentThread();
    for (Thread thread : threads) {
      if (thread == current) {
        suspendCurrent = true;
      } else {
        thread.suspend();
      }
    }
  }
  synchronized (groups) {
    for (ThreadGroup group : groups) {
      suspendCurrent |= group.suspendHelper();
    }
  }
  return suspendCurrent;
}
origin: apache/pulsar

  public void run() {
    try {
      t.suspend();
      l.countDown();
      Thread.sleep(seconds * 1000);
      t.resume();
    } catch (Exception e) {
      LOG.error("Error suspending thread", e);
    }
  }
};
origin: apache/ignite

/**
 * @param suspend If {@code true} suspends worker threads.
 */
public void pauseAll(boolean suspend) {
  pauseResumeOperation(true, openSockLock, writeLock);
  if (suspend) {
    for (Thread t : impl.threads())
      t.suspend();
  }
}
origin: scouter-project/scouter

  ctx.thread.resume();
} else if ("suspend".equalsIgnoreCase(action)) {
  ctx.thread.suspend();
origin: scouter-project/scouter

  ctx.thread.resume();
} else if ("suspend".equalsIgnoreCase(action)) {
  ctx.thread.suspend();
origin: apache/ignite

thread.suspend();
blockedAnything = true;
origin: loveincode/Java-Multi-thread-Programming

public void setValue(String u, String p) {
  this.username = u;
  if (Thread.currentThread().getName().equals("a")) {
    System.out.println("停止a线程!");
    Thread.currentThread().suspend();
  }
  this.password = p;
}
origin: loveincode/Java-Multi-thread-Programming

  synchronized public void printString() {
    System.out.println("begin");
    if (Thread.currentThread().getName().equals("a")) {
      System.out.println("a线程永远 suspend了!");
      Thread.currentThread().suspend();
    }
    System.out.println("end");
  }
}
origin: org.gephi/desktop-branding

private void suspendThreads() {
  Set<Thread> threadSet = Thread.getAllStackTraces().keySet();
  // List every thread in the group
  for (Thread t : threadSet) {
    if (t.getName().startsWith(GENERATOR_THREAD)
        || t.getName().startsWith(IMPORTER_THREAD)
        || t.getName().startsWith(EXPORTER_THREAD)
        || t.getName().startsWith(PROJECT_THREAD)
        || t.getName().startsWith(STATISTICS_THREAD)
        || t.getName().startsWith(PREVIEW_THREAD)) {
      if (t.isAlive()) {
        t.suspend();
      }
    }
  }
}
origin: MobiVM/robovm

/**
 * Suspends every thread in this group and recursively in all its
 * subgroups.
 *
 * @see Thread#suspend
 * @see #resume
 *
 * @deprecated Requires deprecated method {@link Thread#suspend()}.
 */
@SuppressWarnings("deprecation")
@Deprecated
public final void suspend() {
  if (suspendHelper()) {
    Thread.currentThread().suspend();
  }
}
origin: com.gluonhq/robovm-rt

/**
 * Suspends every thread in this group and recursively in all its
 * subgroups.
 *
 * @see Thread#suspend
 * @see #resume
 *
 * @deprecated Requires deprecated method {@link Thread#suspend()}.
 */
@SuppressWarnings("deprecation")
@Deprecated
public final void suspend() {
  if (suspendHelper()) {
    Thread.currentThread().suspend();
  }
}
origin: ibinti/bugvm

/**
 * Suspends every thread in this group and recursively in all its
 * subgroups.
 *
 * @see Thread#suspend
 * @see #resume
 *
 * @deprecated Requires deprecated method {@link Thread#suspend()}.
 */
@SuppressWarnings("deprecation")
@Deprecated
public final void suspend() {
  if (suspendHelper()) {
    Thread.currentThread().suspend();
  }
}
origin: com.mobidevelop.robovm/robovm-rt

/**
 * Suspends every thread in this group and recursively in all its
 * subgroups.
 *
 * @see Thread#suspend
 * @see #resume
 *
 * @deprecated Requires deprecated method {@link Thread#suspend()}.
 */
@SuppressWarnings("deprecation")
@Deprecated
public final void suspend() {
  if (suspendHelper()) {
    Thread.currentThread().suspend();
  }
}
origin: com.bugvm/bugvm-rt

/**
 * Suspends every thread in this group and recursively in all its
 * subgroups.
 *
 * @see Thread#suspend
 * @see #resume
 *
 * @deprecated Requires deprecated method {@link Thread#suspend()}.
 */
@SuppressWarnings("deprecation")
@Deprecated
public final void suspend() {
  if (suspendHelper()) {
    Thread.currentThread().suspend();
  }
}
origin: zycgit/hasor

  @Override
  public void evaluate() throws Throwable {
    try {
      /*A.启动监控线程*/
      for (Thread thread : daemonThreads) {
        thread.start();
      }
      invokerStatement.evaluate();
    } finally {
      /*b.终止监控线程*/
      for (Thread thread : daemonThreads) {
        thread.suspend();
        thread.interrupt();
      }
    }
  }
};
origin: stackoverflow.com

 public class Test implements Runnable {
  public void run() {
    synchronized(this) { 
      // some work
    }
  }

  public static void main(String args[]) throws Exception {
    Test target = new Test();
    Thread t = new Thread(target);
    t.start();

    synchronized(target) {
      t.suspend();
    }
    System.out.println("Hi");
  }
}
origin: com.jtransc/jtransc-rt

@Deprecated
@SuppressWarnings("deprecation")
public final void suspend() {
  for (Thread thread : getThreadsCopy()) thread.suspend();
  for (ThreadGroup group : getChildrenCopy()) group.suspend();
}
origin: javapathfinder/jpf-core

@Test
public void testBasicSuspendDeadlock(){
 if (verifyDeadlock("+cg.threads.break_yield")) {
  Thread t1 = new T1();
  t1.start();
  while (!isRunning) {
   Thread.yield();
  }
  t1.suspend();
  assertTrue(t1.getState() == Thread.State.RUNNABLE);
  pass = true;
  
  // without resuming, T1 should not be scheduled again, despite being in a RUNNABLE state
  //t1.resume();
 }
}

origin: javapathfinder/jpf-core

@Test
public void testLockholderSuspendDeadlock(){
 if (verifyDeadlock("+cg.threads.break_yield")) {
  Thread t2 = new T2();
  t2.start();
  while (!isRunning) {
   Thread.yield();
  }
  System.out.println("main suspending t2");
  t2.suspend();
  // now t2 should hold and never give up its lock 
  
  synchronized (t2){
   fail("main should never get here");
  }
 }
}

java.langThreadsuspend

Javadoc

Suspends this thread.

First, the checkAccess method of this thread is called with no arguments. This may result in throwing a SecurityException (in the current thread).

If the thread is alive, it is suspended and makes no further progress unless and until it is resumed.

Popular methods of Thread

  • currentThread
  • sleep
    Causes the currently executing thread to sleep (temporarily cease execution) for the specified numbe
  • <init>
    Constructs a new Thread with no Runnable object, the given name and belonging to the ThreadGroup pas
  • start
    Causes this thread to begin execution; the Java Virtual Machine calls the run method of this thread
  • getContextClassLoader
    Returns the context ClassLoader for this Thread. The context ClassLoader is provided by the creator
  • interrupt
    Interrupts this thread. Unless the current thread is interrupting itself, which is always permitted,
  • setDaemon
    Marks this thread as either a #isDaemon thread or a user thread. The Java Virtual Machine exits when
  • getName
    Returns this thread's name.
  • join
    Waits at most millis milliseconds plus nanos nanoseconds for this thread to die. This implementatio
  • setContextClassLoader
    Sets the context ClassLoader for this Thread. The context ClassLoader can be set when a thread is cr
  • setName
    Changes the name of this thread to be equal to the argumentname. First the checkAccess method of thi
  • interrupted
    Tests whether the current thread has been interrupted. Theinterrupted status of the thread is cleare
  • setName,
  • interrupted,
  • getStackTrace,
  • getId,
  • isInterrupted,
  • isAlive,
  • setPriority,
  • yield,
  • getThreadGroup,
  • getPriority

Popular in Java

  • Reactive rest calls using spring rest template
  • requestLocationUpdates (LocationManager)
  • onCreateOptionsMenu (Activity)
  • getSystemService (Context)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • JPanel (javax.swing)
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • 21 Best IntelliJ Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now