クラス DeployerPartitionHandler

java.lang.ObjectSE
org.springframework.cloud.task.batch.partition.DeployerPartitionHandler
実装されたすべてのインターフェース:
org.springframework.batch.core.partition.PartitionHandlerorg.springframework.beans.factory.Awareorg.springframework.beans.factory.InitializingBeanorg.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
  • フィールドの詳細

    • SPRING_CLOUD_TASK_JOB_EXECUTION_ID

      public static final StringSE SPRING_CLOUD_TASK_JOB_EXECUTION_ID
      Spring Cloud Task ジョブ実行の ID。
      関連事項:
    • SPRING_CLOUD_TASK_STEP_EXECUTION_ID

      public static final StringSE SPRING_CLOUD_TASK_STEP_EXECUTION_ID
      Spring Cloud Task ステップ実行の ID。
      関連事項:
    • SPRING_CLOUD_TASK_STEP_NAME

      public static final StringSE SPRING_CLOUD_TASK_STEP_NAME
      Spring Cloud Task ステップの名前。
      関連事項:
    • SPRING_CLOUD_TASK_PARENT_EXECUTION_ID

      public static final StringSE SPRING_CLOUD_TASK_PARENT_EXECUTION_ID
      Spring Cloud Task 親実行の ID。
      関連事項:
    • SPRING_CLOUD_TASK_EXECUTION_ID

      public static final StringSE SPRING_CLOUD_TASK_EXECUTION_ID
      Spring Cloud Task 実行の ID。
      関連事項:
    • SPRING_CLOUD_TASK_NAME

      public static final StringSE 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

      public void setCommandLineArgsProvider(CommandLineArgsProvider commandLineArgsProvider)
      起動された各 ワーカーに渡されるコマンドライン引数を提供するために使用されます。
      パラメーター:
      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

      public void setDeploymentProperties(MapSE<StringSE,StringSE> deploymentProperties)
      TaskLauncher で使用される デプロイプロパティのマップ。
      パラメーター:
      deploymentProperties - TaskLauncher で使用されるプロパティ
    • setApplicationName

      public void setApplicationName(StringSE applicationName)
      起動するアプリケーションの名前。アプリケーションデプロイが再利用される環境 (CloudFoundry など) で役立ちます。
      パラメーター:
      applicationName - 起動するアプリケーションの名前
    • beforeTask

      @BeforeTask public void beforeTask(TaskExecution taskExecution)
    • 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.PartitionHandlerhandle 
      例外:
      ExceptionSE
    • setEnvironment

      public void setEnvironment(org.springframework.core.env.Environment environment)
      次で指定:
      インターフェース org.springframework.context.EnvironmentAwaresetEnvironment 
    • afterPropertiesSet

      public void afterPropertiesSet() throws ExceptionSE
      次で指定:
      インターフェース org.springframework.beans.factory.InitializingBeanafterPropertiesSet 
      例外:
      ExceptionSE