Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.google.appengine.api.datastore.dev
Class DefaultHighRepJobPolicy

    java.lang.Object
      com.google.appengine.api.datastore.dev.DefaultHighRepJobPolicy

All Implemented Interfaces:
  HighRepJobPolicy

    public class DefaultHighRepJobPolicy

extends java.lang.Object
implements HighRepJobPolicy

An implementation of `HighRepJobPolicy` in which a user-defined percentage of jobs do not apply. The percentage applies to both new (initial write) and existing (roll forward) jobs. The user can also provide a random seed, which can be used to make the behavior of this class deterministic in tests.

Field Summary
`static java.lang.String` | `RANDOM_SEED_PROPERTY` A long that will be used as the seed for the `Random` that determines whether or not a job application attempt fails.
`static java.lang.String` | `UNAPPLIED_JOB_PERCENTAGE_PROPERTY` A float >= 0 and <= 100 representing the percentage of job application attempts that will fail.

Constructor Summary
`DefaultHighRepJobPolicy(long unappliedJobSeed, float unappliedJobPercentage)` Constructs a `DefaultHighRepJobPolicy`.

Method Summary
`boolean` | `shouldApplyNewJob(com.google.appengine.api.datastore.Key entityGroup)`
`boolean` | `shouldRollForwardExistingJob(com.google.appengine.api.datastore.Key entityGroup)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### RANDOM_SEED_PROPERTY

    public static final java.lang.String RANDOM_SEED_PROPERTY

  A long that will be used as the seed for the `Random` that determines whether or not a job application attempt fails. Must be parsable via `Long.parseLong(String)`. If not provided we use the current time (in millis) as the seed.

  See Also:
    Constant Field Values

### UNAPPLIED_JOB_PERCENTAGE_PROPERTY

    public static final java.lang.String UNAPPLIED_JOB_PERCENTAGE_PROPERTY

  A float >= 0 and <= 100 representing the percentage of job application attempts that will fail. Must be parsable via `Float.parseFloat(String)`. Any portion of the value beyond two decimal places will be truncated. If not provided we set the percentage to 0, which yields the master/slave consistency model.

  See Also:
    Constant Field Values

Constructor Detail

### DefaultHighRepJobPolicy

    public DefaultHighRepJobPolicy(long unappliedJobSeed,
                                   float unappliedJobPercentage)

  Constructs a `DefaultHighRepJobPolicy`.

  Parameters:
    `unappliedJobSeed` - The seed to use for random number generation.
    `unappliedJobPercentage` - The percentage of jobs that should fail to apply. This percentage applies to both new jobs and attempts to roll forward existing unapplied jobs.

Method Detail

### shouldApplyNewJob

    public boolean shouldApplyNewJob(com.google.appengine.api.datastore.Key entityGroup)

  Specified by:
    `shouldApplyNewJob` in interface `HighRepJobPolicy`
  Parameters:
    `entityGroup` - A unique identifier for the entity group.
  Returns:
    `true` if the new job should apply according to the policy, `false` otherwise.

### shouldRollForwardExistingJob

    public boolean shouldRollForwardExistingJob(com.google.appengine.api.datastore.Key entityGroup)

  Specified by:
    `shouldRollForwardExistingJob` in interface `HighRepJobPolicy`
  Parameters:
    `entityGroup` - A unique identifier for the entity group.
  Returns:
    `true` if the existing job should roll forward according to the policy, `false` otherwise.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD