0

As far as I can tell by looking at the code, this class seems thread safe, with synchronized in the right place. But there's no comments/javadoc so it's not very explicit.

I'm wondering if it's safe to use one instance per schema registry server.

The code is here: https://github.com/confluentinc/schema-registry/blob/master/client/src/main/java/io/confluent/kafka/schemaregistry/client/CachedSchemaRegistryClient.java

OneCricketeer
  • 126,858
  • 14
  • 92
  • 185
0x26res
  • 7,536
  • 9
  • 48
  • 90
  • Why would you use one instance per server? Do you mean one instance for all consumer threads? – OneCricketeer Sep 20 '18 at 14:06
  • Might want to check the properties of a Hashmap. For example https://stackoverflow.com/questions/2688629/is-a-hashmap-thread-safe-for-different-keys – OneCricketeer Sep 20 '18 at 14:09
  • @cricket_007 by server I mean confluent schema registry server (if for example I'm writing to different kafka clusters that use different schema registry). That rarely happens in practice excepted if I'm copying prod data to dev for example. – 0x26res Sep 20 '18 at 15:37
  • Sure, but the `schema.registry.url` property in the Kafka clients takes a list of servers already for fault tolerance. There is only a single leader for the schema registry servers anyway, so having multiple Client instances for it doesn't result in any improvements that I am aware of – OneCricketeer Sep 20 '18 at 16:38

0 Answers0