Skip to content

Commit

Permalink
Fix typo. (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
leizhiyuan authored and ujjboy committed May 2, 2018
1 parent 238c4e3 commit 500b12f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public Selector(String interfaceId, String method, List<ProviderInfo> actualNode
public ProviderInfo select(SofaRequest request) {
String key = buildKeyOfHash(request.getMethodArgs());
byte[] digest = messageDigest(key);
return sekectForKey(hash(digest, 0));
return selectForKey(hash(digest, 0));
}

/**
Expand All @@ -160,12 +160,12 @@ private String buildKeyOfHash(Object[] args) {
}

/**
* Sekect for key.
* Select for key.
*
* @param hash the hash
* @return the provider
*/
private ProviderInfo sekectForKey(long hash) {
private ProviderInfo selectForKey(long hash) {
ProviderInfo providerInfo = virtualNodes.get(hash);
if (providerInfo == null) {
SortedMap<Long, ProviderInfo> tailMap = virtualNodes.tailMap(hash);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,24 @@ public static void main(String[] args) {
ConsumerConfig<HelloService> consumerConfig = new ConsumerConfig<HelloService>()
.setInterfaceId(HelloService.class.getName()) // 指定接口
.setProtocol("bolt") // 指定协议
.setDirectUrl("bolt://127.0.0.1:12200"); // 指定直连地址
.setDirectUrl("bolt://127.0.0.1:12200") // 指定直连地址
.setConnectTimeout(10 * 1000);

HelloService helloService = consumerConfig.refer();

while (true) {
System.out.println(helloService.sayHello("world"));
try {
Thread.sleep(2000);
System.out.println(helloService.sayHello("world"));
} catch (Exception e) {
e.printStackTrace();
}

try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}

}
}
}

0 comments on commit 500b12f

Please sign in to comment.