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:gov.va.isaac.gui.preferences.plugins.ViewCoordinatePreferencesPluginViewController.java

public static void runLaterIfNotFXApplicationThread(Runnable work) {
    if (Platform.isFxApplicationThread()) {
        work.run();
    } else {/*from w  w  w .jav  a 2s . c  o m*/
        Platform.runLater(work);
    }
}

From source file:com.eclecticlogic.pedal.testing.NoopTransactionMock.java

/**
 * @see com.eclecticlogic.pedal.TransactionRunner#run(java.lang.Runnable)
 *//*from  w w  w.  j  a  v a  2  s  .  c o  m*/
@Override
public void run(Runnable block) {
    block.run();
}

From source file:at.molindo.notify.util.AbstractSmartLifecycle.java

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

From source file:org.ngrinder.agent.service.LocalAgentService.java

@Transactional
public void doSthInTransaction(Runnable runnable) {
    runnable.run();
}

From source file:controllers.AbstractPostingApp.java

protected static Result editPosting(AbstractPosting original, AbstractPosting posting,
        Form<? extends AbstractPosting> postingForm, Call redirectTo, Runnable preUpdateHook) {
    if (postingForm.hasErrors()) {
        return badRequest(ErrorViews.BadRequest.render("error.validation", original.project));
    }//  w  w w  .  j a v  a2s .co  m

    if (!AccessControl.isAllowed(UserApp.currentUser(), original.asResource(), Operation.UPDATE)) {
        return forbidden(ErrorViews.Forbidden.render("error.forbidden", original.project));
    }

    if (posting.body == null) {
        return status(REQUEST_ENTITY_TOO_LARGE, ErrorViews.RequestTextEntityTooLarge.render());
    }

    posting.id = original.id;
    posting.createdDate = original.createdDate;
    posting.updatedDate = JodaDateUtil.now();
    posting.authorId = original.authorId;
    posting.authorLoginId = original.authorLoginId;
    posting.authorName = original.authorName;
    posting.project = original.project;
    posting.setNumber(original.getNumber());
    preUpdateHook.run();

    try {
        posting.checkLabels();
    } catch (IssueLabel.IssueLabelException e) {
        return badRequest(e.getMessage());
    }

    posting.update();
    posting.updateProperties();

    // Attach the files in the current user's temporary storage.
    attachUploadFilesToPost(original.asResource());

    return redirect(redirectTo);
}

From source file:com.athena.meerkat.controller.web.provisioning.log.LogTailerListenerTest.java

@Test
public void testHandleString() {
    LogTailerListener listener = new LogTailerListener(new WebSocketSessionMock());
    long delay = 2000;
    File file = new File("G:\\project\\AthenaMeerkat\\meerkat.log");
    Tailer tailer = new Tailer(file, listener, delay);

    // stupid executor impl. for demo purposes

    Executor executor = new Executor() {
        public void execute(Runnable command) {
            command.run();
        }/*w  w  w  . jav  a2s  .c  o  m*/
    };

    executor.execute(tailer);

    /*
    Thread thread = new Thread(tailer);
    thread.setDaemon(true);
    thread.start();
            
    try{
      Thread.sleep(10000);
    }catch(Exception e){}
    */
}

From source file:com.francetelecom.clara.cloud.commons.PersistenceTestUtil.java

/**
 * Executes the given Runnable on the current thread within a new Transational context
 *///from  w ww. j  av a  2  s .c o m
@Transactional
public void executeWithinTransaction(Runnable runnable) {
    runnable.run();
}

From source file:com.android.volley.mock.MockResponseDelivery.java

@Override
public void postResponse(Request<?> request, Response<?> response, Runnable runnable) {
    postResponse_called = true;/*from w  w  w  .  j a v  a2  s.co m*/
    responsePosted = response;
    runnable.run();
}

From source file:io.mapzone.controller.um.launcher.ArenaLauncher.java

/**
 * Allow one single JMX call to fail without breaking entire config.
 *//*from   www  .  j  a  v a  2s .  c  om*/
protected void checked(Runnable task) {
    try {
        task.run();
    } catch (Throwable e) {
        log.warn("Error while JMX call.", e);
    }
}

From source file:com.digits.sdk.android.ConfirmationCodeControllerTests.java

public void testExecuteRequest_success() throws Exception {
    final DigitsCallback callback = executeRequest();
    final Response response = new Response(TWITTER_URL, HttpStatus.SC_ACCEPTED, "", new ArrayList<Header>(),
            null);//w w  w .j  a  va 2 s  .c o  m
    final DigitsUser user = new DigitsUser(USER_ID, "");
    callback.success(user, response);
    verify(sessionManager).setActiveSession(any(DigitsSession.class));
    verify(sendButton).showFinish();
    final ArgumentCaptor<Runnable> runnableArgumentCaptor = ArgumentCaptor.forClass(Runnable.class);
    verify(phoneEditText).postDelayed(runnableArgumentCaptor.capture(), eq(DigitsControllerImpl.POST_DELAY_MS));
    final Runnable runnable = runnableArgumentCaptor.getValue();
    runnable.run();

    final ArgumentCaptor<Bundle> bundleArgumentCaptor = ArgumentCaptor.forClass(Bundle.class);
    verify(resultReceiver).send(eq(LoginResultReceiver.RESULT_OK), bundleArgumentCaptor.capture());
    assertEquals(PHONE_WITH_COUNTRY_CODE, bundleArgumentCaptor.getValue().getString(DigitsClient.EXTRA_PHONE));
}