Methods Summary |
---|
public void | cancel()
cancelled = true;
|
public boolean | equals(java.lang.Object o)We override the equals method
2 requests are equals if
all their bt fields (piece number, offset, length) are equal
if(! (o instanceof DiskManagerReadRequestImpl))
return false;
DiskManagerReadRequestImpl otherRequest = (DiskManagerReadRequestImpl) o;
if(otherRequest.pieceNumber != this.pieceNumber)
return false;
if(otherRequest.offset != this.offset)
return false;
if(otherRequest.length != this.length)
return false;
return true;
|
public boolean | getFlush()
return( flush );
|
public int | getLength()
return this.length;
|
protected java.lang.String | getName()
return( "Read: " + pieceNumber + ",off=" + offset +",len=" + length + ",fl=" + flush + ",uc=" + use_cache );
|
public int | getOffset()
return this.offset;
|
public int | getPieceNumber()
return this.pieceNumber;
|
public long | getTimeCreated(long now)
if (this.timeCreated >now)
this.timeCreated =now;
return this.timeCreated;
|
public boolean | getUseCache()
return( use_cache );
|
public int | hashCode()
return hashcode;
|
public boolean | isCancelled()
return( cancelled );
|
public boolean | isExpired()Method to determine if a Request has expired
final long now =SystemTime.getCurrentTime();
if (now >=this.timeCreated)
return (now -this.timeCreated) >EXPIRATION_TIME;
//time error
this.timeCreated =now;
return false;
|
public void | reSetTime(long 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.
timeCreated =now;
|
public void | resetTime(long now)
reSetTime(now);
|
public void | setFlush(boolean _flush)
flush = _flush;
|
public void | setUseCache(boolean cache)
use_cache = cache;
|