public abstract class GenericWorker extends java.lang.Object implements WorkerBase
| 修飾子とタイプ | フィールドと説明 |
|---|---|
protected java.lang.String |
domain |
protected long |
domainRetentionPeriodInDays |
protected static int |
MAX_IDENTITY_LENGTH |
protected boolean |
registerDomain |
protected AmazonSimpleWorkflow |
service |
protected java.util.concurrent.atomic.AtomicReference<java.util.concurrent.CountDownLatch> |
suspendLatch |
protected java.lang.Thread.UncaughtExceptionHandler |
uncaughtExceptionHandler |
| コンストラクタと説明 |
|---|
GenericWorker() |
GenericWorker(AmazonSimpleWorkflow service,
java.lang.String domain,
java.lang.String taskListToPoll) |
| 修飾子とタイプ | メソッドと説明 |
|---|---|
boolean |
awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit) |
protected void |
checkRequiredProperty(java.lang.Object value,
java.lang.String name) |
protected abstract void |
checkRequredProperties() |
protected void |
checkStarted() |
protected abstract TaskPoller |
createPoller() |
java.lang.String |
getDomain() |
long |
getDomainRetentionPeriodInDays() |
java.lang.String |
getIdentity() |
int |
getMaximumPollRateIntervalMilliseconds() |
double |
getMaximumPollRatePerSecond() |
double |
getPollBackoffCoefficient() |
long |
getPollBackoffInitialInterval() |
long |
getPollBackoffMaximumInterval() |
int |
getPollThreadCount() |
protected abstract java.lang.String |
getPollThreadNamePrefix() |
AmazonSimpleWorkflow |
getService() |
java.lang.String |
getTaskListToPoll()
Task list name that given worker polls for tasks.
|
java.lang.Thread.UncaughtExceptionHandler |
getUncaughtExceptionHandler() |
boolean |
isDisableServiceShutdownOnStop() |
boolean |
isDisableTypeRegistrationOnStart() |
boolean |
isRegisterDomain() |
boolean |
isRunning() |
void |
resumePolling()
Allow new poll requests.
|
void |
setDisableServiceShutdownOnStop(boolean disableServiceShutdownOnStop)
By default when @{link
shutdown() or @{link
shutdownNow() is called the worker calls
AmazonSimpleWorkflow.shutdown() on the service instance it is
configured with before shutting down internal thread pools. |
void |
setDisableTypeRegistrationOnStart(boolean disableTypeRegistrationOnStart)
When set to true disables types registration on start even if
SkipTypeRegistration is not specified. |
void |
setDomain(java.lang.String domain) |
void |
setDomainRetentionPeriodInDays(long domainRetentionPeriodInDays)
Value of DomainRetentionPeriodInDays parameter passed to
AmazonSimpleWorkflow.registerDomain(com.amazonaws.services.simpleworkflow.model.RegisterDomainRequest) call. |
void |
setIdentity(java.lang.String identity)
Set the identity that worker specifies in the poll requests.
|
void |
setMaximumPollRateIntervalMilliseconds(int maximumPollRateIntervalMilliseconds)
The sliding window interval used to measure the poll rate.
|
void |
setMaximumPollRatePerSecond(double maximumPollRatePerSecond)
Maximum number of poll request to the task list per second allowed.
|
void |
setPollBackoffCoefficient(double backoffCoefficient) |
void |
setPollBackoffInitialInterval(long backoffInitialInterval)
Failed poll requests are retried after an interval defined by an
exponential backoff algorithm.
|
void |
setPollBackoffMaximumInterval(long backoffMaximumInterval) |
void |
setPollThreadCount(int threadCount)
Defines how many concurrent threads are used by the given worker to poll
the specified task list.
|
void |
setRegisterDomain(boolean registerDomain)
Should domain be registered on startup.
|
void |
setService(AmazonSimpleWorkflow service) |
void |
setTaskListToPoll(java.lang.String taskListToPoll) |
void |
setUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler uncaughtExceptionHandler)
Handler notified about poll request and other unexpected failures.
|
void |
shutdown() |
boolean |
shutdownAndAwaitTermination(long timeout,
java.util.concurrent.TimeUnit unit) |
void |
shutdownNow() |
void |
start() |
void |
suspendPolling()
Do not make new poll requests.
|
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitregisterTypesToPollprotected static final int MAX_IDENTITY_LENGTH
protected AmazonSimpleWorkflow service
protected java.lang.String domain
protected boolean registerDomain
protected long domainRetentionPeriodInDays
protected final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.CountDownLatch> suspendLatch
protected java.lang.Thread.UncaughtExceptionHandler uncaughtExceptionHandler
public GenericWorker(AmazonSimpleWorkflow service, java.lang.String domain, java.lang.String taskListToPoll)
public GenericWorker()
public AmazonSimpleWorkflow getService()
getService インタフェース内 WorkerBasepublic void setService(AmazonSimpleWorkflow service)
public java.lang.String getDomain()
getDomain インタフェース内 WorkerBasepublic void setDomain(java.lang.String domain)
public boolean isRegisterDomain()
isRegisterDomain インタフェース内 WorkerBasepublic void setRegisterDomain(boolean registerDomain)
false.
When enabled #setDomainRetentionPeriodInDays(Long) property is
required.setRegisterDomain インタフェース内 WorkerBasepublic long getDomainRetentionPeriodInDays()
getDomainRetentionPeriodInDays インタフェース内 WorkerBasepublic void setDomainRetentionPeriodInDays(long domainRetentionPeriodInDays)
WorkerBaseAmazonSimpleWorkflow.registerDomain(com.amazonaws.services.simpleworkflow.model.RegisterDomainRequest) call. Required when
WorkerBase.isRegisterDomain() is true.setDomainRetentionPeriodInDays インタフェース内 WorkerBasepublic java.lang.String getTaskListToPoll()
WorkerBasegetTaskListToPoll インタフェース内 WorkerBasepublic void setTaskListToPoll(java.lang.String taskListToPoll)
public double getMaximumPollRatePerSecond()
getMaximumPollRatePerSecond インタフェース内 WorkerBasepublic void setMaximumPollRatePerSecond(double maximumPollRatePerSecond)
WorkerBasepublic int getMaximumPollRateIntervalMilliseconds()
getMaximumPollRateIntervalMilliseconds インタフェース内 WorkerBasepublic void setMaximumPollRateIntervalMilliseconds(int maximumPollRateIntervalMilliseconds)
WorkerBasepublic java.lang.Thread.UncaughtExceptionHandler getUncaughtExceptionHandler()
getUncaughtExceptionHandler インタフェース内 WorkerBasepublic void setUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler uncaughtExceptionHandler)
WorkerBasesetUncaughtExceptionHandler インタフェース内 WorkerBasepublic java.lang.String getIdentity()
getIdentity インタフェース内 WorkerBasepublic void setIdentity(java.lang.String identity)
WorkerBasesetIdentity インタフェース内 WorkerBaseidentity - maximum size is 256 characters.public long getPollBackoffInitialInterval()
getPollBackoffInitialInterval インタフェース内 WorkerBasepublic void setPollBackoffInitialInterval(long backoffInitialInterval)
WorkerBasesetPollBackoffInitialInterval インタフェース内 WorkerBasebackoffInitialInterval - the interval between failure and the first retry. Default is
100.public long getPollBackoffMaximumInterval()
getPollBackoffMaximumInterval インタフェース内 WorkerBasepublic void setPollBackoffMaximumInterval(long backoffMaximumInterval)
setPollBackoffMaximumInterval インタフェース内 WorkerBasebackoffMaximumInterval - maximum interval between poll request retries. Default is
60000 (one minute).WorkerBase.setPollBackoffInitialInterval(long)public boolean isDisableServiceShutdownOnStop()
isDisableServiceShutdownOnStop インタフェース内 WorkerBasesetDisableServiceShutdownOnStop(boolean)public void setDisableServiceShutdownOnStop(boolean disableServiceShutdownOnStop)
shutdown() or @{link
shutdownNow() is called the worker calls
AmazonSimpleWorkflow.shutdown() on the service instance it is
configured with before shutting down internal thread pools. Otherwise
threads that are waiting on a poll request might block shutdown for the
duration of a poll. This flag allows disabling this behavior.setDisableServiceShutdownOnStop インタフェース内 WorkerBasedisableServiceShutdownOnStop - true means do not call
AmazonSimpleWorkflow.shutdown()public double getPollBackoffCoefficient()
getPollBackoffCoefficient インタフェース内 WorkerBasepublic void setPollBackoffCoefficient(double backoffCoefficient)
setPollBackoffCoefficient インタフェース内 WorkerBasebackoffCoefficient - coefficient that defines how fast retry interval grows in case
of poll request failures. Default is 2.0.WorkerBase.setPollBackoffInitialInterval(long)public int getPollThreadCount()
getPollThreadCount インタフェース内 WorkerBasepublic void setPollThreadCount(int threadCount)
WorkerBaseActivityWorker two separate threads pools are used. One for
polling and another one for executing activities. The size of the
activity execution thread pool is defined through
ActivityWorker.setTaskExecutorThreadPoolSize(int).setPollThreadCount インタフェース内 WorkerBasepublic void setDisableTypeRegistrationOnStart(boolean disableTypeRegistrationOnStart)
WorkerBaseSkipTypeRegistration is not specified. Types still can be
registered by calling WorkerBase.registerTypesToPoll().setDisableTypeRegistrationOnStart インタフェース内 WorkerBasepublic boolean isDisableTypeRegistrationOnStart()
isDisableTypeRegistrationOnStart インタフェース内 WorkerBasepublic void start()
start インタフェース内 WorkerLifecycleprotected abstract java.lang.String getPollThreadNamePrefix()
protected abstract TaskPoller createPoller()
protected abstract void checkRequredProperties()
protected void checkRequiredProperty(java.lang.Object value,
java.lang.String name)
protected void checkStarted()
public void shutdown()
shutdown インタフェース内 WorkerLifecyclepublic void shutdownNow()
shutdownNow インタフェース内 WorkerLifecyclepublic boolean awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
awaitTermination インタフェース内 WorkerLifecyclejava.lang.InterruptedExceptionpublic boolean shutdownAndAwaitTermination(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
shutdownAndAwaitTermination インタフェース内 WorkerLifecyclejava.lang.InterruptedExceptionpublic java.lang.String toString()
toString クラス内 java.lang.Objectpublic boolean isRunning()
isRunning インタフェース内 WorkerBasepublic void suspendPolling()
SuspendablesuspendPolling インタフェース内 Suspendablepublic void resumePolling()
SuspendableresumePolling インタフェース内 Suspendable