Flushes all buffered increments. @param multicolumn_increment_buffer The buffer to flush.
(// JAVA Y U NO HAVE TYPEDEF? F U!
final LoadingCache<BufferedMultiColumnIncrement, BufferedMultiColumnIncrement.Amounts> multicolumn_increment_buffer)
| 1904 | * @param multicolumn_increment_buffer The buffer to flush. |
| 1905 | */ |
| 1906 | private static void flushBufferedMultiColumnIncrements(// JAVA Y U NO HAVE TYPEDEF? F U! |
| 1907 | final LoadingCache<BufferedMultiColumnIncrement, BufferedMultiColumnIncrement.Amounts> multicolumn_increment_buffer) { |
| 1908 | // Calling this method to clean up before shutting down works solely |
| 1909 | // because `invalidateAll()' will *synchronously* remove everything. |
| 1910 | // The Guava documentation says "Discards all entries in the cache, |
| 1911 | // possibly asynchronously" but in practice the code in `LocalCache' |
| 1912 | // works as follows: |
| 1913 | // |
| 1914 | // for each segment: |
| 1915 | // segment.clear |
| 1916 | // |
| 1917 | // Where clearing a segment consists in: |
| 1918 | // |
| 1919 | // lock the segment |
| 1920 | // for each active entry: |
| 1921 | // add entry to removal queue |
| 1922 | // null out the hash table |
| 1923 | // unlock the segment |
| 1924 | // for each entry in removal queue: |
| 1925 | // call the removal listener on that entry |
| 1926 | // |
| 1927 | // So by the time the call to `invalidateAll()' returns, every single |
| 1928 | // buffered increment will have been dealt with, and it is thus safe |
| 1929 | // to shutdown the rest of the client to let it complete all outstanding |
| 1930 | // operations. |
| 1931 | if (LOG.isDebugEnabled()) { |
| 1932 | LOG.debug("Flushing " + multicolumn_increment_buffer.size() + " buffered multi-column increments"); |
| 1933 | } |
| 1934 | synchronized (multicolumn_increment_buffer) { |
| 1935 | multicolumn_increment_buffer.invalidateAll(); |
| 1936 | } |
| 1937 | } |
| 1938 | |
| 1939 | /** |
| 1940 | * Creates the increment buffer according to current configuration. |