Package com.netcracker.profiler.stream
Class CompressedLocalAndRemoteOutputStream
java.lang.Object
com.netcracker.profiler.stream.CompressedLocalAndRemoteOutputStream
- All Implemented Interfaces:
ICompressedLocalAndRemoteOutputStream,Closeable,AutoCloseable
public class CompressedLocalAndRemoteOutputStream
extends Object
implements ICompressedLocalAndRemoteOutputStream
this one orchestrates rotation of remote streams and local files
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCompressedLocalAndRemoteOutputStream(String name, int rotateThreshold, int version) CompressedLocalAndRemoteOutputStream(String name, int rotateThreshold, int version, Object state) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(com.netcracker.profiler.io.listener.FileRotatedListener listener) voidvoidvoidclose()voidlongReturns compressed stream size, including all previous rotations The compression rate for current file is estimated as 20x, to eliminate filesystem operation .length()intgetIndex()Collection<com.netcracker.profiler.io.listener.FileRotatedListener> getName()getState()com.netcracker.profiler.dump.IDataOutputStreamExlongReturns uncompressed stream size, including all previous rotationsprotected voidprotected booleanrotate()booleanChecks if current size exceeds limit and rotates streamvoidsetClient(com.netcracker.profiler.agent.DumperCollectorClient client) voidsetDependentStream(ICompressedLocalAndRemoteOutputStream dependentStream) voidsetLocalDumpEnabled(boolean localDumpEnabled) voidvoid
-
Field Details
-
log
public static final org.slf4j.Logger log
-
-
Constructor Details
-
CompressedLocalAndRemoteOutputStream
-
CompressedLocalAndRemoteOutputStream
-
-
Method Details
-
setLocalDumpEnabled
public void setLocalDumpEnabled(boolean localDumpEnabled) - Specified by:
setLocalDumpEnabledin interfaceICompressedLocalAndRemoteOutputStream
-
askRotateForRemote
public void askRotateForRemote()- Specified by:
askRotateForRemotein interfaceICompressedLocalAndRemoteOutputStream
-
resetExistingContents
protected boolean resetExistingContents() -
getStream
public com.netcracker.profiler.dump.IDataOutputStreamEx getStream()- Specified by:
getStreamin interfaceICompressedLocalAndRemoteOutputStream
-
writePhrase
- Specified by:
writePhrasein interfaceICompressedLocalAndRemoteOutputStream- Throws:
IOException
-
getIndex
public int getIndex()- Specified by:
getIndexin interfaceICompressedLocalAndRemoteOutputStream
-
setRoot
- Specified by:
setRootin interfaceICompressedLocalAndRemoteOutputStream
-
initialize
protected void initialize() -
setClient
public void setClient(com.netcracker.profiler.agent.DumperCollectorClient client) - Specified by:
setClientin interfaceICompressedLocalAndRemoteOutputStream
-
rotate
- Specified by:
rotatein interfaceICompressedLocalAndRemoteOutputStream- Throws:
IOException
-
fileRotated
- Specified by:
fileRotatedin interfaceICompressedLocalAndRemoteOutputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
rotateIfRequired
Checks if current size exceeds limit and rotates stream- Specified by:
rotateIfRequiredin interfaceICompressedLocalAndRemoteOutputStream- Returns:
- true in case the stream was rotated
- Throws:
IOException
-
getName
- Specified by:
getNamein interfaceICompressedLocalAndRemoteOutputStream
-
getUncompressedSize
public long getUncompressedSize()Returns uncompressed stream size, including all previous rotations- Specified by:
getUncompressedSizein interfaceICompressedLocalAndRemoteOutputStream- Returns:
- uncompressed stream size, including all previous rotations
-
getCompressedSize
public long getCompressedSize()Returns compressed stream size, including all previous rotations The compression rate for current file is estimated as 20x, to eliminate filesystem operation .length()- Specified by:
getCompressedSizein interfaceICompressedLocalAndRemoteOutputStream- Returns:
- compressed stream size, including all previous rotations
-
addListener
public void addListener(com.netcracker.profiler.io.listener.FileRotatedListener listener) - Specified by:
addListenerin interfaceICompressedLocalAndRemoteOutputStream
-
clearListeners
public void clearListeners()- Specified by:
clearListenersin interfaceICompressedLocalAndRemoteOutputStream
-
getListeners
- Specified by:
getListenersin interfaceICompressedLocalAndRemoteOutputStream
-
getCurrentFile
- Specified by:
getCurrentFilein interfaceICompressedLocalAndRemoteOutputStream
-
getDependentStream
- Specified by:
getDependentStreamin interfaceICompressedLocalAndRemoteOutputStream
-
setDependentStream
- Specified by:
setDependentStreamin interfaceICompressedLocalAndRemoteOutputStream
-
getState
- Specified by:
getStatein interfaceICompressedLocalAndRemoteOutputStream
-
setState
- Specified by:
setStatein interfaceICompressedLocalAndRemoteOutputStream
-