本文整理匯總了Java中com.ecwid.consul.v1.agent.model.Member類的典型用法代碼示例。如果您正苦於以下問題:Java Member類的具體用法?Java Member怎麽用?Java Member使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Member類屬於com.ecwid.consul.v1.agent.model包,在下文中一共展示了Member類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getAgentMembers
import com.ecwid.consul.v1.agent.model.Member; //導入依賴的package包/類
@Override
public Response<List<Member>> getAgentMembers() {
RawResponse rawResponse = rawClient.makeGetRequest("/v1/agent/members");
if (rawResponse.getStatusCode() == 200) {
List<Member> members = GsonFactory.getGson().fromJson(rawResponse.getContent(), new TypeToken<List<Member>>() {
}.getType());
return new Response<List<Member>>(members, rawResponse);
} else {
throw new OperationException(rawResponse);
}
}
示例2: getAliveAgents
import com.ecwid.consul.v1.agent.model.Member; //導入依賴的package包/類
public List<Member> getAliveAgents() {
List<Member> members = client.getAgentMembers().getValue();
List<Member> liveMembers = new ArrayList<>(members.size());
for (Member peer : members) {
if (peer.getStatus() == ALIVE_STATUS) {
liveMembers.add(peer);
}
}
return liveMembers;
}
示例3: getAliveAgentsAddresses
import com.ecwid.consul.v1.agent.model.Member; //導入依賴的package包/類
public Set<String> getAliveAgentsAddresses() {
Set<String> addresses = new HashSet<>();
for (Member server : getAliveAgents()) {
addresses.add(server.getAddress());
}
return addresses;
}
示例4: createMembers
import com.ecwid.consul.v1.agent.model.Member; //導入依賴的package包/類
private List<Member> createMembers() {
List<Member> members = new ArrayList<>();
for (int i = 0; i <= serverNumber / 254; i++) {
int subAddress = Integer.min(254, serverNumber - i * 254);
for (int j = 1; j <= subAddress; j++) {
Member member = new Member();
member.setAddress("192.168." + i + '.' + j);
member.setStatus(ALIVE_STATUS);
member.setName("consul-" + i + '-' + j);
members.add(member);
}
}
return members;
}
示例5: getAgentMembers
import com.ecwid.consul.v1.agent.model.Member; //導入依賴的package包/類
@Override
public Response<List<Member>> getAgentMembers() {
return wrapped.getAgentMembers();
}
示例6: getAgentMembers
import com.ecwid.consul.v1.agent.model.Member; //導入依賴的package包/類
@Override
public Response<List<Member>> getAgentMembers() {
return agentClient.getAgentMembers();
}
示例7: getAgentMembers
import com.ecwid.consul.v1.agent.model.Member; //導入依賴的package包/類
public Response<List<Member>> getAgentMembers();