##Consider concurrent collections over synchronization
Consider concurrent collections over synchronization
If your primary worry is thread safety, since Java 1.5, there are collections you may utilize that, reliably, abstract this concern away. They are considered unconditionally thread-safe, containing sufficient synchronization that their instances do not need to explicitly handle any synchronizing, in your case you would use ConcurrentMap<Datacenters, ImmutableList<String>> socketsByDatacenter = new ConcurrentHashMap<>();
Upon further inspection, you effectively handle concurrent through immutability, the above is nonetheless worth noting for reference. Although, given the aforementioned concurrent collection or your schema synchronization only serves to unnecessarily slow down performance. Synchronizers lock a block and wait for completion but in either case it serves no purpose.
##Consider concurrent collections over synchronization
If your primary worry is thread safety, since Java 1.5, there are collections you may utilize that, reliably, abstract this concern away. They are considered unconditionally thread-safe, containing sufficient synchronization that their instances do not need to explicitly handle any synchronizing, in your case you would use ConcurrentMap<Datacenters, ImmutableList<String>> socketsByDatacenter = new ConcurrentHashMap<>();
Upon further inspection, you effectively handle concurrent through immutability, the above is nonetheless worth noting for reference. Although, given the aforementioned concurrent collection or your schema synchronization only serves to unnecessarily slow down performance. Synchronizers lock a block and wait for completion but in either case it serves no purpose.
Consider concurrent collections over synchronization
If your primary worry is thread safety, since Java 1.5, there are collections you may utilize that, reliably, abstract this concern away. They are considered unconditionally thread-safe, containing sufficient synchronization that their instances do not need to explicitly handle any synchronizing, in your case you would use ConcurrentMap<Datacenters, ImmutableList<String>> socketsByDatacenter = new ConcurrentHashMap<>();
Upon further inspection, you effectively handle concurrent through immutability, the above is nonetheless worth noting for reference. Although, given the aforementioned concurrent collection or your schema synchronization only serves to unnecessarily slow down performance. Synchronizers lock a block and wait for completion but in either case it serves no purpose.
##Consider concurrent collections over synchronization
If your primary worry is thread safety, since Java 1.5, there are collections you may utilize that, reliably, abstract this concern away. They are considered unconditionally thread-safe, containing sufficient synchronization that their instances do not need to explicitly handle any synchronizing, in your case you would use ConcurrentMap<Datacenters, ImmutableList<String>> socketsByDatacenter = new ConcurrentHashMap<>();
Upon further inspection, you effectively handle concurrent through immutability, the above is nonetheless worth noting for reference. Although, given the aforementioned concurrent collection or your schema synchronization only serves to unnecessarily slow down performance. Synchronizers lock a block and wait for completion but in either case it serves no purpose.
##Consider concurrent collections over synchronization
If your primary worry is thread safety, since Java 1.5, there are collections you may utilize that, reliably, abstract this concern away. They are considered unconditionally thread-safe, containing sufficient synchronization that their instances do not need to explicitly handle any synchronizing, in your case you would use ConcurrentMap<Datacenters, ImmutableList<String>> socketsByDatacenter = new ConcurrentHashMap<>();
##Consider concurrent collections over synchronization
If your primary worry is thread safety, since Java 1.5, there are collections you may utilize that, reliably, abstract this concern away. They are considered unconditionally thread-safe, containing sufficient synchronization that their instances do not need to explicitly handle any synchronizing, in your case you would use ConcurrentMap<Datacenters, ImmutableList<String>> socketsByDatacenter = new ConcurrentHashMap<>();
Upon further inspection, you effectively handle concurrent through immutability, the above is nonetheless worth noting for reference. Although, given the aforementioned concurrent collection or your schema synchronization only serves to unnecessarily slow down performance. Synchronizers lock a block and wait for completion but in either case it serves no purpose.
##Consider concurrent collections over synchronization
If your primary worry is thread safety, since Java 1.5, there are collections you may utilize that, reliably, abstract this concern away. They are considered unconditionally thread-safe, containing sufficient synchronization that their instances do not need to explicitly handle any synchronizing, in your case you would use ConcurrentMap<Datacenters, ImmutableList<String>> socketsByDatacenter = new ConcurrentHashMap<>();