no.ntnu.item.router
Class ServiceSession

java.lang.Object
  extended by no.ntnu.item.router.ServiceSession

public class ServiceSession
extends java.lang.Object

Domain object that represents a service session known to the router.
It contains and maintains a List of SilverlightMeasurement objects belonging to this ServiceSession instance. A service session is in all simplicity the information collected from a video stream.

Author:
Kristian Haugene

Field Summary
private  java.lang.Integer clickTargetVideoBitRate
          The current target rate set to click, we adjust this independent of user pref
private  java.util.List<SilverlightMeasurement> measurements
          The List of SilverlightMeasurement objects from this service
private  java.lang.Integer oldTargetVideoBitRate
          Holds the old targetVideoBitRate, used by ActionReasoner to decide if it needs to reload click rate calculations
private  SessionPinger sessionPinger
          This is a separate thread that will obtain ping measurements for the stream
private  java.util.List<java.lang.String> sourceHostAddresses
          Holds the addresses our host can be
private  java.lang.Long targetRateSetTime
          For timing purposes, we want to know when the target rate was set
private  java.lang.Integer targetVideoBitRate
          Holds an integer set by the user, indicating if the user wants to affect it
 
Constructor Summary
ServiceSession()
          Constructor
 
Method Summary
 void addMeasurementToService(SilverlightMeasurement sm)
          Method for registering a SilverlightMeasurement to a service
 java.lang.Integer getClickTargetVideoBitRate()
           
 java.net.InetAddress getClientAddress()
          Public method to retrieve the Silverlight client IP address
 java.lang.String getId()
          A method that returns an identifier for this ServiceSession.
 SilverlightMeasurement getLatestMeasurement()
          Returns the latest measurement registered to this ServiceSession
 java.lang.Integer getLatestTimeIncrement()
          Returns the silverlight client runtime from the latest measurement
 java.util.List<SilverlightMeasurement> getMeasurements()
          Returns the current list of SilverlightMeasurement
 java.lang.Integer getOldTargetVideoBitRate()
           
 java.lang.Double getPing()
          This method calls the ping thread associated with this object and retrieves a ping
 java.util.List<java.lang.String> getSourceHostAddresses()
          Public method to retrieve the Silverlight media source IP addresses.
 java.lang.Long getTargetRateSetTime()
           
 java.lang.Integer getTargetVideoBitrate()
           
 void setClickTargetVideoBitRate(java.lang.Integer clickTargetVideoBitRate)
           
 void setOldTargetVideoBitRate(java.lang.Integer oldTargetVideoBitRate)
          Sets the oldTargetVideoBitrate for this session.
 void setTargetVideoBitrate(java.lang.Integer targetVideoBitrate)
          Sets the targetVideoBitrate for this session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

measurements

private java.util.List<SilverlightMeasurement> measurements
The List of SilverlightMeasurement objects from this service


targetVideoBitRate

private java.lang.Integer targetVideoBitRate
Holds an integer set by the user, indicating if the user wants to affect it


oldTargetVideoBitRate

private java.lang.Integer oldTargetVideoBitRate
Holds the old targetVideoBitRate, used by ActionReasoner to decide if it needs to reload click rate calculations


targetRateSetTime

private java.lang.Long targetRateSetTime
For timing purposes, we want to know when the target rate was set


clickTargetVideoBitRate

private java.lang.Integer clickTargetVideoBitRate
The current target rate set to click, we adjust this independent of user pref


sessionPinger

private SessionPinger sessionPinger
This is a separate thread that will obtain ping measurements for the stream


sourceHostAddresses

private java.util.List<java.lang.String> sourceHostAddresses
Holds the addresses our host can be

Constructor Detail

ServiceSession

public ServiceSession()
Constructor

Method Detail

getMeasurements

public java.util.List<SilverlightMeasurement> getMeasurements()
Returns the current list of SilverlightMeasurement


getLatestMeasurement

public SilverlightMeasurement getLatestMeasurement()
Returns the latest measurement registered to this ServiceSession


addMeasurementToService

public void addMeasurementToService(SilverlightMeasurement sm)
Method for registering a SilverlightMeasurement to a service


getPing

public java.lang.Double getPing()
This method calls the ping thread associated with this object and retrieves a ping

Returns:
ping in ms with 2 decimals from router to streaming server

getLatestTimeIncrement

public java.lang.Integer getLatestTimeIncrement()
Returns the silverlight client runtime from the latest measurement

Returns:
silverlight client runtime

getSourceHostAddresses

public java.util.List<java.lang.String> getSourceHostAddresses()
Public method to retrieve the Silverlight media source IP addresses. The server is set as a dns name that might resolve differently from time to time. Return all values it has resolved to.

Returns:
List of String IP entries host has resolved to

getClientAddress

public java.net.InetAddress getClientAddress()
Public method to retrieve the Silverlight client IP address

Returns:
the client IP retrieved from the latest SilverlightMeasurement

getId

public java.lang.String getId()
A method that returns an identifier for this ServiceSession. A session is a set of measurements from the same client. The clientId is therefore a unique identifier of a ServiceSession.


getTargetVideoBitrate

public java.lang.Integer getTargetVideoBitrate()

getOldTargetVideoBitRate

public java.lang.Integer getOldTargetVideoBitRate()

setTargetVideoBitrate

public void setTargetVideoBitrate(java.lang.Integer targetVideoBitrate)
Sets the targetVideoBitrate for this session. Also updates the targetRateSetTime field to the current system time.

Parameters:
targetVideoBitrate - the wanted target rate

setOldTargetVideoBitRate

public void setOldTargetVideoBitRate(java.lang.Integer oldTargetVideoBitRate)
Sets the oldTargetVideoBitrate for this session. Is used by ActionReasoner when it has read a new value and writes it here for further reference

Parameters:
oldTargetVideoBitRate - to store

getTargetRateSetTime

public java.lang.Long getTargetRateSetTime()

setClickTargetVideoBitRate

public void setClickTargetVideoBitRate(java.lang.Integer clickTargetVideoBitRate)

getClickTargetVideoBitRate

public java.lang.Integer getClickTargetVideoBitRate()