List of usage examples for java.lang Runnable run
public abstract void run();
Runnable
is used to create a thread, starting the thread causes the object's run
method to be called in that separately executing thread. From source file:com.adobe.acs.commons.workflow.bulk.execution.impl.BulkWorkflowEngineImpl.java
@Override public final void start(Config config) throws PersistenceException { Workspace workspace = config.getWorkspace(); workspace.getRunner().start(workspace); Runnable job = workspace.getRunner().getRunnable(config); ScheduleOptions options = workspace.getRunner().getOptions(config); if (options != null) { scheduler.schedule(job, options); } else {/*from w w w. j av a 2s . c o m*/ job.run(); } workspace.commit(); }
From source file:spring.osgi.context.internal.OsgiBundleScope.java
public void destroy() { boolean debug = log.isDebugEnabled(); // handle only the local cache/localBeans // the ServiceFactory object will be destroyed upon service // unregistration for (Map.Entry<String, Runnable> stringRunnableEntry : destructionCallbacks.entrySet()) { Map.Entry entry = (Map.Entry) stringRunnableEntry; Runnable callback = (Runnable) entry.getValue(); if (debug) log.debug("destroying local bundle scoped bean [" + entry.getKey() + "]"); callback.run(); }//from w ww . j a va 2 s .c o m destructionCallbacks.clear(); localBeans.clear(); }
From source file:com.anrisoftware.prefdialog.dialogaction.AbstractDialogAction.java
/** * Waits for the dialog to be created and opens the dialog. Waits until the * user either canceled or approved the dialog. After the dialog was * approved a value is created and returned. * * @see #createValue(SimpleDialog)//from w ww . jav a2 s. c om */ @Override public ValueType call() throws Exception { worker = new SwingWorker<ValueType, Runnable>() { @Override protected ValueType doInBackground() throws Exception { publish(openDialog); waitForDialog(); return createValue(); } @Override protected void process(List<Runnable> chunks) { for (Runnable runnable : chunks) { runnable.run(); } } }; worker.execute(); return worker.get(); }
From source file:fi.hsl.parkandride.core.service.UserServiceTest.java
@Test public void operator_is_required_for_operator() { Runnable createFn = () -> userService.createUser(operator, adminActor); createFn.run(); verify(userRepository).insertUser(anyObject()); operator.operatorId = null;//from w ww. j a v a 2 s. c om assertOperatorRequired(createFn); }
From source file:fi.hsl.parkandride.core.service.UserServiceTest.java
@Test public void operator_is_required_for_operator_api() { Runnable createFn = () -> userService.createUser(operatorAPI, adminActor); createFn.run(); verify(userRepository).insertUser(anyObject()); operatorAPI.operatorId = null;//from w w w . ja va 2s. c o m assertOperatorRequired(createFn); }
From source file:fr.norad.visuwall.core.business.service.ProjectService.java
public Runnable getProjectCreationRunner(final Wall wallWhereToAdd, final SoftwareAccess buildSoftwareAccess, final SoftwareProjectId projectId) { Preconditions.checkState(buildSoftwareAccess.getConnection() instanceof BuildCapability, "softwareAccess needs to point to BuildCapability plugin connection"); return new Runnable() { @SuppressWarnings("unchecked") @Override/* w w w . ja va 2 s . c o m*/ public void run() { LOG.debug("Running project creation task for project id " + projectId + " on software " + buildSoftwareAccess + " in wall " + wallWhereToAdd); BuildCapability buildConnection = (BuildCapability) buildSoftwareAccess.getConnection(); Project connectedProject = new Project(projectId, buildConnection); Runnable updateProjectRunner = getUpdateProjectRunner(wallWhereToAdd, connectedProject); LOG.debug("Launching first project updater for " + connectedProject); updateProjectRunner.run(); ScheduledFuture<Object> updateProjectTask = taskScheduler.scheduleAtFixedRate(updateProjectRunner, buildSoftwareAccess.getProjectStatusDelaySecond() * 1000); connectedProject.setUpdateProjectTask(updateProjectTask); LOG.debug("Adding project " + connectedProject + " to wall " + wallWhereToAdd); wallWhereToAdd.getProjects().add(connectedProject); } }; }
From source file:fi.hsl.parkandride.core.service.UserServiceTest.java
@Test public void password_is_required_for_operator() { Runnable createFn = () -> userService.createUser(operator, adminActor); createFn.run(); verify(userRepository).insertUser(anyObject()); operator.password = null;// w w w . j a v a 2 s . c o m assertBadPassword(createFn); operator.password = ""; assertBadPassword(createFn); operator.password = " "; assertBadPassword(createFn); }
From source file:org.trpr.platform.batch.impl.spring.jmx.BatchMetricsExporter.java
/** * Interface method implementation//ww w . j av a2s. co m * @see org.springframework.context.SmartLifecycle#stop(java.lang.Runnable) */ public void stop(Runnable callback) { this.lifecycleLock.lock(); try { this.stop(); callback.run(); } finally { this.lifecycleLock.unlock(); } }
From source file:SingleThreadRequestExecutor.java
public ScheduledFuture<?> schedule(final Runnable command, long delay, TimeUnit unit) { return executor.schedule(new Runnable() { @Override//from www .j av a 2 s .c o m public void run() { try { command.run(); } catch (Throwable e) { // This normally bad code of catch on Exception is here for a *reason*. // Future *eats* all exceptions *silently*. This clause at least allows // the exception to emit noise for debugging. This is particularly pernicious // if you have something like a NullPointerException e.printStackTrace(); throw new RuntimeException(e); } } }, delay, unit); }
From source file:gaderian.test.services.TestBuilderFactory.java
public void testInitializeMethodFailure() throws Exception { Registry r = buildFrameworkRegistry("InitializeMethodFailure.xml", false); Runnable s = (Runnable) r.getService("gaderian.test.services.Runnable", Runnable.class); interceptLogging("gaderian.test.services.Runnable"); s.run(); assertLoggedMessagePattern(/*from ww w . ja v a 2 s.c om*/ "Error at .*?: Unable to initialize service gaderian\\.test\\.services\\.Runnable " + "\\(by invoking method doesNotExist on " + "gaderian\\.test\\.services\\.impl\\.MockRunnable\\):"); }