Change-Id: I75c9fffc2785cb59bac9e7ccaddebfec72b4c6e1
Signed-off-by: dglFromAtt <dgl@research.att.com>
Issue-ID: DMAAP-880
- public MirrorMaker getNextMM( String source, String target ) {
+ public MirrorMaker getNextMM( String source, String target, String fqtn ) {
int i = 0;
MirrorMaker mm = null;
while( mm == null ) {
int i = 0;
MirrorMaker mm = null;
while( mm == null ) {
if ( mm == null ) {
mm = new MirrorMaker(source, target, i);
}
if ( mm == null ) {
mm = new MirrorMaker(source, target, i);
}
+ if ( mm.getTopics().contains(fqtn) ) {
+ break;
+ }
if ( mm.getTopicCount() >= maxTopicsPerMM ) {
logger.info( "getNextMM: MM " + mm.getMmName() + " has " + mm.getTopicCount() + " topics. Moving to next MM");
i++;
if ( mm.getTopicCount() >= maxTopicsPerMM ) {
logger.info( "getNextMM: MM " + mm.getMmName() + " has " + mm.getTopicCount() + " topics. Moving to next MM");
i++;
public MirrorMaker splitMM( MirrorMaker orig ) {
public MirrorMaker splitMM( MirrorMaker orig ) {
String source = orig.getSourceCluster();
String target = orig.getTargetCluster();
ArrayList<String> whitelist = orig.getTopics();
while( whitelist.size() > maxTopicsPerMM ) {
String source = orig.getSourceCluster();
String target = orig.getTargetCluster();
ArrayList<String> whitelist = orig.getTopics();
while( whitelist.size() > maxTopicsPerMM ) {
- MirrorMaker mm = this.getNextMM( source, target );
int last = whitelist.size() - 1;
String topic = whitelist.get(last);
whitelist.remove(last);
int last = whitelist.size() - 1;
String topic = whitelist.get(last);
whitelist.remove(last);
+ MirrorMaker mm = this.getNextMM( source, target, topic );
mm.addTopic(topic);
this.updateMirrorMaker(mm);
}
mm.addTopic(topic);
this.updateMirrorMaker(mm);
}
if ( source != null && target != null ) {
try {
logger.info( "Create a MM from " + source + " to " + target );
if ( source != null && target != null ) {
try {
logger.info( "Create a MM from " + source + " to " + target );
- MirrorMaker mm = bridge.getNextMM( source, target);
+ MirrorMaker mm = bridge.getNextMM( source, target, topic.getFqtn());
mm.addTopic(topic.getFqtn());
bridge.updateMirrorMaker(mm);
} catch ( Exception ex ) {
mm.addTopic(topic.getFqtn());
bridge.updateMirrorMaker(mm);
} catch ( Exception ex ) {