|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
no.ntnu.item.router.ActionReasoner
public class ActionReasoner
This class will have an overview of the ServiceSession
objects
that have a target bit rate set. It will, based on this information
change parameters in the click router to facilitate the wanted effect.
It will continuously communicate with click and decide when to do what.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
private boolean |
listHasChanged
Indicates if the list has been changed since last configuration |
private java.util.List<ServiceSession> |
markedSessions
Holds the list of ServiceSession objects to monitor for |
private java.util.List<SessionHandlerInfo> |
sessionHandlerInfoList
Current string that is written to the Click handler file |
private java.util.List<ServiceSession> |
updatedSessions
list of ServiceSession to store updates before processing |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
ActionReasoner()
Constructor. |
Method Summary | |
---|---|
private java.lang.Boolean |
areListsEqual(java.util.List<SessionHandlerInfo> newList)
Will compare the given list with this.sessionHandlerInfoList Will determine if the lists are approximately equal. The reason we say approximately equal is that we allow some margins on ping. |
private void |
calculateClickHandlerChange()
This method will check all sessions. |
private void |
decrementClickTargetRate(ServiceSession session)
This method will decrement click target rate for a session. |
private void |
doListHasChangedRoutine()
A neat little method to clean and refactor the code. |
private java.util.List<SessionHandlerInfo> |
getNewListOfSessionHandlerInfo()
This method will based on the sessions in the markedSessions list generate a list of SessionHandlerInfo objects.These objects will represent the session information relevant to the handler |
private void |
increaseSessionRate(ServiceSession markedSession)
This method will increase the click target rate for a given session. |
private void |
incrementClickTargetRate(ServiceSession session)
This method will increment click target rate for a session. |
private boolean |
isTargetVideoBitrateChanged(ServiceSession markedSession)
Checks if the session has changed targetVideoBitrate since last time we read it. |
private void |
lowerSessionRate(ServiceSession session)
This method will tell click to lower the rate for this session |
void |
run()
The thread main method. |
private void |
setFirstLoweredClickTargetRate(ServiceSession session)
This method will set an initial click target value for a session. |
private java.lang.Boolean |
targetRateIsLowerThanCurrentRate(ServiceSession session)
Checks if the target rate is lower than the actual rate, ie if we need to inhibit it. |
private java.lang.Boolean |
targetRateIsMet(ServiceSession session)
Checks if a ServiceSession is downloading at its target rate |
void |
updateListOfMarkedSessions(java.util.List<ServiceSession> newList)
Update the ActionReasoner list of sessions. |
private void |
writeFile(java.lang.String filename,
java.lang.String text)
Takes a path and text as paramters. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private java.util.List<ServiceSession> markedSessions
ServiceSession
objects to monitor for
private java.util.List<ServiceSession> updatedSessions
ServiceSession
to store updates before processing
private boolean listHasChanged
private java.util.List<SessionHandlerInfo> sessionHandlerInfoList
Constructor Detail |
---|
public ActionReasoner()
Method Detail |
---|
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void updateListOfMarkedSessions(java.util.List<ServiceSession> newList)
ActionReasoner
list of sessions.
newList
- the updated listprivate void increaseSessionRate(ServiceSession markedSession)
markedSession
- to increase click rate forprivate void incrementClickTargetRate(ServiceSession session)
session
- to increment click target rate forprivate void lowerSessionRate(ServiceSession session)
session
- the session to slow downprivate void decrementClickTargetRate(ServiceSession session)
session
- to decrement click target rate forprivate void setFirstLoweredClickTargetRate(ServiceSession session)
session
- the session to set initial click target value forprivate java.lang.Boolean targetRateIsMet(ServiceSession session)
ServiceSession
is downloading at its target rate
session
- session to check for
private java.lang.Boolean targetRateIsLowerThanCurrentRate(ServiceSession session)
session
- session to check for
private void calculateClickHandlerChange()
private java.lang.Boolean areListsEqual(java.util.List<SessionHandlerInfo> newList)
newList
- the list to compare to this.sessionHandlerInfoList
private java.util.List<SessionHandlerInfo> getNewListOfSessionHandlerInfo()
SessionHandlerInfo
objects.
private void doListHasChangedRoutine()
private boolean isTargetVideoBitrateChanged(ServiceSession markedSession)
markedSession
- to retrieve oldTarget and Target from
private void writeFile(java.lang.String filename, java.lang.String text)
filename
- path to filetext
- String to write
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |