public class DefaultEnsemblePlacementPolicy extends Object implements EnsemblePlacementPolicy
Constructor and Description |
---|
DefaultEnsemblePlacementPolicy() |
Modifier and Type | Method and Description |
---|---|
EnsemblePlacementPolicy |
initialize(org.apache.commons.configuration.Configuration conf)
Initialize the policy.
|
ArrayList<org.apache.bookkeeper.net.BookieSocketAddress> |
newEnsemble(int ensembleSize,
int quorumSize,
Set<org.apache.bookkeeper.net.BookieSocketAddress> excludeBookies)
Choose numBookies bookies for ensemble.
|
Set<org.apache.bookkeeper.net.BookieSocketAddress> |
onClusterChanged(Set<org.apache.bookkeeper.net.BookieSocketAddress> writableBookies,
Set<org.apache.bookkeeper.net.BookieSocketAddress> readOnlyBookies)
A consistent view of the cluster (what bookies are available as writable, what bookies are available as
readonly) is updated when any changes happen in the cluster.
|
org.apache.bookkeeper.net.BookieSocketAddress |
replaceBookie(org.apache.bookkeeper.net.BookieSocketAddress bookieToReplace,
Set<org.apache.bookkeeper.net.BookieSocketAddress> excludeBookies)
Choose a new bookie to replace bookieToReplace.
|
void |
uninitalize()
Uninitialize the policy
|
public ArrayList<org.apache.bookkeeper.net.BookieSocketAddress> newEnsemble(int ensembleSize, int quorumSize, Set<org.apache.bookkeeper.net.BookieSocketAddress> excludeBookies) throws BKException.BKNotEnoughBookiesException
EnsemblePlacementPolicy
BKException.BKNotEnoughBookiesException
is thrown.newEnsemble
in interface EnsemblePlacementPolicy
ensembleSize
- Ensemble SizequorumSize
- Write Quorum SizeexcludeBookies
- Bookies that should not be considered as targets.BKException.BKNotEnoughBookiesException
- if not enough bookies available.public org.apache.bookkeeper.net.BookieSocketAddress replaceBookie(org.apache.bookkeeper.net.BookieSocketAddress bookieToReplace, Set<org.apache.bookkeeper.net.BookieSocketAddress> excludeBookies) throws BKException.BKNotEnoughBookiesException
EnsemblePlacementPolicy
BKException.BKNotEnoughBookiesException
is thrown.replaceBookie
in interface EnsemblePlacementPolicy
bookieToReplace
- bookie to replaceexcludeBookies
- bookies that should not be considered as candidate.BKException.BKNotEnoughBookiesException
public Set<org.apache.bookkeeper.net.BookieSocketAddress> onClusterChanged(Set<org.apache.bookkeeper.net.BookieSocketAddress> writableBookies, Set<org.apache.bookkeeper.net.BookieSocketAddress> readOnlyBookies)
EnsemblePlacementPolicy
onClusterChanged
in interface EnsemblePlacementPolicy
writableBookies
- All the bookies in the cluster available for write/read.readOnlyBookies
- All the bookies in the cluster available for readonly.public EnsemblePlacementPolicy initialize(org.apache.commons.configuration.Configuration conf)
EnsemblePlacementPolicy
initialize
in interface EnsemblePlacementPolicy
conf
- client configuration.public void uninitalize()
EnsemblePlacementPolicy
uninitalize
in interface EnsemblePlacementPolicy
Copyright © 2011-2014 The Apache Software Foundation. All Rights Reserved.