private class BalanceActionItemListener implements
EntryListener<ReplicaBalancer.BalanceAction, String> {
@Override
public void entryAdded(EntryEvent<BalanceAction, String> event) {
BalanceAction action = event.getKey();
if(action.getOriginNode().equals(whoAmI())) {
// I must do a balance action!
File toSend = new File(getLocalStorageFolder(action.getTablespace(), action.getPartition(),
action.getVersion()), action.getPartition() + ".db");
File metadataFile = getLocalMetadataFile(action.getTablespace(), action.getPartition(),
action.getVersion());
// send both the .db and the .meta file -> when the other part has both files it will move them atomically...
httpExchanger.send(action.getTablespace(), action.getPartition(), action.getVersion(), toSend,
action.getFinalNode(), false);
httpExchanger.send(action.getTablespace(), action.getPartition(), action.getVersion(),
metadataFile, action.getFinalNode(), false);
}
}