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

REFACTOR: ArucsClientPool constructor parameters. #764

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
4 changes: 1 addition & 3 deletions src/main/java/net/spy/memcached/ArcusClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,7 @@ private static ArcusClientPool createArcusClient(String hostPorts, String servic
if (serviceCode.isEmpty()) {
throw new IllegalArgumentException("Service code is empty.");
}

CacheManager exe = new CacheManager(hostPorts, serviceCode, cfb, poolSize, waitTimeForConnect);
return new ArcusClientPool(poolSize, exe.getAC());
return new ArcusClientPool(new CacheManager(hostPorts, serviceCode, cfb, poolSize, waitTimeForConnect));
}

/**
Expand Down
9 changes: 4 additions & 5 deletions src/main/java/net/spy/memcached/ArcusClientPool.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,10 @@ public class ArcusClientPool implements MemcachedClientIF, ArcusClientIF {
private final ArcusClient[] client;
private final Random rand;

public ArcusClientPool(int poolSize, ArcusClient[] client) {

this.poolSize = poolSize;
this.client = client;
rand = new Random();
public ArcusClientPool(CacheManager cacheManager) {
this.client = cacheManager.getAC();
this.poolSize = client.length;
this.rand = new Random();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ArcusClientPool 생성자에서 cacheManager를 인자로 받는 의도는 무엇인가요?

아래의 clientPool 인자만 가져도 충분하지 않나 생각됩니다.

public ArcusClientPool(ArcusClient[] clientPool)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

본 PR의 이슈와 관련 있습니다.
간단히 설명하자면, CacheManager나 Locator 등의 Pool에서 사용되는 객체들에 대한 의존성을
ArcusClientPool에 위임하고 ArcusClient와의 결합을 끊어내려고 합니다.

이슈 설명 한번 읽어주세요.

}

/**
Expand Down