java.io.Closeable, java.lang.AutoCloseable, GetSpaceUsedDFCachingGetSpaceUsed, DU, WindowsGetSpaceUsed@LimitedPrivate({"HDFS","MapReduce"})
@Evolving
public abstract class CachingGetSpaceUsed
extends java.lang.Object
implements java.io.Closeable, GetSpaceUsed
The implementor is fee to cache space used. As such there are methods to update the cached value with any known changes.
GetSpaceUsed.Builder| Modifier and Type | Field | Description |
|---|---|---|
protected java.util.concurrent.atomic.AtomicLong |
used |
| Constructor | Description |
|---|---|
CachingGetSpaceUsed(GetSpaceUsed.Builder builder) |
This is the constructor used by the builder.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
close() |
|
java.lang.String |
getDirPath() |
|
long |
getJitter() |
Randomize the refresh interval timing by this amount, the actual interval will be chosen
uniformly between
interval-jitter and interval+jitter. |
long |
getRefreshInterval() |
How long in between runs of the background refresh.
|
long |
getUsed() |
|
void |
incDfsUsed(long value) |
Increment the cached value of used space.
|
protected abstract void |
refresh() |
|
protected void |
setShouldFirstRefresh(boolean shouldFirstRefresh) |
Reset that if we need to do the first refresh.
|
protected void |
setUsed(long usedValue) |
Reset the current used data amount.
|
public CachingGetSpaceUsed(GetSpaceUsed.Builder builder) throws java.io.IOException
builder - builder.java.io.IOException - raised on errors performing I/O.protected abstract void refresh()
protected void setShouldFirstRefresh(boolean shouldFirstRefresh)
shouldFirstRefresh - The flag value to set.public long getUsed()
throws java.io.IOException
getUsed in interface GetSpaceUsedjava.io.IOExceptionpublic java.lang.String getDirPath()
public void incDfsUsed(long value)
value - dfs used value.@VisibleForTesting public long getRefreshInterval()
@VisibleForTesting public long getJitter()
interval-jitter and interval+jitter.protected void setUsed(long usedValue)
usedValue - new value that should be the disk usage.public void close()
throws java.io.IOException
close in interface java.lang.AutoCloseableclose in interface java.io.Closeablejava.io.IOExceptionCopyright © 2008–2025 Apache Software Foundation. All rights reserved.