Skip to content

Commit

Permalink
remove the unused conf field in the constructor of LeastLongTermMessa…
Browse files Browse the repository at this point in the history
…geRate (apache#16096)
  • Loading branch information
HQebupt authored Jun 28, 2022
1 parent 50fa2d4 commit e6ef5ec
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,15 @@ Optional<String> selectBroker(Set<String> candidates, BundleData bundleToAssign,
/**
* Create a placement strategy using the configuration.
*
* @param conf
* ServiceConfiguration to use.
* @return A placement strategy from the given configurations.
*/
static ModularLoadManagerStrategy create(final ServiceConfiguration conf) {
static ModularLoadManagerStrategy create() {
try {
// Only one strategy at the moment.
return new LeastLongTermMessageRate(conf);
return new LeastLongTermMessageRate();
} catch (Exception e) {
// Ignore
}
return new LeastLongTermMessageRate(conf);
return new LeastLongTermMessageRate();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class LeastLongTermMessageRate implements ModularLoadManagerStrategy {
// Maintain this list to reduce object creation.
private ArrayList<String> bestBrokers;

public LeastLongTermMessageRate(final ServiceConfiguration conf) {
public LeastLongTermMessageRate() {
bestBrokers = new ArrayList<>();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public void initialize(final PulsarService pulsar) {
defaultStats.msgRateIn = DEFAULT_MESSAGE_RATE;
defaultStats.msgRateOut = DEFAULT_MESSAGE_RATE;

placementStrategy = ModularLoadManagerStrategy.create(conf);
placementStrategy = ModularLoadManagerStrategy.create();
policies = new SimpleResourceAllocationPolicies(pulsar);
filterPipeline.add(new BrokerVersionFilter());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void testLeastLongTermMessageRate() {
brokerDataMap.put("2", brokerData2);
brokerDataMap.put("3", brokerData3);
ServiceConfiguration conf = new ServiceConfiguration();
ModularLoadManagerStrategy strategy = new LeastLongTermMessageRate(conf);
ModularLoadManagerStrategy strategy = new LeastLongTermMessageRate();
assertEquals(strategy.selectBroker(brokerDataMap.keySet(), bundleData, loadData, conf), Optional.of("1"));
brokerData1.getTimeAverageData().setLongTermMsgRateIn(400);
assertEquals(strategy.selectBroker(brokerDataMap.keySet(), bundleData, loadData, conf), Optional.of("2"));
Expand Down

0 comments on commit e6ef5ec

Please sign in to comment.