Class DiskManagerReadRequestImpl
java.lang.Object
com.biglybt.core.disk.impl.access.impl.DiskManagerRequestImpl
com.biglybt.core.disk.impl.access.impl.DiskManagerReadRequestImpl
- All Implemented Interfaces:
DiskManagerReadRequest, DiskManagerRequest, PeerReadRequest
public class DiskManagerReadRequestImpl
extends DiskManagerRequestImpl
implements DiskManagerReadRequest
This class represents a Bittorrent Request.
and a time stamp to know when it was created.
Request may expire after some time, which is used to determine who is snubbed.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate static final intprivate booleanprivate final intprivate booleanprivate final intprivate final intprivate final intprivate longprivate longprivate booleanFields inherited from class DiskManagerRequestImpl
DEBUGFields inherited from interface PeerReadRequest
NORMAL_REQUEST_SIZE -
Constructor Summary
ConstructorsConstructorDescriptionDiskManagerReadRequestImpl(int _pieceNumber, int _offset, int _length) Parameters correspond to bittorrent parameters -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()booleanWe override the equals method 2 requests are equals if all their bt fields (piece number, offset, length) are equalbooleangetFlush()intprotected StringgetName()intintlonglongbooleaninthashCode()booleanbooleanMethod to determine if a Request has expiredbooleanvoidresetTimeMono(long mono_now) Allow some more time to the request.voidsetFlush(boolean _flush) If flush is set then data held in memory will be flushed to disk during the read operationvoidvoidsetTimeSent(long time) voidsetUseCache(boolean cache) Methods inherited from class DiskManagerRequestImpl
getErrorIsFatal, requestEnds, requestStarts, setErrorIsFatalMethods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface DiskManagerRequest
getErrorIsFatal, requestEnds, requestStarts, setErrorIsFatal
-
Field Details
-
EXPIRATION_TIME
private static final int EXPIRATION_TIME- See Also:
-
pieceNumber
private final int pieceNumber -
offset
private final int offset -
length
private final int length -
hashcode
private final int hashcode -
timeCreatedMono
private long timeCreatedMono -
timeSent
private long timeSent -
flush
private boolean flush -
cancelled
private boolean cancelled -
use_cache
private boolean use_cache -
latency_test
private boolean latency_test
-
-
Constructor Details
-
DiskManagerReadRequestImpl
public DiskManagerReadRequestImpl(int _pieceNumber, int _offset, int _length) Parameters correspond to bittorrent parameters- Parameters:
pieceNumber-offset-length-
-
-
Method Details
-
getName
- Specified by:
getNamein classDiskManagerRequestImpl
-
isExpired
public boolean isExpired()Method to determine if a Request has expired- Specified by:
isExpiredin interfacePeerReadRequest- Returns:
- true if the request is expired
-
resetTimeMono
public void resetTimeMono(long mono_now) Allow some more time to the request. Typically used on peers that have just sent some data, we reset all other requests to give them extra time.- Specified by:
resetTimeMonoin interfacePeerReadRequest
-
getPieceNumber
public int getPieceNumber()- Specified by:
getPieceNumberin interfaceDiskManagerReadRequest- Specified by:
getPieceNumberin interfacePeerReadRequest
-
getOffset
public int getOffset()- Specified by:
getOffsetin interfaceDiskManagerReadRequest- Specified by:
getOffsetin interfacePeerReadRequest
-
getLength
public int getLength()- Specified by:
getLengthin interfaceDiskManagerReadRequest- Specified by:
getLengthin interfacePeerReadRequest
-
setFlush
public void setFlush(boolean _flush) Description copied from interface:DiskManagerReadRequestIf flush is set then data held in memory will be flushed to disk during the read operation- Specified by:
setFlushin interfaceDiskManagerReadRequest- Parameters:
_flush-
-
getFlush
public boolean getFlush()- Specified by:
getFlushin interfaceDiskManagerReadRequest
-
setUseCache
public void setUseCache(boolean cache) - Specified by:
setUseCachein interfaceDiskManagerReadRequest
-
getUseCache
public boolean getUseCache()- Specified by:
getUseCachein interfaceDiskManagerReadRequest
-
cancel
public void cancel()- Specified by:
cancelin interfacePeerReadRequest
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin interfacePeerReadRequest
-
equals
We override the equals method 2 requests are equals if all their bt fields (piece number, offset, length) are equal- Specified by:
equalsin interfaceDiskManagerReadRequest- Overrides:
equalsin classObject
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceDiskManagerReadRequest- Overrides:
hashCodein classObject
-
getTimeCreatedMono
public long getTimeCreatedMono()- Specified by:
getTimeCreatedMonoin interfaceDiskManagerReadRequest
-
setTimeSent
public void setTimeSent(long time) - Specified by:
setTimeSentin interfaceDiskManagerReadRequest
-
getTimeSent
public long getTimeSent()- Specified by:
getTimeSentin interfaceDiskManagerReadRequest
-
setLatencyTest
public void setLatencyTest()- Specified by:
setLatencyTestin interfaceDiskManagerReadRequest
-
isLatencyTest
public boolean isLatencyTest()- Specified by:
isLatencyTestin interfaceDiskManagerReadRequest
-