example of using correlation:
read input if (correlation-id is already generated for this input) { lookup the correlation-id from the cache; return correlation-id; } else { generate the correlation-id; cache it; return correlation-id; }
Limitations: - The number of input records can go up to 500K, therefore, does not want to use strong links. - Doesn't want to generate unidirectional hashes at the moment (I know that if we use a one-way hash, then there is no need to cache)
Can someone tell me how to use ComputingMap for this. I ask for this because javadoc has a note that says: "It uses the identifier equality for weak / soft keys."
Google Guava/Collection , equals(), == . / , , . , , GC , .
, Google Equivalence , , equals() == , , .
Tuple equals() hashCode(),
new MapMaker() .softValues() .makeComputingMap(new Function<Tuple,String>() { public String apply(Tuple t) { // generate the correlation-id } });
Source: https://habr.com/ru/post/1728529/More articles:UniVerse RetrieVe, how can I request a file for all its column values? - u2UserControl, отображающий несколько свойств контента! Как это было бы интересно! - silverlightCross-browser add-ons - browserHow to find a list of columns in UniVerse with RetrieVe or SQL? - u2releasing javascript library for the first time - javascriptIphone-SDK: accelerometer x, z to 360 degrees? - iphoneHow to programmatically register a component that depends on a list of already registered components with Castle Windsor? - inversion-of-controlМассивы неизвестной длины в Visual Basic - arraysconflict conflict - linq-to-sqlPython Function Reference - pythonAll Articles