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:com.github.mrstampy.gameboot.usersession.UserSessionAssistTest.java

private void gameBootExpected(Runnable r, String failMsg) {
    try {/*w  w w  .j a  va2  s .c o m*/
        r.run();
        fail(failMsg);
    } catch (GameBootRuntimeException expected) {
    }
}

From source file:de.innovationgate.wgpublisher.webtml.utils.ItemExpression.java

public Object retrieve(Map<String, Object> params, List<Object> unnamedParams, Map<String, Object> objects)
        throws WGException {

    Object itemValue = retrieveItemValue();

    if (_itemCall != null && itemValue != null) {
        itemValue = performItemCall(itemValue, params, unnamedParams, objects);
    }/*www.j a v a  2s.  c  o  m*/

    for (Runnable cleanup : _afterRetrieval) {
        cleanup.run();
    }

    return itemValue;

}

From source file:com.kixeye.chassis.transport.websocket.WebSocketSession.java

/**
 * Close this // ww w. j ava2 s .co m
 */
protected void close() {
    isClosing.set(true);

    Iterator<Runnable> closeListenersIter = closeListeners.iterator();

    while (closeListenersIter.hasNext()) {
        Runnable listener = closeListenersIter.next();

        try {
            listener.run();
        } catch (Exception e) {
            logger.error("Unable to notify listener", e);
        }
    }
}

From source file:com.l2jfree.util.concurrent.L2RejectedExecutionHandler.java

@Override
public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
    if (executor.isShutdown())
        return;//  w  w  w  . j av a  2s  . c o  m

    _log.warn(r + " from " + executor, new RejectedExecutionException());

    if (Thread.currentThread().getPriority() > Thread.NORM_PRIORITY)
        new Thread(r).start();
    else
        r.run();
}

From source file:ninja.pfventure.sample.ember.PortletViewController.java

@RenderMapping
public String question(Model model) {
    model.addAttribute("releaseInfo", ReleaseInfo.getReleaseInfo());

    System.out.println("=== RunnableTest ===");

    // Anonymous Runnable
    Runnable r1 = new Runnable() {

        @Override/* ww w  .  ja va  2  s  .co  m*/
        public void run() {
            System.out.println("Hello world one!");
        }
    };

    // Lambda Runnable
    Runnable r2 = () -> System.out.println("Hello world two!");

    // Run em!
    r1.run();
    r2.run();
    return "sample-ember/view";
}

From source file:com.mellanox.r4h.ServerPortalWorker.java

void processReplies() {
    msgCounter.set(0);//from   ww  w.j  a v  a  2 s.co  m
    Runnable opr = asyncOprQueue.poll();
    while (opr != null) {
        try {
            opr.run();
        } catch (Throwable t) {
            LOG.error(StringUtils.stringifyException(t));
        }
        opr = asyncOprQueue.poll();
    }
}

From source file:com.adobe.cq.wcm.core.components.internal.servlets.AdaptiveImageServletMappingConfigurationConsumer.java

/**
 * If the properties that apply to the {@link AdaptiveImageServlet} registration are valid, then the {@code apply} {@link Runnable} will
 * be executed./*from  www  .  ja  va2 s. c o m*/
 *
 * @param config the configuration to check
 * @param apply  the runnable to execute, if the configuration is valid
 */
private void applyValidConfiguration(AdaptiveImageServletMappingConfigurationFactory config, Runnable apply) {
    if (!config.getResourceTypes().isEmpty() && !config.getSelectors().isEmpty()
            && !config.getExtensions().isEmpty()) {
        apply.run();
    } else {
        LOG.warn("One of the servlet registration properties from the following {} configuration is empty: {}.",
                config.getClass().getName(), config.toString());
    }
}

From source file:com.codecrate.shard.ui.transfer.progress.EventDispatcherThreadProgressMonitor.java

private void updateProgressBar(Runnable task) {
    if (!SwingUtilities.isEventDispatchThread()) {
        try {/*from  w  w w.  j  av  a 2 s.  c  o  m*/
            SwingUtilities.invokeAndWait(task);
        } catch (Exception e) {
            LOG.warn("Error updating progress bar", e);
        }
    } else {
        task.run();
    }
}

From source file:com.addthis.hydra.job.SpawnHttp.java

@Override
public void doStop() {
    for (Runnable onStop : onStopList) {
        onStop.run();
    }
}

From source file:ch.rasc.wampspring.broker.SimpleBrokerMessageHandler.java

@Override
public final void stop(Runnable callback) {
    synchronized (this.lifecycleMonitor) {
        stop();/*from ww w  .jav a 2  s.c  o  m*/
        callback.run();
    }
}