Example usage for java.lang Thread start

List of usage examples for java.lang Thread start

Introduction

In this page you can find the example usage for java.lang Thread start.

Prototype

public synchronized void start() 

Source Link

Document

Causes this thread to begin execution; the Java Virtual Machine calls the run method of this thread.

Usage

From source file:Main.java

public ThreadGroupDemo() {
    try {/*  w w w .j  a v a2 s .co m*/
        ThreadGroup pGroup = new ThreadGroup("Parent ThreadGroup");

        ThreadGroup cGroup = new ThreadGroup(pGroup, "Child ThreadGroup");

        Thread t1 = new Thread(pGroup, this);
        System.out.println("Starting " + t1.getName());
        t1.start();

        Thread t2 = new Thread(cGroup, this);
        System.out.println("Starting " + t2.getName());
        t2.start();

        pGroup.checkAccess();
        System.out.println(pGroup.getName() + " has access");
        cGroup.checkAccess();
        System.out.println(cGroup.getName() + " has access");
    } catch (Exception ex) {
        System.out.println(ex.toString());
    }
}

From source file:com.sharneng.net.misc.EchoProcessor.java

public void process() {
    Thread t = new Thread(this);
    t.start();

    if (log.isTraceEnabled()) {
        log.trace("started new process threads: " + this);
    }/*from  w  ww.  j  a  v  a 2  s  . co  m*/
}

From source file:edu.clemson.cs.nestbed.server.util.ShutdownTrigger.java

public ShutdownTrigger() {
    Thread t = new Thread(new ShutdownTriggerThread());
    t.start();
}

From source file:PatchyMIDlet.java

public void startApp() {
    mDisplay = Display.getDisplay(this);
    mForm.addCommand(new Command("Exit", Command.EXIT, 0));
    mForm.setCommandListener(this);

    Thread t = new Thread(this);
    t.start();

    mDisplay.setCurrent(mForm);//from   w w w. j  a v a  2s  . c  om
}

From source file:J2MEImageLoader.java

public void startApp() {
    mDisplay = Display.getDisplay(this);
    mDisplay.setCurrent(mForm);/*ww w  .  j  a v a 2 s.c  o m*/

    Thread t = new Thread(this);
    t.start();
}

From source file:CookieMIDlet.java

public void commandAction(Command c, Displayable s) {
    if (c.getCommandType() == Command.EXIT)
        notifyDestroyed();//from w  w w.j a va  2 s .  com
    else {
        Form waitForm = new Form("Connecting...");
        mDisplay.setCurrent(waitForm);
        Thread t = new Thread(this);
        t.start();
    }
}

From source file:SweepGame.java

public void start() {
    mTrucking = true;
    Thread t = new Thread(this);
    t.start();
}

From source file:com.aniruddhc.acemusic.player.GMusicHelpers.GMusicClientCalls.java

/************************************************************************
 * Resets the current HTTP client object by shutting it down and then 
 * reinstantiating it. The old cookie store, user agent and authorization 
 * header will be reused. This process will be done on a separate thread.
 ************************************************************************/
public static void resetHttpClient() {
    //Reset the HTTP Client on a separate thread.
    Thread thread = new Thread() {

        @Override/*from w  ww. j a v  a2  s  . com*/
        public void run() {
            if (mHttpClient != null) {
                mHttpClient.getHttpClient().getConnectionManager().shutdown();
                mHttpClient = new GMusicHttpClient();
                mHttpClient.setCookieStore(mCookieStore);
                mHttpClient.setUserAgent(mWebClientUserAgent);
                mHttpClient.addHeader("Authorization", "GoogleLogin auth=" + mAuthToken);
            }

        }

    };
    thread.start();

}

From source file:Main.java

public TestPane() {
    Thread thread = new Thread(new BackgroundMonitor());
    thread.setDaemon(true);
    thread.start();
}