Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License"). You may not
   * use this file except in compliance with the License. A copy of the License is
   * located at
   * 
   * http://aws.amazon.com/apache2.0
   * 
  * or in the "license" file accompanying this file. This file is distributed on
  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  * express or implied. See the License for the specific language governing
  * permissions and limitations under the License.
  */
 package com.amazonaws.services.simpleworkflow.flow.spring;
 
 
 import  org.springframework.context.SmartLifecycle;
 
To be used with Spring. Assumes that injected implementation bean has "workflow" scope. Otherwise the same object instance will be reused for multiple decisions which is guaranteed to break replay if any instance fields are used.
 
 public class SpringWorkflowWorker implements WorkerBase, SmartLifecycle {
 
     private final GenericWorkflowWorker genericWorker;
 
 
     private int startPhase;
 
     private long terminationTimeoutSeconds = 60;
 
     private boolean disableAutoStartup;
 
     public SpringWorkflowWorker() {
          = new GenericWorkflowWorker();
     }
 
     public SpringWorkflowWorker(AmazonSimpleWorkflow serviceString domainString taskListToPoll) {
          = new GenericWorkflowWorker(servicedomaintaskListToPoll);
     }
 
     public AmazonSimpleWorkflow getService() {
         return .getService();
     }
 
     public void setService(AmazonSimpleWorkflow service) {
         .setService(service);
     }
 
     @Override
     public String getDomain() {
         return .getDomain();
     }
 
     public void setDomain(String domain) {
         .setDomain(domain);
     }
 
     @Override
     public boolean isRegisterDomain() {
         return .isRegisterDomain();
     }
 
     public void setRegisterDomain(boolean registerDomain) {
         .setRegisterDomain(registerDomain);
     }
 
     @Override
     public long getDomainRetentionPeriodInDays() {
         return .getDomainRetentionPeriodInDays();
     }
 
     public void setDomainRetentionPeriodInDays(long domainRetentionPeriodInDays) {
         .setDomainRetentionPeriodInDays(domainRetentionPeriodInDays);
     }
 
     @Override
     public String getTaskListToPoll() {
         return .getTaskListToPoll();
     }
 
     public void setTaskListToPoll(String taskListToPoll) {
         .setTaskListToPoll(taskListToPoll);
     }
 
    public DataConverter getDataConverter() {
        return .getDataConverter();
    }
    public void setDataConverter(DataConverter converter) {
        .setDataConverter(converter);
    }
    @Override
    public double getMaximumPollRatePerSecond() {
    }
    @Override
    public void setMaximumPollRatePerSecond(double maximumPollRatePerSecond) {
        .setMaximumPollRatePerSecond(maximumPollRatePerSecond);
    }
    @Override
    }
    @Override
    public void setMaximumPollRateIntervalMilliseconds(int maximumPollRateIntervalMilliseconds) {
        .setMaximumPollRateIntervalMilliseconds(maximumPollRateIntervalMilliseconds);
    }
    @Override
    }
    @Override
    public void setUncaughtExceptionHandler(UncaughtExceptionHandler uncaughtExceptionHandler) {
        .setUncaughtExceptionHandler(uncaughtExceptionHandler);
    }
    @Override
    public String getIdentity() {
        return .getIdentity();
    }
    @Override
   public void setIdentity(String identity) {
        .setIdentity(identity);
    }
    @Override
    public long getPollBackoffInitialInterval() {
    }
    @Override
    public void setPollBackoffInitialInterval(long backoffInitialInterval) {
        .setPollBackoffInitialInterval(backoffInitialInterval);
    }
    @Override
    public long getPollBackoffMaximumInterval() {
    }
    @Override
    public void setPollBackoffMaximumInterval(long backoffMaximumInterval) {
        .setPollBackoffMaximumInterval(backoffMaximumInterval);
    }
    @Override
    public boolean isDisableServiceShutdownOnStop() {
    }
    @Override
    public void setDisableServiceShutdownOnStop(boolean disableServiceShutdownOnStop) {
        .setDisableServiceShutdownOnStop(disableServiceShutdownOnStop);
    }
    @Override
    public void setDisableTypeRegistrationOnStart(boolean disableTypeRegistrationOnStart) {
        .setDisableTypeRegistrationOnStart(disableTypeRegistrationOnStart);
    }
    @Override
    public boolean isDisableTypeRegistrationOnStart() {
    }
    @Override
    public double getPollBackoffCoefficient() {
        return .getPollBackoffCoefficient();
    }
    @Override
    public void setPollBackoffCoefficient(double backoffCoefficient) {
        .setPollBackoffCoefficient(backoffCoefficient);
    }
    @Override
    public int getPollThreadCount() {
        return .getPollThreadCount();
    }
    @Override
    public void setPollThreadCount(int threadCount) {
        .setPollThreadCount(threadCount);
    }
    @Override
    public void suspendPolling() {
        .suspendPolling();
    }
    @Override
    public void resumePolling() {
        .resumePolling();
    }
    }
    @Override
    public void start() {
        .start();
    }
    @Override
    public void shutdown() {
        .shutdown();
    }
    @Override
    public void shutdownNow() {
        .shutdownNow();
    }
    @Override
    public boolean shutdownAndAwaitTermination(long timeoutTimeUnit unitthrows InterruptedException {
        return .shutdownAndAwaitTermination(timeoutunit);
    }
    public void stopNow() {
        .shutdownNow();
    }
    @Override
    public boolean awaitTermination(long timeoutTimeUnit unitthrows InterruptedException {
        return .awaitTermination(timeoutunit);
    }
    public void setWorkflowImplementations(Iterable<ObjectworkflowImplementations)
            throws InstantiationExceptionIllegalAccessException {
        for (Object workflowImplementation : workflowImplementations) {
            addWorkflowImplementation(workflowImplementation);
        }
    }
    }
    public void addWorkflowImplementation(Object workflowImplementationthrows InstantiationExceptionIllegalAccessException {
        .addWorkflowImplementation(workflowImplementation);
    }
    @Override
    public String toString() {
        return this.getClass().getSimpleName() + "[genericWorker=" +  + ", factoryFactory=" +  + "]";
    }
    @Override
    public void stop() {
        shutdown();
        try {
        }
        catch (InterruptedException e) {
        }
    }
    @Override
    public boolean isRunning() {
        return .isRunning();
    }

    

Returns:
default is 0
    @Override
    public int getPhase() {
        return ;
    }
    public void setPhase(int startPhase) {
        this. = startPhase;
    }
    @Override
    public boolean isAutoStartup() {
        return !;
    }
    public long getTerminationTimeoutSeconds() {
        return ;
    }
    public void setTerminationTimeoutSeconds(long terminationTimeoutSeconds) {
        this. = terminationTimeoutSeconds;
    }
    public boolean isDisableAutoStartup() {
        return ;
    }
    public void setDisableAutoStartup(boolean disableAutoStartup) {
        this. = disableAutoStartup;
    }
    @Override
    public void stop(Runnable callback) {
        stop();
        callback.run();
    }
    @Override
    public void registerTypesToPoll() {
    }
New to GrepCode? Check out our FAQ X