Class TriggerExecutor

java.lang.Object
org.apache.cassandra.triggers.TriggerExecutor

public class TriggerExecutor extends Object
  • Field Details

  • Method Details

    • reloadClasses

      public void reloadClasses()
      Reload the triggers which is already loaded, Invoking this will update the class loader so new jars can be loaded.
    • execute

      public PartitionUpdate execute(PartitionUpdate updates) throws InvalidRequestException
      Augment a partition update by executing triggers to generate an intermediate set of mutations, then merging the update from each mutation with those supplied. This is called from @{link org.apache.cassandra.service.StorageProxy#cas} which is scoped for a single partition. For that reason, any mutations generated by triggers are checked to ensure that they are for the same table and partition key as the primary update; if not, InvalidRequestException is thrown. If no additional mutations are generated, the original updates are returned unmodified.
      Parameters:
      updates - partition update to be applied, contains the merge of the original update and any generated mutations
      Returns:
      the final update to be applied, the original update merged with any additional mutations generated by configured triggers
      Throws:
      InvalidRequestException - if any mutation generated by a trigger does not apply to the exact same partition as the initial update
    • execute

      public Collection<Mutation> execute(Collection<? extends IMutation> mutations) throws InvalidRequestException
      Takes a collection of mutations and possibly augments it by adding extra mutations generated by configured triggers. If no additional mutations are created this returns null, signalling to the caller that only the initial set of mutations should be applied. If additional mutations are generated, the total set (i.e. the original plus the additional mutations) are applied together in a logged batch. Should this not be possible because the initial mutations contain counter updates, InvalidRequestException is thrown.
      Parameters:
      mutations - initial collection of mutations
      Returns:
      augmented mutations. Either the union of the initial and additional mutations or null if no additional mutations were generated
      Throws:
      InvalidRequestException - if additional mutations were generated, but the initial mutations contains counter updates
    • loadTriggerInstance

      public ITrigger loadTriggerInstance(String triggerClass) throws Exception
      Throws:
      Exception