vsp
Class Server

java.lang.Object
  extended by java.lang.Thread
      extended by cz.zcu.fav.kiv.jsim.JSimProcess
          extended by vsp.Server
All Implemented Interfaces:
cz.zcu.fav.kiv.jsim.gui.JSimDisplayable, java.lang.Comparable<cz.zcu.fav.kiv.jsim.JSimProcess>, java.lang.Runnable

public class Server
extends cz.zcu.fav.kiv.jsim.JSimProcess

Server class

Author:
Jan Tichava

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
private  int counter
          Transactions counter
private  double cs
          Variation of the mean value
private  QueueWithServer queue
          Assigned queue
private  double transTq
          Real Tq
private  double ts
          Mean value
 
Fields inherited from class cz.zcu.fav.kiv.jsim.JSimProcess
INT_REQUESTS_TO_IGNORE, myParent
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Server(java.lang.String name, cz.zcu.fav.kiv.jsim.JSimSimulation simulation, double ts, double cs, QueueWithServer queue)
          Creates new server
 
Method Summary
 int getCounter()
          Get count of managed transactions
 double getTq()
          Get average Tq for one request
 double getTransTq()
          Get global Tq
protected  void life()
          In infinite loop: - checks if queue is not empty - waits time Ts with some Cs and then removes transaction from queue
 
Methods inherited from class cz.zcu.fav.kiv.jsim.JSimProcess
activate, activateNow, blockOnSemaphore, cancel, compareTo, copyToMessageClipboard, createDetailedInfoWindow, equals, error, getDetailedInformationArray, getMessageBox, getObjectListItemDescription, getParent, getPrivateLock, getProcessName, getProcessNumber, getProcessState, getProcessStateAsString, getReady, getSenderIAmWaitingFor, getScheduleTime, hasBeenStarted, hasEmptyMessageClipboard, hashCode, hold, isIdle, mainSwitchingRoutine, message, messageNoNL, passivate, reactivate, readFromClipboard, receiveMessageWithBlocking, receiveMessageWithBlocking, receiveMessageWithBlocking, receiveMessageWithBlocking, receiveMessageWithoutBlocking, receiveMessageWithoutBlocking, receiveMessageWithoutBlocking, receiveMessageWithoutBlocking, run, sendMessageWithBlocking, sendMessageWithBlocking, sendMessageWithBlocking, sendMessageWithoutBlocking, sendMessageWithoutBlocking, sendMessageWithoutBlocking, setProcessState, start, toString, unblockFromSemaphore, wait
 
Methods inherited from class java.lang.Thread
activeCount, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, checkAccess, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ts

private double ts
Mean value


cs

private double cs
Variation of the mean value


queue

private QueueWithServer queue
Assigned queue


counter

private int counter
Transactions counter


transTq

private double transTq
Real Tq

Constructor Detail

Server

public Server(java.lang.String name,
              cz.zcu.fav.kiv.jsim.JSimSimulation simulation,
              double ts,
              double cs,
              QueueWithServer queue)
       throws cz.zcu.fav.kiv.jsim.JSimSimulationAlreadyTerminatedException,
              cz.zcu.fav.kiv.jsim.JSimInvalidParametersException,
              cz.zcu.fav.kiv.jsim.JSimTooManyProcessesException
Creates new server

Parameters:
name - server name
simulation - simulation object
ts - defined Ts
cs - defined Cs
queue - assigned input queue
Throws:
cz.zcu.fav.kiv.jsim.JSimSimulationAlreadyTerminatedException
cz.zcu.fav.kiv.jsim.JSimInvalidParametersException
cz.zcu.fav.kiv.jsim.JSimTooManyProcessesException
Method Detail

life

protected void life()
In infinite loop: - checks if queue is not empty - waits time Ts with some Cs and then removes transaction from queue

Overrides:
life in class cz.zcu.fav.kiv.jsim.JSimProcess

getCounter

public int getCounter()
Get count of managed transactions

Returns:
the counter

getTransTq

public double getTransTq()
Get global Tq

Returns:
the transTq

getTq

public double getTq()
Get average Tq for one request

Returns:
Tq