io.contek.zeus.client.grpc.UserServiceStubPool Maven / Gradle / Ivy
package io.contek.zeus.client.grpc;
import com.google.common.collect.ImmutableList;
import io.contek.zeus.AccountName;
import io.contek.zeus.exchange.UserServiceGrpc;
import io.contek.zeus.exchange.UserServiceGrpc.UserServiceBlockingStub;
import io.grpc.Channel;
import javax.annotation.concurrent.ThreadSafe;
import java.util.Collection;
import java.util.List;
@ThreadSafe
final class UserServiceStubPool extends GrpcStubPool {
private UserServiceStubPool(Iterable stubs) {
super(stubs);
}
static UserServiceStubPool forChannels(Collection channels) {
List stubs =
channels.stream()
.map(UserServiceGrpc::newBlockingStub)
.collect(ImmutableList.toImmutableList());
return new UserServiceStubPool(stubs);
}
UserServiceBlockingStub forAccount(AccountName accountName) {
return fixed(accountName.hashCode());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy