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.navercorp.pinpoint.collector.receiver.thrift.udp.UDPReceiverTest.java

private Executor mockDispatchWorker(CountDownLatch latch) {

    Executor mockWorker = new Executor() {
        @Override//from  w w w .jav  a2  s .  com
        public void execute(Runnable runnable) {
            logger.info("execute:{}", runnable.getClass());
            try {
                runnable.run();
            } finally {
                latch.countDown();
            }
        }
    };
    return Mockito.spy(mockWorker);
}

From source file:ar.com.zauber.commons.async.DelegateTaskExecutor.java

@Override
public void execute(final Runnable command) {
    incrementActiveJobs();/*  w w  w. jav  a  2  s  .  c  o  m*/

    try {
        executorService.execute(new Runnable() {

            @Override
            public void run() {
                try {
                    command.run();
                } finally {
                    decrementActiveJobs();
                }

            }
        });
    } catch (final Exception e) {
        // only on error we decrement.
        decrementActiveJobs();
    }
}

From source file:org.keycloak.testsuite.util.SamlClientBuilder.java

/**
 * Adds a single generic step//from   w  ww  .  ja  va 2  s. c o  m
 * @param step
 * @return This builder
 */
public SamlClientBuilder addStep(Runnable stepWithNoParameters) {
    addStep((client, currentURI, currentResponse, context) -> {
        stepWithNoParameters.run();
        return null;
    });
    return this;
}

From source file:scope.thread.ThreadScopeAttributes.java

/**
 * Processes all bean destruction callbacks.
 *///w ww  . jav  a  2  s  . c o  m
private final void processDestructionCallbacks() {
    for (String name : hRequestDestructionCallbacks.keySet()) {
        Runnable callback = hRequestDestructionCallbacks.get(name);

        logger.debug("Performing destruction callback for '" + name + "' bean" + " on thread '"
                + Thread.currentThread().getName() + "'.");

        callback.run();
    }

    hRequestDestructionCallbacks.clear();
}

From source file:hermes.browser.dialog.DestinationPropertyConfigPanel.java

public void doOK() {
    if (beanPropertyPanel != null) {
        log.debug("config=" + config);

        beanPropertyPanel.doOK();//from w ww. ja va 2s  .c o  m

        if (beanPropertyPanel.getChanges().size() > 0) {
            if (config.getProperties() == null) {
                // @@TODO Fix.

                config.setProperties(new PropertySetConfig());
            }

            try {
                HermesBrowser.getConfigDAO().updatePropertySet(config.getProperties(),
                        beanPropertyPanel.getChanges());
            } catch (JAXBException e) {
                log.error(e.getMessage(), e);
            }
        }
    }

    for (Iterator iter = onOK.iterator(); iter.hasNext();) {
        Runnable r = (Runnable) iter.next();
        r.run();
    }

}

From source file:org.vertx.spring.examples.AbstractHandlerBean.java

@Override
public void stop(final Runnable callback) {
    eventBus.unregisterHandler(getAddress(), this, new AsyncResultHandler<Void>() {
        @Override//from ww w. j  a va 2s .  c om
        public void handle(AsyncResult<Void> event) {
            callback.run();
        }
    });
}

From source file:com.aw.swing.mvp.focus.ConcurrentFocusManager.java

public void invokeLater(final String description, final Runnable runnable) {
    logger.debug("FocusConcur enqueued:" + description);
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            logger.debug("FocusConcur dequeued:" + description);
            runnable.run();
        }//from   ww w  .  j a  va  2  s .  c  o  m
    });
}

From source file:nebula.plugin.metrics.dispatcher.AbstractMetricsDispatcher.java

@Override
protected final void execute(Runnable runnable) throws Exception {
    runnable.run();
}

From source file:fr.norad.visuwall.core.business.process.WallProcess.java

private Runnable getDiscoverBuildProjectsRunner(final Wall wall, final SoftwareAccess softwareAccess) {
    if (!(softwareAccess.getConnection() instanceof BuildCapability)) {
        throw new RuntimeException("Software should be a build one " + softwareAccess);
    }/*  w  w  w . j  a  va  2  s  . c  o  m*/
    return new Runnable() {
        @Override
        public void run() {
            LOG.debug("Running Project Discover task for " + softwareAccess + " in wall " + wall);
            Set<SoftwareProjectId> projectIds = softwareAccessService.discoverBuildProjects(softwareAccess);
            List<SoftwareProjectId> wallBuildProjectIds = wall.getProjects().getBuildProjectIds();
            for (SoftwareProjectId projectId : projectIds) {
                if (wallBuildProjectIds.contains(projectId)) {
                    continue;
                }
                Runnable projectCreationRunner = WallProcess.this.projectService.getProjectCreationRunner(wall,
                        softwareAccess, projectId);
                projectCreationRunner.run();
                // taskScheduler.schedule(projectCreationRunner, new Date());
            }
        }
    };
}

From source file:com.amazonaws.services.simpleworkflow.flow.spring.SpringActivityWorker.java

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