All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.contek.zeus.client.grpc.MarketServiceStubPool Maven / Gradle / Ivy

There is a newer version: 2.29.0
Show newest version
package io.contek.zeus.client.grpc;

import com.google.common.collect.ImmutableList;
import io.contek.zeus.IndexSymbol;
import io.contek.zeus.MarketSymbol;
import io.contek.zeus.exchange.MarketServiceGrpc;
import io.contek.zeus.exchange.MarketServiceGrpc.MarketServiceBlockingStub;
import io.grpc.Channel;

import javax.annotation.concurrent.ThreadSafe;
import java.util.Collection;
import java.util.List;

@ThreadSafe
final class MarketServiceStubPool extends GrpcStubPool {

  private MarketServiceStubPool(Iterable stubs) {
    super(stubs);
  }

  static MarketServiceStubPool forChannels(Collection channels) {
    List stubs =
        channels.stream()
            .map(MarketServiceGrpc::newBlockingStub)
            .collect(ImmutableList.toImmutableList());
    return new MarketServiceStubPool(stubs);
  }

  MarketServiceBlockingStub forIndexSubscribe(IndexSymbol indexSymbol) {
    return fixed(indexSymbol.hashCode());
  }

  MarketServiceBlockingStub forMarketSubscribe(MarketSymbol marketSymbol) {
    return fixed(marketSymbol.hashCode());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy