Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix typo in dubbo #3937

Merged
merged 2 commits into from
Apr 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ protected <T> Invoker<T> doSelect(List<Invoker<T>> invokers, URL url, Invocation
leastActive = active;
// Reset the number of least active invokers
leastCount = 1;
// Put the first least active invoker first in leastIndexs
// Put the first least active invoker first in leastIndexes
leastIndexes[0] = i;
// Reset totalWeight
totalWeight = afterWarmup;
Expand All @@ -81,7 +81,7 @@ protected <T> Invoker<T> doSelect(List<Invoker<T>> invokers, URL url, Invocation
sameWeight = true;
// If current invoker's active value equals with leaseActive, then accumulating.
} else if (active == leastActive) {
// Record the index of the least active invoker in leastIndexs order
// Record the index of the least active invoker in leastIndexes order
leastIndexes[leastCount++] = i;
// Accumulate the total weight of the least active invoker
totalWeight += afterWarmup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void testLeastActiveLoadBalance_select() {
Long count = entry.getValue().get();
// System.out.println(count);
Assertions.assertTrue(
Math.abs(count - runs / (0f + invokers.size())) < runs / (0f + invokers.size()), "abs diff shoud < avg");
Math.abs(count - runs / (0f + invokers.size())) < runs / (0f + invokers.size()), "abs diff should < avg");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private void resetInvoker1ToNoException() {
}

@Test
public void testInvokeExceptoin() {
public void testInvokeException() {
Assertions.assertThrows(RpcException.class, () -> {
resetInvoker1ToException();
FailfastClusterInvoker<FailfastClusterInvokerTest> invoker = new FailfastClusterInvoker<FailfastClusterInvokerTest>(dic);
Expand All @@ -90,7 +90,7 @@ public void testInvokeExceptoin() {
}

@Test()
public void testInvokeNoExceptoin() {
public void testInvokeNoException() {

resetInvoker1ToNoException();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ private String generateMethodContent(Method method) {
code.append(generateExtensionAssignment());

// return statement
code.append(generateReturnAndInovation(method));
code.append(generateReturnAndInvocation(method));
}

return code.toString();
Expand Down Expand Up @@ -292,7 +292,7 @@ private String generateExtensionAssignment() {
/**
* generate method invocation statement and return it if necessary
*/
private String generateReturnAndInovation(Method method) {
private String generateReturnAndInvocation(Method method) {
String returnStatement = method.getReturnType().equals(void.class) ? "" : "return ";

String args = Arrays.stream(method.getParameters()).map(Parameter::getName).collect(Collectors.joining(", "));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,20 +441,20 @@ static void assertEqualsBigPerson(BigPerson person, Object obj) {
assertEqualsPrimitive(person.getInfoProfile().isMale(), infoProfile.getProperty("male"));
}

static void assertEqualsPhone(Phone excpected, Object obj) {
static void assertEqualsPhone(Phone expected, Object obj) {
JavaBeanDescriptor descriptor = (JavaBeanDescriptor) obj;
Assertions.assertTrue(descriptor.isBeanType());
if (excpected.getArea() != null) {
assertEqualsPrimitive(excpected.getArea(), descriptor.getProperty("area"));
if (expected.getArea() != null) {
assertEqualsPrimitive(expected.getArea(), descriptor.getProperty("area"));
}
if (excpected.getCountry() != null) {
assertEqualsPrimitive(excpected.getCountry(), descriptor.getProperty("country"));
if (expected.getCountry() != null) {
assertEqualsPrimitive(expected.getCountry(), descriptor.getProperty("country"));
}
if (excpected.getExtensionNumber() != null) {
assertEqualsPrimitive(excpected.getExtensionNumber(), descriptor.getProperty("extensionNumber"));
if (expected.getExtensionNumber() != null) {
assertEqualsPrimitive(expected.getExtensionNumber(), descriptor.getProperty("extensionNumber"));
}
if (excpected.getNumber() != null) {
assertEqualsPrimitive(excpected.getNumber(), descriptor.getProperty("number"));
if (expected.getNumber() != null) {
assertEqualsPrimitive(expected.getNumber(), descriptor.getProperty("number"));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ public void testRefreshAll() {

System.setProperty("dubbo.override.address", "system://127.0.0.1:2181");
System.setProperty("dubbo.override.protocol", "system");
// this will not override, use 'key' instread, @Parameter(key="key1", useKeyAsProperty=false)
// this will not override, use 'key' instead, @Parameter(key="key1", useKeyAsProperty=false)
System.setProperty("dubbo.override.key1", "system");
System.setProperty("dubbo.override.key2", "system");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,20 +312,20 @@ public void testRecover2() throws Exception {
@Test
public void testNotify() throws Exception {
final AtomicReference<Boolean> notified = new AtomicReference<Boolean>(false);
NotifyListener listner1 = urls -> notified.set(Boolean.TRUE);
NotifyListener listener1 = urls -> notified.set(Boolean.TRUE);
URL url1 = new URL("dubbo", "192.168.0.1", 2200, parametersConsumer);
abstractRegistry.subscribe(url1, listner1);
NotifyListener listner2 = urls -> notified.set(Boolean.TRUE);
abstractRegistry.subscribe(url1, listener1);
NotifyListener listener2 = urls -> notified.set(Boolean.TRUE);
URL url2 = new URL("dubbo", "192.168.0.2", 2201, parametersConsumer);
abstractRegistry.subscribe(url2, listner2);
NotifyListener listner3 = urls -> notified.set(Boolean.TRUE);
abstractRegistry.subscribe(url2, listener2);
NotifyListener listener3 = urls -> notified.set(Boolean.TRUE);
URL url3 = new URL("dubbo", "192.168.0.3", 2202, parametersConsumer);
abstractRegistry.subscribe(url3, listner3);
abstractRegistry.subscribe(url3, listener3);
List<URL> urls = new ArrayList<>();
urls.add(url1);
urls.add(url2);
urls.add(url3);
abstractRegistry.notify(url1, listner1, urls);
abstractRegistry.notify(url1, listener1, urls);
Map<URL, Map<String, List<URL>>> map = abstractRegistry.getNotified();
MatcherAssert.assertThat(true, Matchers.equalTo(map.containsKey(url1)));
MatcherAssert.assertThat(false, Matchers.equalTo(map.containsKey(url2)));
Expand All @@ -338,15 +338,15 @@ public void testNotify() throws Exception {
@Test
public void testNotifyList() throws Exception {
final AtomicReference<Boolean> notified = new AtomicReference<Boolean>(false);
NotifyListener listner1 = urls -> notified.set(Boolean.TRUE);
NotifyListener listener1 = urls -> notified.set(Boolean.TRUE);
URL url1 = new URL("dubbo", "192.168.0.1", 2200, parametersConsumer);
abstractRegistry.subscribe(url1, listner1);
NotifyListener listner2 = urls -> notified.set(Boolean.TRUE);
abstractRegistry.subscribe(url1, listener1);
NotifyListener listener2 = urls -> notified.set(Boolean.TRUE);
URL url2 = new URL("dubbo", "192.168.0.2", 2201, parametersConsumer);
abstractRegistry.subscribe(url2, listner2);
NotifyListener listner3 = urls -> notified.set(Boolean.TRUE);
abstractRegistry.subscribe(url2, listener2);
NotifyListener listener3 = urls -> notified.set(Boolean.TRUE);
URL url3 = new URL("dubbo", "192.168.0.3", 2202, parametersConsumer);
abstractRegistry.subscribe(url3, listner3);
abstractRegistry.subscribe(url3, listener3);
List<URL> urls = new ArrayList<>();
urls.add(url1);
urls.add(url2);
Expand All @@ -362,20 +362,20 @@ public void testNotifyList() throws Exception {
public void testNotifyIfURLNull() throws Exception {
Assertions.assertThrows(IllegalArgumentException.class, () -> {
final AtomicReference<Boolean> notified = new AtomicReference<Boolean>(false);
NotifyListener listner1 = urls -> notified.set(Boolean.TRUE);
NotifyListener listener1 = urls -> notified.set(Boolean.TRUE);
URL url1 = new URL("dubbo", "192.168.0.1", 2200, parametersConsumer);
abstractRegistry.subscribe(url1, listner1);
NotifyListener listner2 = urls -> notified.set(Boolean.TRUE);
abstractRegistry.subscribe(url1, listener1);
NotifyListener listener2 = urls -> notified.set(Boolean.TRUE);
URL url2 = new URL("dubbo", "192.168.0.2", 2201, parametersConsumer);
abstractRegistry.subscribe(url2, listner2);
NotifyListener listner3 = urls -> notified.set(Boolean.TRUE);
abstractRegistry.subscribe(url2, listener2);
NotifyListener listener3 = urls -> notified.set(Boolean.TRUE);
URL url3 = new URL("dubbo", "192.168.0.3", 2202, parametersConsumer);
abstractRegistry.subscribe(url3, listner3);
abstractRegistry.subscribe(url3, listener3);
List<URL> urls = new ArrayList<>();
urls.add(url1);
urls.add(url2);
urls.add(url3);
abstractRegistry.notify(null, listner1, urls);
abstractRegistry.notify(null, listener1, urls);
Assertions.fail("notify url == null");
});
}
Expand All @@ -384,15 +384,15 @@ public void testNotifyIfURLNull() throws Exception {
public void testNotifyIfNotifyNull() {
Assertions.assertThrows(IllegalArgumentException.class, () -> {
final AtomicReference<Boolean> notified = new AtomicReference<Boolean>(false);
NotifyListener listner1 = urls -> notified.set(Boolean.TRUE);
NotifyListener listener1 = urls -> notified.set(Boolean.TRUE);
URL url1 = new URL("dubbo", "192.168.0.1", 2200, parametersConsumer);
abstractRegistry.subscribe(url1, listner1);
NotifyListener listner2 = urls -> notified.set(Boolean.TRUE);
abstractRegistry.subscribe(url1, listener1);
NotifyListener listener2 = urls -> notified.set(Boolean.TRUE);
URL url2 = new URL("dubbo", "192.168.0.2", 2201, parametersConsumer);
abstractRegistry.subscribe(url2, listner2);
NotifyListener listner3 = urls -> notified.set(Boolean.TRUE);
abstractRegistry.subscribe(url2, listener2);
NotifyListener listener3 = urls -> notified.set(Boolean.TRUE);
URL url3 = new URL("dubbo", "192.168.0.3", 2202, parametersConsumer);
abstractRegistry.subscribe(url3, listner3);
abstractRegistry.subscribe(url3, listener3);
List<URL> urls = new ArrayList<>();
urls.add(url1);
urls.add(url2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ protected void connect() throws RemotingException {

} else {
if (logger.isInfoEnabled()) {
logger.info("Successed connect to server " + getRemoteAddress() + " from " + getClass().getSimpleName() + " "
logger.info("Succeed connect to server " + getRemoteAddress() + " from " + getClass().getSimpleName() + " "
+ NetUtils.getLocalHost() + " using dubbo version " + Version.getVersion()
+ ", channel is " + this.getChannel());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public abstract class AbstractEtcdClient<WatcherListener> implements EtcdClient
private final Set<StateListener> stateListeners = new ConcurrentHashSet<>();

private final ConcurrentMap<String, ConcurrentMap<ChildListener, WatcherListener>> childListeners = new ConcurrentHashMap<>();
private final List<String> categroies = Arrays.asList(Constants.PROVIDERS_CATEGORY
private final List<String> categories = Arrays.asList(Constants.PROVIDERS_CATEGORY
, Constants.CONSUMERS_CATEGORY
, Constants.ROUTERS_CATEGORY
, Constants.CONFIGURATORS_CATEGORY);
Expand Down Expand Up @@ -158,11 +158,11 @@ protected void createParentIfAbsent(String fixedPath) {
int i = fixedPath.lastIndexOf('/');
if (i > 0) {
String parentPath = fixedPath.substring(0, i);
if (categroies.stream().anyMatch(c -> fixedPath.endsWith(c))) {
if (categories.stream().anyMatch(c -> fixedPath.endsWith(c))) {
if (!checkExists(parentPath)) {
this.doCreatePersistent(parentPath);
}
} else if (categroies.stream().anyMatch(c -> parentPath.endsWith(c))) {
} else if (categories.stream().anyMatch(c -> parentPath.endsWith(c))) {
String grandfather = parentPath.substring(0, parentPath.lastIndexOf('/'));
if (!checkExists(grandfather)) {
this.doCreatePersistent(grandfather);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public abstract class AbstractProtocol implements Protocol {

protected final Map<String, Exporter<?>> exporterMap = new ConcurrentHashMap<String, Exporter<?>>();

//TODO SOFEREFENCE
//TODO SoftReference
protected final Set<Invoker<?>> invokers = new ConcurrentHashSet<Invoker<?>>();

protected static String serviceKey(URL url) {
Expand Down