RoundRobinDistributionPolicy (Hadoop 1.2.1 API)
Date: 2013-07-22

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

## org.apache.hadoop.contrib.index.example
Class RoundRobinDistributionPolicy

    java.lang.Object
      org.apache.hadoop.contrib.index.example.RoundRobinDistributionPolicy

All Implemented Interfaces:
  IDistributionPolicy

    public class RoundRobinDistributionPolicy

extends Object
implements IDistributionPolicy

Choose a shard for each insert in a round-robin fashion. Choose all the shards for each delete because we don't know where it is stored.

Constructor Summary
`RoundRobinDistributionPolicy()`

Method Summary
`int` | `chooseShardForDelete(DocumentID key)` Choose a shard or all shards to send a delete request.
`int` | `chooseShardForInsert(DocumentID key)` Choose a shard to send an insert request.
`void` | `init(Shard[] shards)` Initialization.

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

Constructor Detail

### RoundRobinDistributionPolicy

    public RoundRobinDistributionPolicy()

Method Detail

### init

    public void init(Shard[] shards)

  Description copied from interface: `IDistributionPolicy`
  Initialization. It must be called before any chooseShard() is called.

  Specified by:
    `init` in interface `IDistributionPolicy`

### chooseShardForInsert

    public int chooseShardForInsert(DocumentID key)

  Description copied from interface: `IDistributionPolicy`
  Choose a shard to send an insert request.

  Specified by:
    `chooseShardForInsert` in interface `IDistributionPolicy`
  Returns:
    the index of the chosen shard

### chooseShardForDelete

    public int chooseShardForDelete(DocumentID key)

  Description copied from interface: `IDistributionPolicy`
  Choose a shard or all shards to send a delete request. E.g. a round-robin distribution policy would send a delete request to all the shards. -1 represents all the shards.

  Specified by:
    `chooseShardForDelete` in interface `IDistributionPolicy`
  Returns:
    the index of the chosen shard, -1 if all the shards are chosen

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

Copyright © 2009 The Apache Software Foundation