MCPcopy Index your code
hub / github.com/OpenTSDB/asynchbase / flushBufferedIncrements

Method flushBufferedIncrements

src/HBaseClient.java:1869–1900  ·  view source on GitHub ↗

Flushes all buffered increments. @param increment_buffer The buffer to flush.

(// JAVA Y U NO HAVE TYPEDEF? F U!
    final LoadingCache<BufferedIncrement, BufferedIncrement.Amount> increment_buffer)

Source from the content-addressed store, hash-verified

1867 * @param increment_buffer The buffer to flush.
1868 */
1869 private static void flushBufferedIncrements(// JAVA Y U NO HAVE TYPEDEF? F U!
1870 final LoadingCache<BufferedIncrement, BufferedIncrement.Amount> increment_buffer) {
1871 // Calling this method to clean up before shutting down works solely
1872 // because `invalidateAll()' will *synchronously* remove everything.
1873 // The Guava documentation says "Discards all entries in the cache,
1874 // possibly asynchronously" but in practice the code in `LocalCache'
1875 // works as follows:
1876 //
1877 // for each segment:
1878 // segment.clear
1879 //
1880 // Where clearing a segment consists in:
1881 //
1882 // lock the segment
1883 // for each active entry:
1884 // add entry to removal queue
1885 // null out the hash table
1886 // unlock the segment
1887 // for each entry in removal queue:
1888 // call the removal listener on that entry
1889 //
1890 // So by the time the call to `invalidateAll()' returns, every single
1891 // buffered increment will have been dealt with, and it is thus safe
1892 // to shutdown the rest of the client to let it complete all outstanding
1893 // operations.
1894 if (LOG.isDebugEnabled()) {
1895 LOG.debug("Flushing " + increment_buffer.size() + " buffered increments");
1896 }
1897 synchronized (increment_buffer) {
1898 increment_buffer.invalidateAll();
1899 }
1900 }
1901
1902 /**
1903 * Flushes all buffered increments.

Callers 3

flushMethod · 0.95
runMethod · 0.80

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected