|
LimeWire Consolidated API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.limegroup.gnutella.altlocs.AbstractAlternateLocation
public abstract class AbstractAlternateLocation
Abstract super class that encompasses common functionality shared by most implementations
of AlternateLocation.
| Field Summary | |
|---|---|
protected int |
_count
maintins a count of how many times this alternate location has been seen. |
protected int |
hashCode
Cached hash code that is lazily initialized. |
protected URN |
SHA1_URN
Constant for the sha1 urn for this AlternateLocation -- can be null. |
| Fields inherited from interface com.limegroup.gnutella.altlocs.AlternateLocation |
|---|
ALT_VENDOR, MESH_LEGACY, MESH_PING, MESH_RESPONSE |
| Constructor Summary | |
|---|---|
protected |
AbstractAlternateLocation(URN sha1)
|
| Method Summary | |
|---|---|
boolean |
canBeSent(int meshType)
|
boolean |
canBeSentAny()
|
int |
compareTo(AlternateLocation other)
The idea is that this is smaller than any AlternateLocation who has a greater value of _count. |
abstract AlternateLocation |
createClone()
could return null |
abstract RemoteFileDesc |
createRemoteFileDesc(long size,
RemoteFileDescFactory remoteFileDescFactory)
Creates a new RemoteFileDesc from this AlternateLocation |
boolean |
equals(Object obj)
Overrides the equals method to accurately compare AlternateLocation instances. |
protected abstract String |
generateHTTPString()
|
int |
getCount()
Accessor to find if this has been demoted |
URN |
getSHA1Urn()
Accessor for the SHA1 urn for this AlternateLocation. |
int |
hashCode()
Overrides the hashCode method of Object to meet the contract of hashCode. |
String |
httpStringValue()
Returns a string representation of the HTTP header value for this class. |
void |
increment()
increment the count. |
abstract boolean |
isDemoted()
package access, accessor to the value of _demoted |
abstract boolean |
isMe()
|
void |
send(long now,
int meshType)
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final URN SHA1_URN
protected volatile int hashCode
protected volatile int _count
| Constructor Detail |
|---|
protected AbstractAlternateLocation(URN sha1)
| Method Detail |
|---|
public URN getSHA1Urn()
AlternateLocation
getSHA1Urn in interface AlternateLocationpublic int getCount()
AlternateLocation
getCount in interface AlternateLocationpublic abstract boolean isDemoted()
AlternateLocation
isDemoted in interface AlternateLocationpublic String httpStringValue()
HTTPHeaderValue
httpStringValue in interface HTTPHeaderValue
public abstract RemoteFileDesc createRemoteFileDesc(long size,
RemoteFileDescFactory remoteFileDescFactory)
AlternateLocation
createRemoteFileDesc in interface AlternateLocationsize - the size of the file for the new RemoteFileDesc
-- this is necessary to make sure the download bucketing works
correctly
public abstract boolean isMe()
isMe in interface AlternateLocationpublic void increment()
AlternateLocation
increment in interface AlternateLocationdemotepublic abstract AlternateLocation createClone()
AlternateLocation
createClone in interface AlternateLocation
public void send(long now,
int meshType)
send in interface AlternateLocationpublic boolean canBeSent(int meshType)
canBeSent in interface AlternateLocationpublic boolean canBeSentAny()
canBeSentAny in interface AlternateLocationpublic boolean equals(Object obj)
equals in class Objectobj - the Object instance to compare to
public int compareTo(AlternateLocation other)
This is because we want to have a sorted set of AlternateLocation where any demoted AlternateLocation is put at the end of the list because it probably does not work.
Further we want to get AlternateLocations with smaller counts to be propogated more, since this will serve to get better load balancing of uploader.
compareTo in interface Comparable<AlternateLocation>protected abstract String generateHTTPString()
public int hashCode()
hashCode in class Object
|
LimeWire Consolidated API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||