クラス DeployerPartitionHandler
java.lang.ObjectSE
org.springframework.cloud.task.batch.partition.DeployerPartitionHandler
- 実装済みのインターフェース一覧:
org.springframework.batch.core.partition.PartitionHandler、org.springframework.beans.factory.Aware、org.springframework.beans.factory.InitializingBean、org.springframework.context.EnvironmentAware
public class DeployerPartitionHandler
extends ObjectSE
implements org.springframework.batch.core.partition.PartitionHandler, org.springframework.context.EnvironmentAware, org.springframework.beans.factory.InitializingBean
各 ワーカーの TaskLauncher に委譲する PartitionHandler 実装。ワーカーの StepExecution の ID は、環境変数として ワーカーに渡されます。DeployerStepExecutionHandler によってブートストラップされた ワーカーは、JobRepository 内の StepExecution を検索して実行します。この PartitionHandler は、結果を取得するために JobRepository をポーリングします。
ジョブが失敗した場合、パーティションは通常のバッチルールに従って再実行されます (完了したステップは何も実行されず、失敗したステップは構成に基づいて再開されます)。
この PartitionHandler とすべての ワーカープロセスは、同じ JobRepository データストアを共有する必要があります (つまり、同じデータベースを指す必要があります)。
- 作成者:
- Michael Minella, Glenn Renfro
フィールド概要
フィールド修飾子と型フィールド説明static final StringSESpring Cloud Task 実行の ID。static final StringSESpring Cloud Task ジョブ実行の ID。static final StringSESpring Cloud Task の名前プロパティ。static final StringSESpring Cloud Task 親実行の ID。static final StringSESpring Cloud Task ステップ実行の ID。static final StringSESpring Cloud Task ステップの名前。コンストラクター概要
コンストラクターコンストラクター説明DeployerPartitionHandler(org.springframework.cloud.deployer.spi.task.TaskLauncher taskLauncher, org.springframework.batch.core.explore.JobExplorer jobExplorer, org.springframework.core.io.Resource resource, StringSE stepName, TaskRepository taskRepository) DeployerPartitionHandler インスタンスを初期化するコンストラクター。DeployerPartitionHandler(org.springframework.cloud.deployer.spi.task.TaskLauncher taskLauncher, org.springframework.batch.core.explore.JobExplorer jobExplorer, org.springframework.core.io.Resource resource, StringSE stepName, TaskRepository taskRepository, org.springframework.core.task.TaskExecutor taskExecutor) DeployerPartitionHandler インスタンスを初期化するコンストラクター。方法の概要
修飾子と型メソッド説明voidvoidbeforeTask(TaskExecution taskExecution) CollectionSE<org.springframework.batch.core.StepExecution>handle(org.springframework.batch.core.partition.StepExecutionSplitter stepSplitter, org.springframework.batch.core.StepExecution stepExecution) voidsetApplicationName(StringSE applicationName) 起動するアプリケーションの名前。voidsetCommandLineArgsProvider(CommandLineArgsProvider commandLineArgsProvider) 起動された各 ワーカーに渡されるコマンドライン引数を提供するために使用されます。voidsetDefaultArgsAsEnvironmentVars(boolean defaultArgsAsEnvironmentVars) true に設定すると、Spring Cloud Task および Spring Batch によって内部的に使用されるデフォルトの引数が、コマンドライン引数ではなく環境変数として渡されます。voidsetDeploymentProperties(MapSE<StringSE, StringSE> deploymentProperties) TaskLauncherで使用される デプロイプロパティのマップ。voidsetEnvironment(org.springframework.core.env.Environment environment) voidsetEnvironmentVariablesProvider(EnvironmentVariablesProvider environmentVariablesProvider) 起動される各 ワーカーに設定する環境変数を提供するために使用されます。voidsetGridSize(int gridSize) 利用可能な ワーカー JVM プールのおおよそのサイズ。voidsetMaxWorkers(int maxWorkers) 一度に実行される ワーカーの最大数。voidsetPollInterval(long pollInterval) 完了したステップについてジョブリポジトリを確認する間隔。voidsetTimeout(long timeout) マスターステップのタイムアウト。
フィールドの詳細
SPRING_CLOUD_TASK_JOB_EXECUTION_ID
Spring Cloud Task ジョブ実行の ID。- 関連事項:
SPRING_CLOUD_TASK_STEP_EXECUTION_ID
Spring Cloud Task ステップ実行の ID。- 関連事項:
SPRING_CLOUD_TASK_STEP_NAME
Spring Cloud Task ステップの名前。- 関連事項:
SPRING_CLOUD_TASK_PARENT_EXECUTION_ID
Spring Cloud Task 親実行の ID。- 関連事項:
SPRING_CLOUD_TASK_EXECUTION_ID
Spring Cloud Task 実行の ID。- 関連事項:
SPRING_CLOUD_TASK_NAME
Spring Cloud Task の名前プロパティ。- 関連事項:
コンストラクターの詳細
DeployerPartitionHandler
public DeployerPartitionHandler(org.springframework.cloud.deployer.spi.task.TaskLauncher taskLauncher, org.springframework.batch.core.explore.JobExplorer jobExplorer, org.springframework.core.io.Resource resource, StringSE stepName, TaskRepository taskRepository, org.springframework.core.task.TaskExecutor taskExecutor) DeployerPartitionHandler インスタンスを初期化するコンストラクター。- パラメーター:
taskLauncher- パーティション化されたタスクを実行するために使用されるTaskLauncher。jobExplorer- ジョブのステータスを取得するJobExplorer。resource- 起動するアプリへのResource。stepName- ステップの名前。taskExecutor- タスクの起動が非同期で行われる場合、ThreadPoolTaskExecutorを指定します。デフォルトは null です。
DeployerPartitionHandler
public DeployerPartitionHandler(org.springframework.cloud.deployer.spi.task.TaskLauncher taskLauncher, org.springframework.batch.core.explore.JobExplorer jobExplorer, org.springframework.core.io.Resource resource, StringSE stepName, TaskRepository taskRepository) DeployerPartitionHandler インスタンスを初期化するコンストラクター。- パラメーター:
taskLauncher- パーティション化されたタスクを実行するために使用されるTaskLauncher。jobExplorer- ジョブのステータスを取得するJobExplorer。resource- 起動するアプリへのResource。stepName- ステップの名前。
方法の詳細
setEnvironmentVariablesProvider
public void setEnvironmentVariablesProvider(EnvironmentVariablesProvider environmentVariablesProvider) 起動される各 ワーカーに設定する環境変数を提供するために使用されます。- パラメーター:
environmentVariablesProvider-EnvironmentVariablesProvider
setDefaultArgsAsEnvironmentVars
public void setDefaultArgsAsEnvironmentVars(boolean defaultArgsAsEnvironmentVars) true に設定すると、Spring Cloud Task および Spring Batch によって内部的に使用されるデフォルトの引数が、コマンドライン引数ではなく環境変数として渡されます。- パラメーター:
defaultArgsAsEnvironmentVars- デフォルトは false
setCommandLineArgsProvider
起動された各 ワーカーに渡されるコマンドライン引数を提供するために使用されます。- パラメーター:
commandLineArgsProvider-CommandLineArgsProvider
setMaxWorkers
public void setMaxWorkers(int maxWorkers) 一度に実行される ワーカーの最大数。- パラメーター:
maxWorkers- ワーカーの数。デフォルトは -1 (無制限)
setGridSize
public void setGridSize(int gridSize) 使用可能な ワーカー JVM プールのおおよそのサイズ。StepExecutionSplitterがこれを使用して、作成するパーティションの数を決定します (Partitionerの判断によります)。- パラメーター:
gridSize- グリッドのサイズ。デフォルトは 1
setPollInterval
public void setPollInterval(long pollInterval) 完了したステップについてジョブリポジトリを確認する間隔。- パラメーター:
pollInterval- 間隔。デフォルトは 10 秒
setTimeout
public void setTimeout(long timeout) マスターステップのタイムアウト。これは、すべての ワーカーが完了するまでのタイムアウトです。- パラメーター:
timeout- タイムアウト。デフォルトはなし (-1) です。
setDeploymentProperties
TaskLauncherで使用される デプロイプロパティのマップ。- パラメーター:
deploymentProperties-TaskLauncherで使用されるプロパティ
setApplicationName
起動するアプリケーションの名前。アプリケーションデプロイが再利用される環境 (CloudFoundry など) で役立ちます。- パラメーター:
applicationName- 起動するアプリケーションの名前
beforeTask
handle
public CollectionSE<org.springframework.batch.core.StepExecution> handle(org.springframework.batch.core.partition.StepExecutionSplitter stepSplitter, org.springframework.batch.core.StepExecution stepExecution) throws ExceptionSE - 次で指定:
- インターフェース
org.springframework.batch.core.partition.PartitionHandler内のhandle - 例外:
ExceptionSE
setEnvironment
public void setEnvironment(org.springframework.core.env.Environment environment) - 次で指定:
- インターフェース
org.springframework.context.EnvironmentAware内のsetEnvironment
afterPropertiesSet
- 次で指定:
- インターフェース
org.springframework.beans.factory.InitializingBean内のafterPropertiesSet - 例外:
ExceptionSE