Skip to content

Commit

Permalink
[Pulsar Broker] CleanUp and Javadocs fix (apache#3145)
Browse files Browse the repository at this point in the history
  • Loading branch information
erenavsarogullari authored and merlimat committed Dec 8, 2018
1 parent 5b6f679 commit b2ddf7e
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ private void createSampleNameSpace(URL webServiceUrl, String brokerServiceUrl, S
}
}

/** this methods gets a buidler to use to build and an embedded pulsar instance `
/** This method gets a builder to build an embedded pulsar instance
* i.e.
* <pre>
* <code>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ private void startZkCacheService() throws PulsarServerException {

private void startNamespaceService() throws PulsarServerException {

LOG.info("starting name space service, bootstrap namespaces=" + config.getBootstrapNamespaces());
LOG.info("Starting name space service, bootstrap namespaces=" + config.getBootstrapNamespaces());

this.nsservice = getNamespaceServiceProvider().get();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@
/**
* This interface class defines how we calculator the resource requirement per service unit based on the
* <code>ServiceRequest</code>
*
*
*/
public interface LoadCalculator {
public ResourceDescription getResourceDescription(ServiceRequest srvRequest);
ResourceDescription getResourceDescription(ServiceRequest srvRequest);

public void recaliberateResourceUsagePerServiceUnit(LoadReport loadReport);
void recalibrateResourceUsagePerServiceUnit(LoadReport loadReport);
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,20 @@
*/
package org.apache.pulsar.broker.loadbalance.impl;

import java.util.Map;

import org.apache.pulsar.broker.loadbalance.LoadCalculator;
import org.apache.pulsar.broker.loadbalance.LoadReport;
import org.apache.pulsar.broker.loadbalance.ResourceDescription;
import org.apache.pulsar.broker.loadbalance.ServiceRequest;

import com.google.common.collect.Maps;

public class SimpleLoadCalculatorImpl implements LoadCalculator {

private final Map<String, Map<String, Integer>> resourceUsageCalibers = Maps.newHashMap();

@Override
public ResourceDescription getResourceDescription(ServiceRequest srvRequest) {
return null;
}

@Override
public void recaliberateResourceUsagePerServiceUnit(LoadReport loadReport) {
public void recalibrateResourceUsagePerServiceUnit(LoadReport loadReport) {
// Based on each load report, calculate the average resource required by each service request characteristics
// i.e. from the load report, we calculate that # of topics and # of consumers are related to memory
// usage, # of msg/s is counted toward NIC inbw and outbw and CPU, # of connections are related to the # of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,12 @@
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
import java.util.concurrent.locks.ReentrantReadWriteLock;

import org.apache.bookkeeper.common.util.OrderedExecutor;
import org.apache.bookkeeper.mledger.Entry;
import org.apache.bookkeeper.mledger.Position;
import org.apache.bookkeeper.mledger.util.SafeRun;
import org.apache.pulsar.broker.admin.AdminResource;
import org.apache.pulsar.broker.service.BrokerService;
import org.apache.pulsar.broker.service.BrokerServiceException;
Expand Down Expand Up @@ -292,17 +290,6 @@ private boolean hasLocalProducers() {
return foundLocal.get();
}

private boolean hasRemoteProducers() {
AtomicBoolean foundRemote = new AtomicBoolean(false);
producers.forEach(producer -> {
if (producer.isRemote()) {
foundRemote.set(true);
}
});

return foundRemote.get();
}

@Override
public void removeProducer(Producer producer) {
checkArgument(producer.getTopic() == this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@
import org.apache.pulsar.common.compression.CompressionCodec;
import org.apache.pulsar.common.compression.CompressionCodecProvider;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class RawBatchConverter {
private static final Logger log = LoggerFactory.getLogger(RawBatchConverter.class);

public static boolean isReadableBatch(RawMessage msg) {
ByteBuf payload = msg.getHeadersAndPayload();
Expand Down Expand Up @@ -93,7 +89,7 @@ public static List<ImmutablePair<MessageId,String>> extractIdsAndKeys(RawMessage
}

/**
* Take a batched message and a filter, and returns a message with the only the submessages
* Take a batched message and a filter, and returns a message with the only the sub-messages
* which match the filter. Returns an empty optional if no messages match.
*
* This takes ownership of the passes in message, and if the returned optional is not empty,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public int compareTo(NamespaceBundle other) {

try {
/**
* <code>Range.insersection()</code> will throw <code>IllegalArgumentException</code> when two ranges are
* <code>Range.intersection()</code> will throw <code>IllegalArgumentException</code> when two ranges are
* not connected at all, which is a OK case for our comparison. <code>checkState</code> here is to ensure
* that the two ranges we are comparing don't have overlaps.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ public void testResourceDescription() {
assertTrue(rd1.calculateRank() > rd.calculateRank());

SimpleLoadCalculatorImpl calc = new SimpleLoadCalculatorImpl();
calc.recaliberateResourceUsagePerServiceUnit(null);
calc.recalibrateResourceUsagePerServiceUnit(null);
assertNull(calc.getResourceDescription(null));

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
*/
package org.apache.pulsar.client.impl;

import static com.google.common.base.Preconditions.checkState;
import static org.apache.pulsar.common.naming.TopicName.PARTITIONED_TOPIC_SUFFIX;

import java.util.Objects;
import org.apache.pulsar.client.api.MessageId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ private void redirect(HttpServletRequest request, HttpServletResponse response)
}

/**
* Find next broke url in round-robin
* Find next broker url in round-robin
*
* @return
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.aspectj.lang.annotation.Pointcut;

/**
* Instruments ZooKeeperServer to enable stats reporting on data set and z-node sizess
* Instruments ZooKeeperServer to enable stats reporting on data set and z-node sizes
*/
@Aspect
public class ZooKeeperServerAspect {
Expand Down

0 comments on commit b2ddf7e

Please sign in to comment.