Java 类org.springframework.core.task.SyncTaskExecutor 实例源码

项目:orbit-spring    文件:ActorInfoContributorTest.java   
private void initializeExtensionWithProperties(
        final ActorInfoContributorConfiguration.GroupProperties.GroupType primary,
        final ActorInfoContributorConfiguration.GroupProperties.GroupType secondary)
{
    ActorInfoContributorConfiguration.GroupProperties groupProperties =
            new ActorInfoContributorConfiguration.GroupProperties();
    groupProperties.setPrimary(primary);
    groupProperties.setSecondary(secondary);
    extension = new ActorInfoContributorLifetimeExtension(reference ->
    {
        // Ideally this would be a mock, but since Mockito keeps references in memory to arguments passed
        // to mocked methods, and some of these tests rely on actor instances being garbage collected, it's
        // necessary to create the fake object manually like so.
        Class<? extends AbstractActor> referenceClass = reference.getClass();
        if (FakeActorImpl.class.isAssignableFrom(referenceClass))
        {
            return FakeActor.class;
        }
        else if (OtherFakeActorImpl.class.isAssignableFrom(referenceClass))
        {
            return OtherFakeActor.class;
        }
        return null;
    }, new ActorInfoDetailsContainer(groupProperties), new SyncTaskExecutor());
    extension.start().join();
}
项目:spring-state-machine-chart-dumper    文件:T1.java   
public StateMachine<States, Events> buildMachineNoTransition() throws Exception {
    StateMachineBuilder.Builder<States, Events> builder = StateMachineBuilder.builder();

    builder.configureConfiguration()
           .withConfiguration()
           .taskExecutor(new SyncTaskExecutor())
    ;

    builder.configureStates()
           .withStates()
           .initial(States.SI)
           .state(States.S1)
           .states(EnumSet.allOf(States.class))
    ;


    return builder.build();
}
项目:spring-state-machine-chart-dumper    文件:T1.java   
public StateMachine<States, Events> buildMachineOnlyNormalStates() throws Exception {
    StateMachineBuilder.Builder<States, Events> builder = StateMachineBuilder.builder();

    builder.configureConfiguration()
           .withConfiguration()
           .taskExecutor(new SyncTaskExecutor())
    ;

    builder.configureStates()
           .withStates()
           .states(EnumSet.allOf(States.class))
    ;


    return builder.build();
}
项目:ml-javaclient-util    文件:DefaultModulesLoader.java   
/**
 *
 */
public void initializeDefaultTaskExecutor() {
    if (taskThreadCount > 1) {
        ThreadPoolTaskExecutor tpte = new ThreadPoolTaskExecutor();
        tpte.setCorePoolSize(taskThreadCount);

        // 10 minutes should be plenty of time to wait for REST API modules to be loaded
        tpte.setAwaitTerminationSeconds(60 * 10);
        tpte.setWaitForTasksToCompleteOnShutdown(true);

        tpte.afterPropertiesSet();
        this.taskExecutor = tpte;
    } else {
        this.taskExecutor = new SyncTaskExecutor();
    }
}
项目:ml-javaclient-util    文件:BatchWriterSupport.java   
protected void initializeDefaultTaskExecutor() {
    if (threadCount > 1) {
        if (logger.isDebugEnabled()) {
            logger.debug("Initializing thread pool with a count of " + threadCount);
        }
        ThreadPoolTaskExecutor tpte = new ThreadPoolTaskExecutor();
        tpte.setCorePoolSize(threadCount);

        // By default, wait for tasks to finish, and wait up to an hour
        tpte.setWaitForTasksToCompleteOnShutdown(true);
        tpte.setAwaitTerminationSeconds(60 * 60);

        tpte.afterPropertiesSet();
        this.taskExecutor = tpte;
    } else {
        if (logger.isDebugEnabled()) {
            logger.debug("Thread count is 1, so using a synchronous TaskExecutor");
        }
        this.taskExecutor = new SyncTaskExecutor();
    }
}
项目:spring-cloud-aws    文件:SimpleStorageResourceTest.java   
@Test
public void getInputStream_existingObject_returnsInputStreamWithContent() throws Exception {
    //Arrange
    AmazonS3 amazonS3 = mock(AmazonS3.class);
    ObjectMetadata objectMetadata = mock(ObjectMetadata.class);
    when(amazonS3.getObjectMetadata(any(GetObjectMetadataRequest.class))).thenReturn(objectMetadata);

    S3Object s3Object = new S3Object();
    s3Object.setObjectMetadata(objectMetadata);
    s3Object.setObjectContent(new ByteArrayInputStream(new byte[]{42}));
    when(amazonS3.getObject(any(GetObjectRequest.class))).thenReturn(s3Object);

    //Act
    SimpleStorageResource simpleStorageResource = new SimpleStorageResource(amazonS3, "bucket", "object", new SyncTaskExecutor());

    //Assert
    assertTrue(simpleStorageResource.exists());
    assertEquals(42, simpleStorageResource.getInputStream().read());
}
项目:spring-cloud-aws    文件:SimpleStorageResourceTest.java   
@Test
public void writeFile_forNewFile_writesFileContent() throws Exception {
    //Arrange
    AmazonS3 amazonS3 = mock(AmazonS3.class);
    SimpleStorageResource simpleStorageResource = new SimpleStorageResource(amazonS3, "bucketName", "objectName", new SyncTaskExecutor());
    String messageContext = "myFileContent";
    when(amazonS3.putObject(eq("bucketName"), eq("objectName"), any(InputStream.class), any(ObjectMetadata.class))).thenAnswer((Answer<PutObjectResult>) invocation -> {
        assertEquals("bucketName", invocation.getArguments()[0]);
        assertEquals("objectName", invocation.getArguments()[1]);
        byte[] content = new byte[messageContext.length()];
        assertEquals(content.length, ((InputStream) invocation.getArguments()[2]).read(content));
        assertEquals(messageContext, new String(content));
        return new PutObjectResult();
    });
    OutputStream outputStream = simpleStorageResource.getOutputStream();

    //Act
    outputStream.write(messageContext.getBytes());
    outputStream.flush();
    outputStream.close();

    //Assert
}
项目:spring-cloud-aws    文件:ContextResourceLoaderAutoConfigurationTest.java   
@Test
public void createResourceLoader_withoutExecutorSettings_executorConfigured() throws Exception {

    //Arrange
    this.context = new AnnotationConfigApplicationContext();
    this.context.register(ContextResourceLoaderAutoConfiguration.class);
    this.context.register(ApplicationBean.class);

    //Act
    this.context.refresh();

    //Assert
    PathMatchingSimpleStorageResourcePatternResolver resourceLoader = this.context.getBean(ApplicationBean.class).getResourceLoader();
    assertNotNull(resourceLoader);

    SimpleStorageResourceLoader simpleStorageResourceLoader = (SimpleStorageResourceLoader) ReflectionTestUtils.getField(resourceLoader, "simpleStorageResourceLoader");
    SyncTaskExecutor taskExecutor = (SyncTaskExecutor) ReflectionTestUtils.getField(simpleStorageResourceLoader, "taskExecutor");
    assertNotNull(taskExecutor);
}
项目:cloudbreak    文件:AbstractFlowConfiguration.java   
protected MachineConfiguration<S, E> getStateMachineConfiguration() {
    StateMachineConfigurationBuilder<S, E> configurationBuilder =
            new StateMachineConfigurationBuilder<>(ObjectPostProcessor.QUIESCENT_POSTPROCESSOR, true);
    StateMachineStateBuilder<S, E> stateBuilder =
            new StateMachineStateBuilder<>(ObjectPostProcessor.QUIESCENT_POSTPROCESSOR, true);
    StateMachineTransitionBuilder<S, E> transitionBuilder =
            new StateMachineTransitionBuilder<>(ObjectPostProcessor.QUIESCENT_POSTPROCESSOR, true);
    StateMachineListener<S, E> listener =
            new StateMachineListenerAdapter<S, E>() {
                @Override
                public void stateChanged(State<S, E> from, State<S, E> to) {
                    LOGGER.debug("state changed from {} to {}", from, to);
                }

                @Override
                public void eventNotAccepted(Message<E> event) {
                    LOGGER.error("{} not accepted event: {}", getClass().getSimpleName(), event);
                }
            };
    return new MachineConfiguration<>(configurationBuilder, stateBuilder, transitionBuilder, listener, new SyncTaskExecutor());
}
项目:cloudbreak    文件:AbstractActionTest.java   
@Before
public void setup() throws Exception {
    underTest = spy(new TestAction());
    underTest.setFailureEvent(Event.FAILURE);
    MockitoAnnotations.initMocks(this);
    BDDMockito.given(flow.getFlowId()).willReturn(FLOW_ID);
    BDDMockito.given(runningFlows.get(anyString())).willReturn(flow);
    StateMachineConfigurationBuilder<State, Event> configurationBuilder =
            new StateMachineConfigurationBuilder<>(ObjectPostProcessor.QUIESCENT_POSTPROCESSOR, true);
    configurationBuilder.setTaskExecutor(new SyncTaskExecutor());
    StateMachineStateBuilder<State, Event> stateBuilder =
            new StateMachineStateBuilder<>(ObjectPostProcessor.QUIESCENT_POSTPROCESSOR, true);
    stateBuilder.withStates().initial(State.INIT).state(State.DOING, underTest, null);
    StateMachineTransitionBuilder<State, Event> transitionBuilder =
            new StateMachineTransitionBuilder<>(ObjectPostProcessor.QUIESCENT_POSTPROCESSOR, true);
    transitionBuilder.withExternal().source(State.INIT).target(State.DOING).event(Event.DOIT);
    stateMachine = new ObjectStateMachineFactory<>(configurationBuilder.build(), transitionBuilder.build(), stateBuilder.build()).getStateMachine();
    stateMachine.start();
}
项目:cloudbreak    文件:AbstractFlowConfigurationTest.java   
@Override
protected FlowConfiguration.MachineConfiguration<State, Event> getStateMachineConfiguration() {
    StateMachineConfigurationBuilder<State, Event> configurationBuilder =
            new StateMachineConfigurationBuilder<>(ObjectPostProcessor.QUIESCENT_POSTPROCESSOR, true);
    StateMachineStateBuilder<State, Event> stateBuilder =
            new StateMachineStateBuilder<>(ObjectPostProcessor.QUIESCENT_POSTPROCESSOR, true);
    StateMachineTransitionBuilder<State, Event> transitionBuilder =
            new StateMachineTransitionBuilder<>(ObjectPostProcessor.QUIESCENT_POSTPROCESSOR, true);
    StateMachineListener<State, Event> listener =
            new StateMachineListenerAdapter<State, Event>() {
                @Override
                public void eventNotAccepted(Message<Event> event) {
                    throw new NotAcceptedException();
                }
            };
    return new FlowConfiguration.MachineConfiguration<State, Event>(configurationBuilder, stateBuilder, transitionBuilder, listener,
            new SyncTaskExecutor());
}
项目:text.classfication    文件:Main2.java   
/**
 * @param args
 */
public static void main(String[] args) {
  ClassPathXmlApplicationContext c = new ClassPathXmlApplicationContext(
      "billing_job.xml");
  SimpleJobLauncher launcher = new SimpleJobLauncher();
  launcher.setJobRepository((JobRepository) c.getBean("jobRepository"));
  launcher.setTaskExecutor(new SyncTaskExecutor());
  try {
    Map<String, JobParameter> parameters = new HashMap<String, JobParameter>();
    parameters.put(RUN_MONTH_KEY, new JobParameter("2011-2"));
    JobExecution je = launcher.run((Job) c.getBean("billingJob"),
        new JobParameters(parameters));
    System.out.println(je);
    System.out.println(je.getJobInstance());
    System.out.println(je.getStepExecutions());
  } catch (Exception e) {
    e.printStackTrace();
  }
}
项目:text.classfication    文件:Main.java   
public static void main(String[] args) {
  ClassPathXmlApplicationContext c = new ClassPathXmlApplicationContext(
      "message_job.xml");
  SimpleJobLauncher launcher = new SimpleJobLauncher();
  launcher.setJobRepository((JobRepository) c.getBean("jobRepository"));
  launcher.setTaskExecutor(new SyncTaskExecutor());
  try {
    Map<String, JobParameter> parameters = new HashMap<String, JobParameter>();
    parameters.put(RUN_MONTH_KEY, new JobParameter("2011-10"));
    JobExecution je = launcher.run((Job) c.getBean("messageJob"),
        new JobParameters(parameters));
    System.out.println(je);
    System.out.println(je.getJobInstance());
    System.out.println(je.getStepExecutions());
  } catch (Exception e) {
    e.printStackTrace();
  }
}
项目:spring4-understanding    文件:RestTemplateXhrTransportTests.java   
private ListenableFuture<WebSocketSession> connect(RestOperations restTemplate, ClientHttpResponse... responses)
        throws Exception {

    RestTemplateXhrTransport transport = new RestTemplateXhrTransport(restTemplate);
    transport.setTaskExecutor(new SyncTaskExecutor());

    SockJsUrlInfo urlInfo = new SockJsUrlInfo(new URI("http://example.com"));
    HttpHeaders headers = new HttpHeaders();
    headers.add("h-foo", "h-bar");
    TransportRequest request = new DefaultTransportRequest(urlInfo, headers, headers,
            transport, TransportType.XHR, CODEC);

    return transport.connect(request, this.webSocketHandler);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:JobLauncherCommandLineRunnerTests.java   
@Override
public JobLauncher getJobLauncher() throws Exception {
    SimpleJobLauncher launcher = new SimpleJobLauncher();
    launcher.setJobRepository(this.jobRepository);
    launcher.setTaskExecutor(new SyncTaskExecutor());
    return launcher;
}
项目:spring-boot-concourse    文件:JobLauncherCommandLineRunnerTests.java   
@Override
public JobLauncher getJobLauncher() throws Exception {
    SimpleJobLauncher launcher = new SimpleJobLauncher();
    launcher.setJobRepository(this.jobRepository);
    launcher.setTaskExecutor(new SyncTaskExecutor());
    return launcher;
}
项目:spring-state-machine-chart-dumper    文件:T1.java   
public StateMachine<States, Events> buildMachine() throws Exception {
    StateMachineBuilder.Builder<States, Events> builder = StateMachineBuilder.builder();

    builder.configureConfiguration()
           .withConfiguration()
           .taskExecutor(new SyncTaskExecutor())
    ;

    builder.configureStates()
           .withStates()
           .initial(States.SI)
           .state(States.S1, new Action<States, Events>() {
               @Override
               public void execute(StateContext<States, Events> context) {
                   System.out.print("test");
               }
           }, null)
           .states(EnumSet.allOf(States.class))
    ;

    builder.configureTransitions()
           .withExternal()
           .source(States.SI).target(States.S1)
           .event(Events.E1)
           .and()
           .withLocal()
           .source(States.S2).target(States.S3)
           .event(Events.E1)
           .and()
           .withExternal()
           .source(States.S2).target(States.SE)
           .event(Events.E2)
           .and()
           .withExternal()
           .source(States.S1).target(States.SE)
           .event(Events.E2);

    return builder.build();
}
项目:spring-state-machine-chart-dumper    文件:SMHierarch1.java   
public StateMachine<String, String> buildUmlMachine(String aPath) throws Exception {
    StateMachineBuilder.Builder<String, String> builder = StateMachineBuilder.builder();

    builder.configureModel().withModel().factory(new UmlStateMachineModelFactory(
            aPath
    ));
    builder.configureConfiguration()
           .withConfiguration()
           .taskExecutor(new SyncTaskExecutor())
    ;
    return builder.build();
}
项目:contestparser    文件:JobLauncherCommandLineRunnerTests.java   
@Override
public JobLauncher getJobLauncher() throws Exception {
    SimpleJobLauncher launcher = new SimpleJobLauncher();
    launcher.setJobRepository(this.jobRepository);
    launcher.setTaskExecutor(new SyncTaskExecutor());
    return launcher;
}
项目:data-lifecycle-service-broker    文件:LCServiceInstanceServiceCopyTest.java   
@Before
public void setUp() throws ServiceInstanceExistsException,
        ServiceBrokerException {
    MockitoAnnotations.initMocks(this);
    service = new LCServiceInstanceService(copyProvider, dataProvider,
            "source_instance_id", brokerRepo, instanceManager,
            new SyncTaskExecutor(), dataProviderService);

}
项目:data-lifecycle-service-broker    文件:LCServiceInstanceServiceProdTest.java   
@Before
public void setUp() throws ServiceInstanceExistsException,
        ServiceBrokerException {
    MockitoAnnotations.initMocks(this);
    service = new LCServiceInstanceService(copyProvider, dataProvider,
            "source_instance_id", brokerRepo, instanceManager,
            new SyncTaskExecutor(), dataProviderService);

}
项目:batchers    文件:ThreadedPerformanceTest.java   
@Test
public void testSingleThreaded() throws Exception {
    respondSuccess(NUMBER_OF_EMPLOYEES);

    setExecutor(new SyncTaskExecutor());
    jobExecution = jobLauncher.run(job, jobParams);
    printExecutionTime("SingleThreaded", jobExecution);
}
项目:spring-cloud-aws    文件:SimpleStorageResourceTest.java   
@Test
public void exists_withExistingObjectMetadata_returnsTrue() throws Exception {
    //Arrange
    AmazonS3 amazonS3 = mock(AmazonS3.class);
    when(amazonS3.getObjectMetadata(any(GetObjectMetadataRequest.class))).thenReturn(new ObjectMetadata());

    //Act
    SimpleStorageResource simpleStorageResource = new SimpleStorageResource(amazonS3, "bucket", "object", new SyncTaskExecutor());

    //Assert
    assertTrue(simpleStorageResource.exists());
}
项目:spring-cloud-aws    文件:SimpleStorageResourceTest.java   
@Test
public void exists_withoutExistingObjectMetadata_returnsFalse() throws Exception {
    //Arrange
    AmazonS3 amazonS3 = mock(AmazonS3.class);
    when(amazonS3.getObjectMetadata(any(GetObjectMetadataRequest.class))).thenReturn(null);

    //Act
    SimpleStorageResource simpleStorageResource = new SimpleStorageResource(amazonS3, "bucket", "object", new SyncTaskExecutor());

    //Act
    assertFalse(simpleStorageResource.exists());
}
项目:spring-cloud-aws    文件:SimpleStorageResourceTest.java   
@Test
public void contentLength_withExistingResource_returnsContentLengthOfObjectMetaData() throws Exception {
    //Arrange
    AmazonS3 amazonS3 = mock(AmazonS3.class);
    ObjectMetadata objectMetadata = new ObjectMetadata();
    objectMetadata.setContentLength(1234L);
    when(amazonS3.getObjectMetadata(any(GetObjectMetadataRequest.class))).thenReturn(objectMetadata);

    //Act
    SimpleStorageResource simpleStorageResource = new SimpleStorageResource(amazonS3, "bucket", "object", new SyncTaskExecutor());

    //Assert
    assertEquals(1234L, simpleStorageResource.contentLength());
}
项目:spring-cloud-aws    文件:SimpleStorageResourceTest.java   
@Test
public void lastModified_withExistingResource_returnsLastModifiedDateOfResource() throws Exception {
    //Arrange
    AmazonS3 amazonS3 = mock(AmazonS3.class);
    ObjectMetadata objectMetadata = new ObjectMetadata();
    Date lastModified = new Date();
    objectMetadata.setLastModified(lastModified);
    when(amazonS3.getObjectMetadata(any(GetObjectMetadataRequest.class))).thenReturn(objectMetadata);

    //Act
    SimpleStorageResource simpleStorageResource = new SimpleStorageResource(amazonS3, "bucket", "object", new SyncTaskExecutor());

    //Assert
    assertEquals(lastModified.getTime(), simpleStorageResource.lastModified());
}
项目:spring-cloud-aws    文件:SimpleStorageResourceTest.java   
@Test
public void contentLength_fileDoesNotExists_reportsError() throws Exception {
    //Arrange
    this.expectedException.expect(FileNotFoundException.class);
    this.expectedException.expectMessage("not found");

    AmazonS3 amazonS3 = mock(AmazonS3.class);
    when(amazonS3.getObjectMetadata(any(GetObjectMetadataRequest.class))).thenReturn(null);
    SimpleStorageResource simpleStorageResource = new SimpleStorageResource(amazonS3, "bucket", "object", new SyncTaskExecutor());

    //Act
    simpleStorageResource.contentLength();

    //Assert
}
项目:spring-cloud-aws    文件:SimpleStorageResourceTest.java   
@Test
public void lastModified_fileDoestNotExist_reportsError() throws Exception {
    //Arrange
    this.expectedException.expect(FileNotFoundException.class);
    this.expectedException.expectMessage("not found");

    AmazonS3 amazonS3 = mock(AmazonS3.class);
    when(amazonS3.getObjectMetadata(any(GetObjectMetadataRequest.class))).thenReturn(null);
    SimpleStorageResource simpleStorageResource = new SimpleStorageResource(amazonS3, "bucket", "object", new SyncTaskExecutor());

    //Act
    simpleStorageResource.lastModified();

    //Assert
}
项目:spring-cloud-aws    文件:SimpleStorageResourceTest.java   
@Test
public void getFileName_existingObject_returnsFileNameWithoutBucketNameFromParameterWithoutActuallyFetchingTheFile() throws Exception {
    //Arrange
    AmazonS3 amazonS3 = mock(AmazonS3.class);
    when(amazonS3.getObjectMetadata(any(GetObjectMetadataRequest.class))).thenReturn(null);

    //Act
    SimpleStorageResource simpleStorageResource = new SimpleStorageResource(amazonS3, "bucket", "object", new SyncTaskExecutor());

    //Assert
    assertEquals("object", simpleStorageResource.getFilename());
}
项目:spring-cloud-aws    文件:SimpleStorageResourceTest.java   
@Test
public void getDescription_withoutObjectMetaData_returnsDescriptiveDescription() throws Exception {
    //Arrange
    AmazonS3 amazonS3 = mock(AmazonS3.class);

    //Act
    SimpleStorageResource simpleStorageResource = new SimpleStorageResource(amazonS3, "1", "2", new SyncTaskExecutor());
    String description = simpleStorageResource.getDescription();

    //Assert
    assertTrue(description.contains("bucket"));
    assertTrue(description.contains("object"));
    assertTrue(description.contains("1"));
    assertTrue(description.contains("2"));
}
项目:spring-cloud-aws    文件:SimpleStorageResourceTest.java   
@Test
public void createRelative_existingObject_returnsRelativeCreatedFile() throws IOException {

    //Arrange
    AmazonS3 amazonS3 = mock(AmazonS3.class);
    when(amazonS3.getObjectMetadata(any(GetObjectMetadataRequest.class))).thenReturn(new ObjectMetadata());
    SimpleStorageResource simpleStorageResource = new SimpleStorageResource(amazonS3, "bucket", "object", new SyncTaskExecutor());

    //Act
    SimpleStorageResource subObject = simpleStorageResource.createRelative("subObject");

    //Assert
    assertEquals("object/subObject", subObject.getFilename());
}
项目:qpp-conversion-tool    文件:ConcurrencyConfigTest.java   
@Test
void testIsSync() {
    TaskExecutor executor = new ConcurrencyConfig().taskExecutor();
    assertThat(executor).isInstanceOf(SyncTaskExecutor.class);
}
项目:oma-riista-web    文件:BatchConfig.java   
@Bean
public JobLauncher jobLauncher() throws Exception {
    return createJobLauncher(jobRepository(), new SyncTaskExecutor());
}
项目:spring-state-machine-chart-dumper    文件:SMHierarch1.java   
public StateMachine<SMHierarch1.States, SMHierarch1.Events> buildMachine() throws Exception {
    StateMachineBuilder.Builder<SMHierarch1.States, SMHierarch1.Events> builder = StateMachineBuilder.builder();

    builder.configureConfiguration()
           .withConfiguration()
           .taskExecutor(new SyncTaskExecutor())
    ;

    builder.configureStates()
           .withStates()
           .initial(States.SI)
           .state(States.S1)
           .end(States.SE)

           .and()
           .withStates()
           .parent(States.S1)
           .initial(States.S1_1)
           .state(States.S1_1)
           .state(States.S1_2)
    ;

    builder.configureTransitions()
           .withExternal()
           .source(States.SI).target(States.S1)
           .event(Events.E_SI_S1)
           .and()
           .withInternal()
           .source(States.S1)
           .event(Events.E_S1_S1)
           .and()
           .withExternal()
           .source(States.S1).target(States.SE)
           .event(Events.E_S1_SE)
           .and()
           .withExternal()
           .source(States.S1_1).target(States.S1_2)
           .event(Events.E_S1_1__S1_2)
    ;

    return builder.build();
}
项目:spring-state-machine-chart-dumper    文件:SMHierarch1.java   
public StateMachine<SMHierarch1.States, SMHierarch1.Events> buildRegionMachine() throws Exception {
    StateMachineBuilder.Builder<SMHierarch1.States, SMHierarch1.Events> builder = StateMachineBuilder.builder();

    builder.configureConfiguration()
           .withConfiguration()
           .taskExecutor(new SyncTaskExecutor())
    ;

    builder.configureStates()
           .withStates()
           .initial(States.S1)
           .state(States.S2)
           .end(States.SE)
           .and()
           .withStates()
           .parent(States.S2)
           .initial(States.S2I)
           .state(States.S21)
           .end(States.S2F)
           .and()
           .withStates()
           .parent(States.S2)
           .initial(States.S3I)
           .state(States.S31)
           .end(States.S3F)
    ;

    builder.configureTransitions()
           .withExternal()
           .source(States.S1).target(States.S2)
           .event(Events.E_S1_S2)
           .and()
           .withExternal()
           .source(States.S2I).target(States.S21)
           .event(Events.E_S2I_S21)
           .and()
           .withExternal()
           .source(States.S21).target(States.S2F)
           .event(Events.E_S21_S2F)
           .and()
           .withInternal()
           .source(States.S21)
           .event(Events.E_S21_S21)
           .and()
           .withExternal()
           .source(States.S3I).target(States.S31)
           .event(Events.E_S3I__S31)
           .and()
           .withExternal()
           .source(States.S2).target(States.SE)
           .event(Events.E_S2__SE)
           .and()
           .withExternal()
           .source(States.S31).target(States.S3F)
           .event(Events.E_S31__S3F)
           .and()
           .withInternal()
           .source(States.S31)
           .event(Events.E_S1_S1)
    ;

    return builder.build();
}
项目:jandy    文件:AbstractWebAppTestCase.java   
@Bean
public TaskExecutor taskExecutor() {
  return new SyncTaskExecutor();
}
项目:burstcoin-jminer    文件:CoreConfig.java   
@Bean(name = "checkTaskExecutor")
public SyncTaskExecutor taskExecutor()
{
  return new SyncTaskExecutor();
}
项目:burstcoin-jminer    文件:Checker.java   
@Autowired
public Checker(ApplicationContext context, SyncTaskExecutor checkTaskExecutor)
{
  this.context = context;
  this.checkTaskExecutor = checkTaskExecutor;
}
项目:yona-server    文件:BatchTaskService.java   
private JobExecution launchImmediatelySynchronously(Job job, JobParameters jobParameters)
{
    // ONLY FOR TEST PURPOSES
    return launchImmediately(new SyncTaskExecutor(), job, jobParameters);
}
项目:wampspring    文件:PubSubReplyAnnotationTest.java   
@Override
public Executor clientInboundChannelExecutor() {
    return new SyncTaskExecutor();
}