Example usage for java.lang Runnable run

List of usage examples for java.lang Runnable run

Introduction

In this page you can find the example usage for java.lang Runnable run.

Prototype

public abstract void run();

Source Link

Document

When an object implementing interface Runnable is used to create a thread, starting the thread causes the object's run method to be called in that separately executing thread.

Usage

From source file:net.ben.subsonic.androidapp.util.Util.java

public static void confirm(Context context, int messageId, final Runnable task) {
    new AlertDialog.Builder(context).setIcon(android.R.drawable.ic_dialog_info).setTitle(messageId)
            .setPositiveButton(R.string.common_ok, new DialogInterface.OnClickListener() {
                @Override//from  www  .  j a v a 2s . c om
                public void onClick(DialogInterface dialog, int whichButton) {
                    dialog.dismiss();
                    task.run();
                }
            }).setNegativeButton(R.string.common_cancel, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int whichButton) {
                    dialog.dismiss();
                }
            }).show();
}

From source file:com.vaadin.spring.internal.BeanStore.java

public void destroy() {
    if (destroyed) {
        LOGGER.trace("[{}] has already been destroyed, ignoring", this);
        return;/* ww w  .j a  va2s.co  m*/
    }
    try {
        LOGGER.debug("Destroying [{}]", this);
        for (Runnable destructionCallback : destructionCallbacks.values()) {
            try {
                destructionCallback.run();
            } catch (Exception e) {
                LOGGER.error("BeanStore destruction callback failed", e);
            }
        }
        destructionCallbacks.clear();
        objectMap.clear();
        if (destructionCallback != null) {
            try {
                destructionCallback.beanStoreDestroyed(this);
            } catch (Exception e) {
                LOGGER.error("BeanStore final destruction callback failed", e);
            }
        }
    } finally {
        destroyed = true;
    }
}

From source file:org.infinitest.eclipse.SwtEventQueue.java

@Override
public void push(final Runnable runnable) {
    pushNamed(new NamedRunnable("") {
        @Override//from  w  w  w .  j a  va 2 s .  c o  m
        public void run() {
            runnable.run();
        }
    });
}

From source file:com.github.lothar.security.acl.jpa.multithread.MultithreadCustomerRepositoryTest.java

private Throwable catchExec(Runnable runnable) {
    try {//w w w  .  j ava  2 s . co  m
        runnable.run();
    } catch (Throwable t) {
        return t;
    }
    return null;
}

From source file:com.github.mrstampy.gameboot.otp.OneTimePadTest.java

private void illegalArgumentRunner(Runnable r, String failMsg) {
    try {//from   ww w.j  av  a2  s .  c om
        r.run();
        fail(failMsg);
    } catch (IllegalArgumentException expected) {
    }
}

From source file:org.granite.client.tide.spring.ViewScope.java

@Override
public void registerDestructionCallback(String name, final Runnable callback) {
    getBeanCache().addResetter(name, new BeanResetter() {
        @Override/*from www .ja  va  2s  .  co  m*/
        public void reset(Object instance) {
            callback.run();
        }
    });
}

From source file:org.age.services.discovery.internal.HazelcastDiscoveryService.java

@Override
public void stop(final Runnable callback) {
    stop();
    callback.run();
}

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();
        LOGGER.info("Task {} finished", t.getClass().getSimpleName());
    }/*from   w  w  w .j a  va  2 s. c  om*/
}

From source file:hsa.awp.common.util.OpenEntityManagerTimerTaskFactory.java

@Override
public TimerTask getTask(final Runnable task) {

    return new TimerTask() {
        @Override//w w  w.  j  a v  a2  s  .  co m
        public void run() {

            openEntityManager();
            task.run();
            closeEntityManager();
        }
    };
}

From source file:net.sourceforge.jabm.SimulationManager.java

public void launch(Runnable controller) {
    logger.info("Starting...");
    long start = System.currentTimeMillis();
    controller.run();
    long finish = System.currentTimeMillis();
    long duration = finish - start;
    logger.info("all done.");
    logger.info("completed simulation(s) in " + duration + "ms.");
}