public abstract class RatioWatcher
extends java.lang.Object
implements java.lang.Runnable
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<HostItem,java.lang.Double> |
cachePunishmentProbability |
protected boolean |
force |
protected boolean |
lock |
protected Logger |
logger |
(package private) static double |
punishmentFactor |
protected boolean |
stop |
protected java.lang.Thread |
thread |
protected long |
time |
protected HostItem |
tracker |
Constructor and Description |
---|
RatioWatcher(Logger logger,
long millis,
HostItem tracker)
Constructor
|
Modifier and Type | Method and Description |
---|---|
protected void |
clean()
Invalidate the cache by cleaning all hashmaps
|
protected abstract void |
closeTrackerSocket()
Closes tracker socket
|
protected abstract <T extends Payload> |
createProtocolP2PPacket(T payload)
Create packets
|
protected double |
getPunishmentProbability(HostItem application)
Get Up-ratio for an applications
|
protected abstract java.lang.Object |
getTrackerSocket()
Tracker socket getter
|
void |
run()
Runnable implementation
|
void |
setStop()
Ask the thread to stop
|
void |
setThread(java.lang.Thread thread)
Set thread
|
protected abstract void |
writeLog(java.lang.Exception e,
LogLevel logLevel)
Implementation of writeLog
|
protected abstract void |
writeLog(java.lang.String text,
LogLevel logLevel)
Implementation of writeLog
|
static final double punishmentFactor
protected Logger logger
protected volatile boolean stop
protected long time
protected boolean force
protected HostItem tracker
protected java.lang.Thread thread
protected java.util.Map<HostItem,java.lang.Double> cachePunishmentProbability
protected boolean lock
public void run()
run
in interface java.lang.Runnable
protected void clean() throws java.lang.InterruptedException
java.lang.InterruptedException
protected double getPunishmentProbability(HostItem application) throws InternalError, UnknownHost
application
- HostItem of the applicationUnknownHost
InternalError
public void setStop()
protected abstract void writeLog(java.lang.String text, LogLevel logLevel)
text
- Text to loglogLevel
- level of loggingprotected abstract void writeLog(java.lang.Exception e, LogLevel logLevel)
e
- exception to loglogLevel
- level of loggingpublic void setThread(java.lang.Thread thread)
thread
- Threadprotected abstract <T extends Payload> ProtocolP2PPacket<?> createProtocolP2PPacket(T payload)
payload
- Payloadprotected abstract java.lang.Object getTrackerSocket()
protected abstract void closeTrackerSocket()