All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.uber.cadence.RetryPolicy Maven / Gradle / Ivy

There is a newer version: 3.12.5
Show newest version
/**
 * Autogenerated by Thrift Compiler (0.9.3)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package com.uber.cadence;

import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;

import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2019-06-18")
public class RetryPolicy implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RetryPolicy");

  private static final org.apache.thrift.protocol.TField INITIAL_INTERVAL_IN_SECONDS_FIELD_DESC = new org.apache.thrift.protocol.TField("initialIntervalInSeconds", org.apache.thrift.protocol.TType.I32, (short)10);
  private static final org.apache.thrift.protocol.TField BACKOFF_COEFFICIENT_FIELD_DESC = new org.apache.thrift.protocol.TField("backoffCoefficient", org.apache.thrift.protocol.TType.DOUBLE, (short)20);
  private static final org.apache.thrift.protocol.TField MAXIMUM_INTERVAL_IN_SECONDS_FIELD_DESC = new org.apache.thrift.protocol.TField("maximumIntervalInSeconds", org.apache.thrift.protocol.TType.I32, (short)30);
  private static final org.apache.thrift.protocol.TField MAXIMUM_ATTEMPTS_FIELD_DESC = new org.apache.thrift.protocol.TField("maximumAttempts", org.apache.thrift.protocol.TType.I32, (short)40);
  private static final org.apache.thrift.protocol.TField NON_RETRIABLE_ERROR_REASONS_FIELD_DESC = new org.apache.thrift.protocol.TField("nonRetriableErrorReasons", org.apache.thrift.protocol.TType.LIST, (short)50);
  private static final org.apache.thrift.protocol.TField EXPIRATION_INTERVAL_IN_SECONDS_FIELD_DESC = new org.apache.thrift.protocol.TField("expirationIntervalInSeconds", org.apache.thrift.protocol.TType.I32, (short)60);

  private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
  static {
    schemes.put(StandardScheme.class, new RetryPolicyStandardSchemeFactory());
    schemes.put(TupleScheme.class, new RetryPolicyTupleSchemeFactory());
  }

  public int initialIntervalInSeconds; // optional
  public double backoffCoefficient; // optional
  public int maximumIntervalInSeconds; // optional
  public int maximumAttempts; // optional
  public List nonRetriableErrorReasons; // optional
  public int expirationIntervalInSeconds; // optional

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    INITIAL_INTERVAL_IN_SECONDS((short)10, "initialIntervalInSeconds"),
    BACKOFF_COEFFICIENT((short)20, "backoffCoefficient"),
    MAXIMUM_INTERVAL_IN_SECONDS((short)30, "maximumIntervalInSeconds"),
    MAXIMUM_ATTEMPTS((short)40, "maximumAttempts"),
    NON_RETRIABLE_ERROR_REASONS((short)50, "nonRetriableErrorReasons"),
    EXPIRATION_INTERVAL_IN_SECONDS((short)60, "expirationIntervalInSeconds");

    private static final Map byName = new HashMap();

    static {
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 10: // INITIAL_INTERVAL_IN_SECONDS
          return INITIAL_INTERVAL_IN_SECONDS;
        case 20: // BACKOFF_COEFFICIENT
          return BACKOFF_COEFFICIENT;
        case 30: // MAXIMUM_INTERVAL_IN_SECONDS
          return MAXIMUM_INTERVAL_IN_SECONDS;
        case 40: // MAXIMUM_ATTEMPTS
          return MAXIMUM_ATTEMPTS;
        case 50: // NON_RETRIABLE_ERROR_REASONS
          return NON_RETRIABLE_ERROR_REASONS;
        case 60: // EXPIRATION_INTERVAL_IN_SECONDS
          return EXPIRATION_INTERVAL_IN_SECONDS;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    public static _Fields findByName(String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final String _fieldName;

    _Fields(short thriftId, String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __INITIALINTERVALINSECONDS_ISSET_ID = 0;
  private static final int __BACKOFFCOEFFICIENT_ISSET_ID = 1;
  private static final int __MAXIMUMINTERVALINSECONDS_ISSET_ID = 2;
  private static final int __MAXIMUMATTEMPTS_ISSET_ID = 3;
  private static final int __EXPIRATIONINTERVALINSECONDS_ISSET_ID = 4;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.INITIAL_INTERVAL_IN_SECONDS,_Fields.BACKOFF_COEFFICIENT,_Fields.MAXIMUM_INTERVAL_IN_SECONDS,_Fields.MAXIMUM_ATTEMPTS,_Fields.NON_RETRIABLE_ERROR_REASONS,_Fields.EXPIRATION_INTERVAL_IN_SECONDS};
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.INITIAL_INTERVAL_IN_SECONDS, new org.apache.thrift.meta_data.FieldMetaData("initialIntervalInSeconds", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.BACKOFF_COEFFICIENT, new org.apache.thrift.meta_data.FieldMetaData("backoffCoefficient", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.MAXIMUM_INTERVAL_IN_SECONDS, new org.apache.thrift.meta_data.FieldMetaData("maximumIntervalInSeconds", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.MAXIMUM_ATTEMPTS, new org.apache.thrift.meta_data.FieldMetaData("maximumAttempts", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.NON_RETRIABLE_ERROR_REASONS, new org.apache.thrift.meta_data.FieldMetaData("nonRetriableErrorReasons", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
    tmpMap.put(_Fields.EXPIRATION_INTERVAL_IN_SECONDS, new org.apache.thrift.meta_data.FieldMetaData("expirationIntervalInSeconds", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(RetryPolicy.class, metaDataMap);
  }

  public RetryPolicy() {
  }

  /**
   * Performs a deep copy on other.
   */
  public RetryPolicy(RetryPolicy other) {
    __isset_bitfield = other.__isset_bitfield;
    this.initialIntervalInSeconds = other.initialIntervalInSeconds;
    this.backoffCoefficient = other.backoffCoefficient;
    this.maximumIntervalInSeconds = other.maximumIntervalInSeconds;
    this.maximumAttempts = other.maximumAttempts;
    if (other.isSetNonRetriableErrorReasons()) {
      List __this__nonRetriableErrorReasons = new ArrayList(other.nonRetriableErrorReasons);
      this.nonRetriableErrorReasons = __this__nonRetriableErrorReasons;
    }
    this.expirationIntervalInSeconds = other.expirationIntervalInSeconds;
  }

  public RetryPolicy deepCopy() {
    return new RetryPolicy(this);
  }

  @Override
  public void clear() {
    setInitialIntervalInSecondsIsSet(false);
    this.initialIntervalInSeconds = 0;
    setBackoffCoefficientIsSet(false);
    this.backoffCoefficient = 0.0;
    setMaximumIntervalInSecondsIsSet(false);
    this.maximumIntervalInSeconds = 0;
    setMaximumAttemptsIsSet(false);
    this.maximumAttempts = 0;
    this.nonRetriableErrorReasons = null;
    setExpirationIntervalInSecondsIsSet(false);
    this.expirationIntervalInSeconds = 0;
  }

  public int getInitialIntervalInSeconds() {
    return this.initialIntervalInSeconds;
  }

  public RetryPolicy setInitialIntervalInSeconds(int initialIntervalInSeconds) {
    this.initialIntervalInSeconds = initialIntervalInSeconds;
    setInitialIntervalInSecondsIsSet(true);
    return this;
  }

  public void unsetInitialIntervalInSeconds() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __INITIALINTERVALINSECONDS_ISSET_ID);
  }

  /** Returns true if field initialIntervalInSeconds is set (has been assigned a value) and false otherwise */
  public boolean isSetInitialIntervalInSeconds() {
    return EncodingUtils.testBit(__isset_bitfield, __INITIALINTERVALINSECONDS_ISSET_ID);
  }

  public void setInitialIntervalInSecondsIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __INITIALINTERVALINSECONDS_ISSET_ID, value);
  }

  public double getBackoffCoefficient() {
    return this.backoffCoefficient;
  }

  public RetryPolicy setBackoffCoefficient(double backoffCoefficient) {
    this.backoffCoefficient = backoffCoefficient;
    setBackoffCoefficientIsSet(true);
    return this;
  }

  public void unsetBackoffCoefficient() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __BACKOFFCOEFFICIENT_ISSET_ID);
  }

  /** Returns true if field backoffCoefficient is set (has been assigned a value) and false otherwise */
  public boolean isSetBackoffCoefficient() {
    return EncodingUtils.testBit(__isset_bitfield, __BACKOFFCOEFFICIENT_ISSET_ID);
  }

  public void setBackoffCoefficientIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __BACKOFFCOEFFICIENT_ISSET_ID, value);
  }

  public int getMaximumIntervalInSeconds() {
    return this.maximumIntervalInSeconds;
  }

  public RetryPolicy setMaximumIntervalInSeconds(int maximumIntervalInSeconds) {
    this.maximumIntervalInSeconds = maximumIntervalInSeconds;
    setMaximumIntervalInSecondsIsSet(true);
    return this;
  }

  public void unsetMaximumIntervalInSeconds() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MAXIMUMINTERVALINSECONDS_ISSET_ID);
  }

  /** Returns true if field maximumIntervalInSeconds is set (has been assigned a value) and false otherwise */
  public boolean isSetMaximumIntervalInSeconds() {
    return EncodingUtils.testBit(__isset_bitfield, __MAXIMUMINTERVALINSECONDS_ISSET_ID);
  }

  public void setMaximumIntervalInSecondsIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MAXIMUMINTERVALINSECONDS_ISSET_ID, value);
  }

  public int getMaximumAttempts() {
    return this.maximumAttempts;
  }

  public RetryPolicy setMaximumAttempts(int maximumAttempts) {
    this.maximumAttempts = maximumAttempts;
    setMaximumAttemptsIsSet(true);
    return this;
  }

  public void unsetMaximumAttempts() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MAXIMUMATTEMPTS_ISSET_ID);
  }

  /** Returns true if field maximumAttempts is set (has been assigned a value) and false otherwise */
  public boolean isSetMaximumAttempts() {
    return EncodingUtils.testBit(__isset_bitfield, __MAXIMUMATTEMPTS_ISSET_ID);
  }

  public void setMaximumAttemptsIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MAXIMUMATTEMPTS_ISSET_ID, value);
  }

  public int getNonRetriableErrorReasonsSize() {
    return (this.nonRetriableErrorReasons == null) ? 0 : this.nonRetriableErrorReasons.size();
  }

  public java.util.Iterator getNonRetriableErrorReasonsIterator() {
    return (this.nonRetriableErrorReasons == null) ? null : this.nonRetriableErrorReasons.iterator();
  }

  public void addToNonRetriableErrorReasons(String elem) {
    if (this.nonRetriableErrorReasons == null) {
      this.nonRetriableErrorReasons = new ArrayList();
    }
    this.nonRetriableErrorReasons.add(elem);
  }

  public List getNonRetriableErrorReasons() {
    return this.nonRetriableErrorReasons;
  }

  public RetryPolicy setNonRetriableErrorReasons(List nonRetriableErrorReasons) {
    this.nonRetriableErrorReasons = nonRetriableErrorReasons;
    return this;
  }

  public void unsetNonRetriableErrorReasons() {
    this.nonRetriableErrorReasons = null;
  }

  /** Returns true if field nonRetriableErrorReasons is set (has been assigned a value) and false otherwise */
  public boolean isSetNonRetriableErrorReasons() {
    return this.nonRetriableErrorReasons != null;
  }

  public void setNonRetriableErrorReasonsIsSet(boolean value) {
    if (!value) {
      this.nonRetriableErrorReasons = null;
    }
  }

  public int getExpirationIntervalInSeconds() {
    return this.expirationIntervalInSeconds;
  }

  public RetryPolicy setExpirationIntervalInSeconds(int expirationIntervalInSeconds) {
    this.expirationIntervalInSeconds = expirationIntervalInSeconds;
    setExpirationIntervalInSecondsIsSet(true);
    return this;
  }

  public void unsetExpirationIntervalInSeconds() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __EXPIRATIONINTERVALINSECONDS_ISSET_ID);
  }

  /** Returns true if field expirationIntervalInSeconds is set (has been assigned a value) and false otherwise */
  public boolean isSetExpirationIntervalInSeconds() {
    return EncodingUtils.testBit(__isset_bitfield, __EXPIRATIONINTERVALINSECONDS_ISSET_ID);
  }

  public void setExpirationIntervalInSecondsIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __EXPIRATIONINTERVALINSECONDS_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case INITIAL_INTERVAL_IN_SECONDS:
      if (value == null) {
        unsetInitialIntervalInSeconds();
      } else {
        setInitialIntervalInSeconds((Integer)value);
      }
      break;

    case BACKOFF_COEFFICIENT:
      if (value == null) {
        unsetBackoffCoefficient();
      } else {
        setBackoffCoefficient((Double)value);
      }
      break;

    case MAXIMUM_INTERVAL_IN_SECONDS:
      if (value == null) {
        unsetMaximumIntervalInSeconds();
      } else {
        setMaximumIntervalInSeconds((Integer)value);
      }
      break;

    case MAXIMUM_ATTEMPTS:
      if (value == null) {
        unsetMaximumAttempts();
      } else {
        setMaximumAttempts((Integer)value);
      }
      break;

    case NON_RETRIABLE_ERROR_REASONS:
      if (value == null) {
        unsetNonRetriableErrorReasons();
      } else {
        setNonRetriableErrorReasons((List)value);
      }
      break;

    case EXPIRATION_INTERVAL_IN_SECONDS:
      if (value == null) {
        unsetExpirationIntervalInSeconds();
      } else {
        setExpirationIntervalInSeconds((Integer)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case INITIAL_INTERVAL_IN_SECONDS:
      return getInitialIntervalInSeconds();

    case BACKOFF_COEFFICIENT:
      return getBackoffCoefficient();

    case MAXIMUM_INTERVAL_IN_SECONDS:
      return getMaximumIntervalInSeconds();

    case MAXIMUM_ATTEMPTS:
      return getMaximumAttempts();

    case NON_RETRIABLE_ERROR_REASONS:
      return getNonRetriableErrorReasons();

    case EXPIRATION_INTERVAL_IN_SECONDS:
      return getExpirationIntervalInSeconds();

    }
    throw new IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case INITIAL_INTERVAL_IN_SECONDS:
      return isSetInitialIntervalInSeconds();
    case BACKOFF_COEFFICIENT:
      return isSetBackoffCoefficient();
    case MAXIMUM_INTERVAL_IN_SECONDS:
      return isSetMaximumIntervalInSeconds();
    case MAXIMUM_ATTEMPTS:
      return isSetMaximumAttempts();
    case NON_RETRIABLE_ERROR_REASONS:
      return isSetNonRetriableErrorReasons();
    case EXPIRATION_INTERVAL_IN_SECONDS:
      return isSetExpirationIntervalInSeconds();
    }
    throw new IllegalStateException();
  }

  @Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof RetryPolicy)
      return this.equals((RetryPolicy)that);
    return false;
  }

  public boolean equals(RetryPolicy that) {
    if (that == null)
      return false;

    boolean this_present_initialIntervalInSeconds = true && this.isSetInitialIntervalInSeconds();
    boolean that_present_initialIntervalInSeconds = true && that.isSetInitialIntervalInSeconds();
    if (this_present_initialIntervalInSeconds || that_present_initialIntervalInSeconds) {
      if (!(this_present_initialIntervalInSeconds && that_present_initialIntervalInSeconds))
        return false;
      if (this.initialIntervalInSeconds != that.initialIntervalInSeconds)
        return false;
    }

    boolean this_present_backoffCoefficient = true && this.isSetBackoffCoefficient();
    boolean that_present_backoffCoefficient = true && that.isSetBackoffCoefficient();
    if (this_present_backoffCoefficient || that_present_backoffCoefficient) {
      if (!(this_present_backoffCoefficient && that_present_backoffCoefficient))
        return false;
      if (this.backoffCoefficient != that.backoffCoefficient)
        return false;
    }

    boolean this_present_maximumIntervalInSeconds = true && this.isSetMaximumIntervalInSeconds();
    boolean that_present_maximumIntervalInSeconds = true && that.isSetMaximumIntervalInSeconds();
    if (this_present_maximumIntervalInSeconds || that_present_maximumIntervalInSeconds) {
      if (!(this_present_maximumIntervalInSeconds && that_present_maximumIntervalInSeconds))
        return false;
      if (this.maximumIntervalInSeconds != that.maximumIntervalInSeconds)
        return false;
    }

    boolean this_present_maximumAttempts = true && this.isSetMaximumAttempts();
    boolean that_present_maximumAttempts = true && that.isSetMaximumAttempts();
    if (this_present_maximumAttempts || that_present_maximumAttempts) {
      if (!(this_present_maximumAttempts && that_present_maximumAttempts))
        return false;
      if (this.maximumAttempts != that.maximumAttempts)
        return false;
    }

    boolean this_present_nonRetriableErrorReasons = true && this.isSetNonRetriableErrorReasons();
    boolean that_present_nonRetriableErrorReasons = true && that.isSetNonRetriableErrorReasons();
    if (this_present_nonRetriableErrorReasons || that_present_nonRetriableErrorReasons) {
      if (!(this_present_nonRetriableErrorReasons && that_present_nonRetriableErrorReasons))
        return false;
      if (!this.nonRetriableErrorReasons.equals(that.nonRetriableErrorReasons))
        return false;
    }

    boolean this_present_expirationIntervalInSeconds = true && this.isSetExpirationIntervalInSeconds();
    boolean that_present_expirationIntervalInSeconds = true && that.isSetExpirationIntervalInSeconds();
    if (this_present_expirationIntervalInSeconds || that_present_expirationIntervalInSeconds) {
      if (!(this_present_expirationIntervalInSeconds && that_present_expirationIntervalInSeconds))
        return false;
      if (this.expirationIntervalInSeconds != that.expirationIntervalInSeconds)
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    List list = new ArrayList();

    boolean present_initialIntervalInSeconds = true && (isSetInitialIntervalInSeconds());
    list.add(present_initialIntervalInSeconds);
    if (present_initialIntervalInSeconds)
      list.add(initialIntervalInSeconds);

    boolean present_backoffCoefficient = true && (isSetBackoffCoefficient());
    list.add(present_backoffCoefficient);
    if (present_backoffCoefficient)
      list.add(backoffCoefficient);

    boolean present_maximumIntervalInSeconds = true && (isSetMaximumIntervalInSeconds());
    list.add(present_maximumIntervalInSeconds);
    if (present_maximumIntervalInSeconds)
      list.add(maximumIntervalInSeconds);

    boolean present_maximumAttempts = true && (isSetMaximumAttempts());
    list.add(present_maximumAttempts);
    if (present_maximumAttempts)
      list.add(maximumAttempts);

    boolean present_nonRetriableErrorReasons = true && (isSetNonRetriableErrorReasons());
    list.add(present_nonRetriableErrorReasons);
    if (present_nonRetriableErrorReasons)
      list.add(nonRetriableErrorReasons);

    boolean present_expirationIntervalInSeconds = true && (isSetExpirationIntervalInSeconds());
    list.add(present_expirationIntervalInSeconds);
    if (present_expirationIntervalInSeconds)
      list.add(expirationIntervalInSeconds);

    return list.hashCode();
  }

  @Override
  public int compareTo(RetryPolicy other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetInitialIntervalInSeconds()).compareTo(other.isSetInitialIntervalInSeconds());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetInitialIntervalInSeconds()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.initialIntervalInSeconds, other.initialIntervalInSeconds);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetBackoffCoefficient()).compareTo(other.isSetBackoffCoefficient());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBackoffCoefficient()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.backoffCoefficient, other.backoffCoefficient);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetMaximumIntervalInSeconds()).compareTo(other.isSetMaximumIntervalInSeconds());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMaximumIntervalInSeconds()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.maximumIntervalInSeconds, other.maximumIntervalInSeconds);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetMaximumAttempts()).compareTo(other.isSetMaximumAttempts());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMaximumAttempts()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.maximumAttempts, other.maximumAttempts);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetNonRetriableErrorReasons()).compareTo(other.isSetNonRetriableErrorReasons());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNonRetriableErrorReasons()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nonRetriableErrorReasons, other.nonRetriableErrorReasons);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetExpirationIntervalInSeconds()).compareTo(other.isSetExpirationIntervalInSeconds());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetExpirationIntervalInSeconds()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.expirationIntervalInSeconds, other.expirationIntervalInSeconds);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder("RetryPolicy(");
    boolean first = true;

    if (isSetInitialIntervalInSeconds()) {
      sb.append("initialIntervalInSeconds:");
      sb.append(this.initialIntervalInSeconds);
      first = false;
    }
    if (isSetBackoffCoefficient()) {
      if (!first) sb.append(", ");
      sb.append("backoffCoefficient:");
      sb.append(this.backoffCoefficient);
      first = false;
    }
    if (isSetMaximumIntervalInSeconds()) {
      if (!first) sb.append(", ");
      sb.append("maximumIntervalInSeconds:");
      sb.append(this.maximumIntervalInSeconds);
      first = false;
    }
    if (isSetMaximumAttempts()) {
      if (!first) sb.append(", ");
      sb.append("maximumAttempts:");
      sb.append(this.maximumAttempts);
      first = false;
    }
    if (isSetNonRetriableErrorReasons()) {
      if (!first) sb.append(", ");
      sb.append("nonRetriableErrorReasons:");
      if (this.nonRetriableErrorReasons == null) {
        sb.append("null");
      } else {
        sb.append(this.nonRetriableErrorReasons);
      }
      first = false;
    }
    if (isSetExpirationIntervalInSeconds()) {
      if (!first) sb.append(", ");
      sb.append("expirationIntervalInSeconds:");
      sb.append(this.expirationIntervalInSeconds);
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // check for sub-struct validity
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
    try {
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
      __isset_bitfield = 0;
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class RetryPolicyStandardSchemeFactory implements SchemeFactory {
    public RetryPolicyStandardScheme getScheme() {
      return new RetryPolicyStandardScheme();
    }
  }

  private static class RetryPolicyStandardScheme extends StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, RetryPolicy struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
          break;
        }
        switch (schemeField.id) {
          case 10: // INITIAL_INTERVAL_IN_SECONDS
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.initialIntervalInSeconds = iprot.readI32();
              struct.setInitialIntervalInSecondsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 20: // BACKOFF_COEFFICIENT
            if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
              struct.backoffCoefficient = iprot.readDouble();
              struct.setBackoffCoefficientIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 30: // MAXIMUM_INTERVAL_IN_SECONDS
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.maximumIntervalInSeconds = iprot.readI32();
              struct.setMaximumIntervalInSecondsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 40: // MAXIMUM_ATTEMPTS
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.maximumAttempts = iprot.readI32();
              struct.setMaximumAttemptsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 50: // NON_RETRIABLE_ERROR_REASONS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list130 = iprot.readListBegin();
                struct.nonRetriableErrorReasons = new ArrayList(_list130.size);
                String _elem131;
                for (int _i132 = 0; _i132 < _list130.size; ++_i132)
                {
                  _elem131 = iprot.readString();
                  struct.nonRetriableErrorReasons.add(_elem131);
                }
                iprot.readListEnd();
              }
              struct.setNonRetriableErrorReasonsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 60: // EXPIRATION_INTERVAL_IN_SECONDS
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.expirationIntervalInSeconds = iprot.readI32();
              struct.setExpirationIntervalInSecondsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

      // check for required fields of primitive type, which can't be checked in the validate method
      struct.validate();
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot, RetryPolicy struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.isSetInitialIntervalInSeconds()) {
        oprot.writeFieldBegin(INITIAL_INTERVAL_IN_SECONDS_FIELD_DESC);
        oprot.writeI32(struct.initialIntervalInSeconds);
        oprot.writeFieldEnd();
      }
      if (struct.isSetBackoffCoefficient()) {
        oprot.writeFieldBegin(BACKOFF_COEFFICIENT_FIELD_DESC);
        oprot.writeDouble(struct.backoffCoefficient);
        oprot.writeFieldEnd();
      }
      if (struct.isSetMaximumIntervalInSeconds()) {
        oprot.writeFieldBegin(MAXIMUM_INTERVAL_IN_SECONDS_FIELD_DESC);
        oprot.writeI32(struct.maximumIntervalInSeconds);
        oprot.writeFieldEnd();
      }
      if (struct.isSetMaximumAttempts()) {
        oprot.writeFieldBegin(MAXIMUM_ATTEMPTS_FIELD_DESC);
        oprot.writeI32(struct.maximumAttempts);
        oprot.writeFieldEnd();
      }
      if (struct.nonRetriableErrorReasons != null) {
        if (struct.isSetNonRetriableErrorReasons()) {
          oprot.writeFieldBegin(NON_RETRIABLE_ERROR_REASONS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.nonRetriableErrorReasons.size()));
            for (String _iter133 : struct.nonRetriableErrorReasons)
            {
              oprot.writeString(_iter133);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetExpirationIntervalInSeconds()) {
        oprot.writeFieldBegin(EXPIRATION_INTERVAL_IN_SECONDS_FIELD_DESC);
        oprot.writeI32(struct.expirationIntervalInSeconds);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class RetryPolicyTupleSchemeFactory implements SchemeFactory {
    public RetryPolicyTupleScheme getScheme() {
      return new RetryPolicyTupleScheme();
    }
  }

  private static class RetryPolicyTupleScheme extends TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, RetryPolicy struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetInitialIntervalInSeconds()) {
        optionals.set(0);
      }
      if (struct.isSetBackoffCoefficient()) {
        optionals.set(1);
      }
      if (struct.isSetMaximumIntervalInSeconds()) {
        optionals.set(2);
      }
      if (struct.isSetMaximumAttempts()) {
        optionals.set(3);
      }
      if (struct.isSetNonRetriableErrorReasons()) {
        optionals.set(4);
      }
      if (struct.isSetExpirationIntervalInSeconds()) {
        optionals.set(5);
      }
      oprot.writeBitSet(optionals, 6);
      if (struct.isSetInitialIntervalInSeconds()) {
        oprot.writeI32(struct.initialIntervalInSeconds);
      }
      if (struct.isSetBackoffCoefficient()) {
        oprot.writeDouble(struct.backoffCoefficient);
      }
      if (struct.isSetMaximumIntervalInSeconds()) {
        oprot.writeI32(struct.maximumIntervalInSeconds);
      }
      if (struct.isSetMaximumAttempts()) {
        oprot.writeI32(struct.maximumAttempts);
      }
      if (struct.isSetNonRetriableErrorReasons()) {
        {
          oprot.writeI32(struct.nonRetriableErrorReasons.size());
          for (String _iter134 : struct.nonRetriableErrorReasons)
          {
            oprot.writeString(_iter134);
          }
        }
      }
      if (struct.isSetExpirationIntervalInSeconds()) {
        oprot.writeI32(struct.expirationIntervalInSeconds);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, RetryPolicy struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(6);
      if (incoming.get(0)) {
        struct.initialIntervalInSeconds = iprot.readI32();
        struct.setInitialIntervalInSecondsIsSet(true);
      }
      if (incoming.get(1)) {
        struct.backoffCoefficient = iprot.readDouble();
        struct.setBackoffCoefficientIsSet(true);
      }
      if (incoming.get(2)) {
        struct.maximumIntervalInSeconds = iprot.readI32();
        struct.setMaximumIntervalInSecondsIsSet(true);
      }
      if (incoming.get(3)) {
        struct.maximumAttempts = iprot.readI32();
        struct.setMaximumAttemptsIsSet(true);
      }
      if (incoming.get(4)) {
        {
          org.apache.thrift.protocol.TList _list135 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
          struct.nonRetriableErrorReasons = new ArrayList(_list135.size);
          String _elem136;
          for (int _i137 = 0; _i137 < _list135.size; ++_i137)
          {
            _elem136 = iprot.readString();
            struct.nonRetriableErrorReasons.add(_elem136);
          }
        }
        struct.setNonRetriableErrorReasonsIsSet(true);
      }
      if (incoming.get(5)) {
        struct.expirationIntervalInSeconds = iprot.readI32();
        struct.setExpirationIntervalInSecondsIsSet(true);
      }
    }
  }

}