J - The type of SimJobs supported.Q - The type of SimQueues supported.P - The type used for QoS.public class HOL<J extends SimJob,Q extends HOL,P extends Comparable> extends AbstractSimQueueQoS<J,Q,P> implements SimQueueQoS<J,Q,P>
Copyright (C) 2005-2017 Jan de Jongh, TNO
This file is covered by the LICENSE file in the root of this project.
AbstractSimEntity.Notifier, AbstractSimEntity.PreNotificationHookSimQueue.AutoRevocationPolicySimEntity.Action, SimEntity.UnknownNotificationTypePolicy, SimEntity.UnknownOperationPolicy| Modifier and Type | Field and Description |
|---|---|
protected NavigableMap<P,Set<J>> |
jobsQoSMap |
eventsScheduled, SANITYUSE_ARRAY_OPTIMIZATION| Constructor and Description |
|---|
HOL(org.javades.jsimulation.r5.SimEventList eventList,
Class<P> qosClass,
P defaultJobQoS)
Creates a new
HOL. |
| Modifier and Type | Method and Description |
|---|---|
HOL<J,Q,P> |
getCopySimQueue()
Returns a new
HOL object on the same SimEventList with the same QoS structure. |
NavigableMap<P,Set<J>> |
getJobsQoSMap()
Gets the mapping QoS values onto jobs currently visiting this queue with that particular QoS value.
|
protected J |
getNextJobToServeInWaitingArea()
Gets the job in the waiting area that is next to serve.
|
protected double |
getServiceTimeForJob(J job)
Calls super method (in order to make implementation final).
|
protected void |
insertJobInQueueUponArrival(J job,
double time)
Inserts the job
jobsQoSMap. |
protected void |
insertJobInQueueUponStart(J job,
double time)
Performs sanity checks (only).
|
boolean |
isStartArmed()
Returns true if there are no jobs present in the service area.
|
protected void |
removeJobFromQueueUponDeparture(J departingJob,
double time)
Removes the departing job from
jobsQoSMap. |
protected void |
removeJobFromQueueUponDrop(J job,
double time)
Throws an
IllegalStateException because drops are unexpected. |
protected void |
removeJobFromQueueUponRevokation(J job,
double time,
boolean auto)
Removes the job from the internal data structures, and if needed, cancels a pending departure event.
|
protected void |
rescheduleAfterArrival(J job,
double time)
Starts the arrived job if server-access credits are available and if there are no jobs in the service area.
|
protected void |
rescheduleAfterDeparture(J departedJob,
double time)
Starts the next job in the waiting area (if available) if server-access credits are available.
|
protected void |
rescheduleAfterDrop(J job,
double time)
Throws an
IllegalStateException because drops are unexpected. |
protected void |
rescheduleAfterRevokation(J job,
double time,
boolean auto)
Starts the next job in the waiting area if server-access credits are available and if there are no jobs in the service area.
|
protected void |
rescheduleAfterStart(J job,
double time)
Depending on the job's requested service time, makes it depart immediately, or schedules a suitable departure event.
|
protected void |
rescheduleDepartureEvent()
Reschedules the single departure event for this queue.
|
protected void |
rescheduleForNewServerAccessCredits(double time)
Starts the next job in the waiting area if there are no jobs in the service area.
|
protected void |
resetEntitySubClass()
Calls super method and clears
jobsQoSMap. |
protected void |
setServerAccessCreditsSubClass()
Calls super method (in order to make implementation final).
|
String |
toStringDefault()
Returns "HOL".
|
getDefaultJobQoS, getQoS, getQoSClass, queueAccessVacationDropSubClass, setQoS, setQoSClassarrive, autoRevoke, cancelDepartureEvent, cancelDepartureEvent, depart, departureFromEventList, drop, getAutoRevocationPolicy, getDepartureEvents, getDepartureEvents, getFirstJob, getFirstJobInServiceArea, getFirstJobInWaitingArea, getJobs, getJobsInServiceArea, getJobsInWaitingArea, getNumberOfJobs, getNumberOfJobsInServiceArea, getNumberOfJobsInWaitingArea, getServerAccessCredits, hasJobs, hasJobsInServiceArea, hasJobsInWaitingArea, hasServerAcccessCredits, isJob, isJobInServiceArea, isJobInWaitingArea, isQueueAccessVacation, registerStdOutSimQueueListener, revoke, revoke, scheduleDepartureEvent, scheduleJobArrival, setAutoRevocationPolicy, setQueueAccessVacation, setServerAccessCredits, start, takeServerAccessCredit, triggerPotentialNewStartArmed, unregisterStdOutSimQueueListeneraddPendingNotification, addPendingNotification, clearAndUnlockPendingNotificationsIfLocked, delegateOperation, doAfterNotifications, doOperation, fireAndLockPendingNotifications, getEventList, getLastUpdateTime, getRegisteredDelegatedOperations, getRegisteredNotificationTypes, getRegisteredOperations, getSimEntityListeners, getUnknownNotificationTypePolicy, getUnknownOperationPolicy, isIgnoreEventListReset, notifyEventListReset, registerDelegatedOperation, registerNotificationType, registerOperation, registerPreEventHook, registerPreNotificationHook, registerPreUpdateHook, registerSimEntityListener, registerStdOutSimEntityListener, removeDelegationForOperation, resetEntity, setIgnoreEventListReset, setName, setUnknownNotificationTypePolicy, setUnknownOperationPolicy, toString, unregisterSimEntityListener, unregisterStdOutSimEntityListener, updateclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetDefaultJobQoSgetQoS, getQoSClass, setQoS, setQoSClassarrive, getAutoRevocationPolicy, getJobs, getJobsInServiceArea, getJobsInWaitingArea, getNumberOfJobs, getNumberOfJobsInServiceArea, getNumberOfJobsInWaitingArea, getServerAccessCredits, isJob, isJobInServiceArea, isJobInWaitingArea, isQueueAccessVacation, revoke, revoke, setAutoRevocationPolicy, setQueueAccessVacation, setServerAccessCreditsdoAfterNotifications, doOperation, getEventList, getLastUpdateTime, getRegisteredNotificationTypes, getRegisteredOperations, getSimEntityListeners, getUnknownNotificationTypePolicy, getUnknownOperationPolicy, isIgnoreEventListReset, registerSimEntityListener, resetEntity, setIgnoreEventListReset, setName, setUnknownNotificationTypePolicy, setUnknownOperationPolicy, unregisterSimEntityListener, updateprotected final NavigableMap<P extends Comparable,Set<J extends SimJob>> jobsQoSMap
public HOL(org.javades.jsimulation.r5.SimEventList eventList,
Class<P> qosClass,
P defaultJobQoS)
HOL.eventList - The event list to use, non-null.qosClass - The Java class to use for QoS behavior, non-null.defaultJobQoS - The default QoS value to use for non-QoS jobs, non-null.IllegalArgumentException - If any of the arguments is null.public HOL<J,Q,P> getCopySimQueue() throws UnsupportedOperationException
HOL object on the same SimEventList with the same QoS structure.getCopySimQueue in interface SimQueue<J extends SimJob,Q extends HOL>getCopySimQueue in interface SimQueueQoS<J extends SimJob,Q extends HOL,P extends Comparable>HOL object on the same SimEventList with the same QoS structure.UnsupportedOperationException - If the operation is not supported (yet); this should be considered a software error.AbstractSimEntity.getEventList(),
AbstractSimQueueQoS.getQoSClass(),
AbstractSimQueueQoS.getDefaultJobQoS()public String toStringDefault()
toStringDefault in interface SimEntitytoStringDefault in class AbstractSimQueue<J extends SimJob,Q extends HOL>SimEntity.setName(java.lang.String),
Object.toString()public final NavigableMap<P,Set<J>> getJobsQoSMap()
SimQueueQoS
Each SimJob present returning (valid) non-null QoS value from SimQoS.getQoS()
must be in present in only that value set,
and the union of these value sets must exactly match SimQueue.getJobs().
Jobs returning null from SimQoS.getQoS() must be put in a value set corresponding to
SimQueueQoS.getDefaultJobQoS().
Note that many concrete subclasses will impose an ordering on the keys and/or on the value sets.
getJobsQoSMap in interface SimQueueQoS<J extends SimJob,Q extends HOL,P extends Comparable>SimQueue.getJobs(),
SimQoS.getQoS(),
SimQueueQoS.getDefaultJobQoS()protected final J getNextJobToServeInWaitingArea()
Iterates over the job sets in increasing order of QoS value,
and iterates over the jobs within each set in order as enforced by the standard Java Set iterator,
and returns the first job it finds that is not in the service area.
This method does (some) sanity checks on jobsQoSMap on the fly.
null if there are no waiting jobs.IllegalStateException - If the jobsQoSMap is in an illegal state.jobsQoSMap,
AbstractSimQueue.isJob(org.javades.jqueues.r5.entity.jq.job.SimJob),
AbstractSimQueue.isJobInServiceArea(org.javades.jqueues.r5.entity.jq.job.SimJob)protected final void resetEntitySubClass()
jobsQoSMap.resetEntitySubClass in class AbstractSimQueueQoS<J extends SimJob,Q extends HOL,P extends Comparable>jobsQoSMapprotected final void insertJobInQueueUponArrival(J job, double time)
jobsQoSMap.insertJobInQueueUponArrival in class AbstractSimQueue<J extends SimJob,Q extends HOL>job - The job that arrived.time - The current time (i.e., arrival time of the job).SimQueueQoSUtils.getAndCheckJobQoS(J, Q)protected final void rescheduleAfterArrival(J job, double time)
rescheduleAfterArrival in class AbstractSimQueue<J extends SimJob,Q extends HOL>job - The job that arrived (and is already present in AbstractSimQueue.getJobs()).time - The current time (i.e., the arrival time of the job).AbstractSimQueue.hasServerAcccessCredits(),
AbstractSimQueue.hasJobsInServiceArea(),
AbstractSimQueue.start(double, J)protected final void removeJobFromQueueUponDrop(J job, double time)
IllegalStateException because drops are unexpected.removeJobFromQueueUponDrop in class AbstractSimQueue<J extends SimJob,Q extends HOL>job - The job that is to be dropped.time - The current time (i.e., drop time of the job).IllegalStateException - Always.AbstractSimQueue.drop(J, double),
AbstractSimQueue.rescheduleAfterDrop(J, double)protected final void rescheduleAfterDrop(J job, double time)
IllegalStateException because drops are unexpected.rescheduleAfterDrop in class AbstractSimQueue<J extends SimJob,Q extends HOL>job - The jobs that was dropped.time - The current time (i.e., drop time of the job).IllegalStateException - Always.AbstractSimQueue.drop(J, double),
AbstractSimQueue.removeJobFromQueueUponDrop(J, double)protected final void removeJobFromQueueUponRevokation(J job, double time, boolean auto)
If the job is in service, its departure event is canceled through AbstractSimQueue.cancelDepartureEvent(org.javades.jqueues.r5.entity.jq.SimJQEvent.Departure<J, Q>).
Subsequently, whether the job was in service or not,
it is removed from jobsQoSMap.
removeJobFromQueueUponRevokation in class AbstractSimQueue<J extends SimJob,Q extends HOL>job - The job that is to be revoked.time - The current time (i.e., revocation time of the job).auto - Whether or not this applies to an auto-revocation.AbstractSimQueue.cancelDepartureEvent(org.javades.jqueues.r5.entity.jq.SimJQEvent.Departure<J, Q>),
jobsQoSMapprotected final void rescheduleAfterRevokation(J job, double time, boolean auto)
rescheduleAfterRevokation in class AbstractSimQueue<J extends SimJob,Q extends HOL>job - The jobs that was successfully revoked.time - The current time (i.e., revocation time of the job).auto - Whether or not this applies to an auto-revocation.AbstractSimQueue.hasServerAcccessCredits(),
AbstractSimQueue.hasJobsInWaitingArea(),
AbstractSimQueue.getNumberOfJobsInServiceArea(),
AbstractSimQueue.start(double, J),
getNextJobToServeInWaitingArea()protected final void setServerAccessCreditsSubClass()
setServerAccessCreditsSubClass in class AbstractSimQueue<J extends SimJob,Q extends HOL>AbstractSimQueue.getServerAccessCredits(),
AbstractSimQueue.setServerAccessCredits(double, int),
AbstractSimQueue.rescheduleForNewServerAccessCredits(double)protected final void rescheduleForNewServerAccessCredits(double time)
rescheduleForNewServerAccessCredits in class AbstractSimQueue<J extends SimJob,Q extends HOL>time - The current time (i.e., the time at which new server-access credits became available).AbstractSimQueue.hasJobsInWaitingArea(),
AbstractSimQueue.getNumberOfJobsInServiceArea(),
AbstractSimQueue.start(double, J)public final boolean isStartArmed()
isStartArmed in interface SimQueue<J extends SimJob,Q extends HOL>AbstractSimQueue.getNumberOfJobsInServiceArea()protected final void insertJobInQueueUponStart(J job, double time)
insertJobInQueueUponStart in class AbstractSimQueue<J extends SimJob,Q extends HOL>job - The job that starts.time - The current time (i.e., start time of the job).AbstractSimQueue.start(double, J),
AbstractSimQueue.rescheduleAfterStart(J, double)protected final void rescheduleAfterStart(J job, double time)
Performs sanity checks on the fly (job present; job not yet started; requested service time zero or positive).
The time argument must match the result from AbstractSimEntity.getLastUpdateTime() (and is thus only present for sanity checking).
If a job has infinite requested service time, it will start but never depart, even if the start is scheduled at positive or negative infinity.
With zero requested service time, a job departs immediately. This is also the case if the start is at positive or negative infinity AND the job has finite requested service time.
In all other cases, a suitable departure event is scheduled through rescheduleDepartureEvent().
Caveat: the specification above implies that NOT all jobs in the service area will have a departure event scheduled for them!
rescheduleAfterStart in class AbstractSimQueue<J extends SimJob,Q extends HOL>job - The job that started (and is already present in AbstractSimQueue.getJobsInServiceArea().time - The current time (i.e., the start time of the job).getServiceTimeForJob(J),
rescheduleDepartureEvent(),
AbstractSimQueue.depart(double, J)protected final double getServiceTimeForJob(J job)
getServiceTimeForJob in class AbstractSimQueue<J extends SimJob,Q extends HOL>job - The job, non-null.protected final void removeJobFromQueueUponDeparture(J departingJob, double time)
jobsQoSMap.removeJobFromQueueUponDeparture in class AbstractSimQueue<J extends SimJob,Q extends HOL>departingJob - The job that departs.time - The departure (current) time.IllegalStateException - If the job is not in the map.jobsQoSMapprotected final void rescheduleAfterDeparture(J departedJob, double time)
rescheduleAfterDeparture in class AbstractSimQueue<J extends SimJob,Q extends HOL>departedJob - The departed job.time - The departure (current) time.IllegalStateException - If there are jobs in the service area (i.e., being served).AbstractSimQueue.hasJobsInServiceArea(),
AbstractSimQueue.hasServerAcccessCredits(),
AbstractSimQueue.hasJobsInWaitingArea(),
AbstractSimQueue.start(double, J),
getNextJobToServeInWaitingArea()protected final void rescheduleDepartureEvent()
Cancels a pending departure event and schedules the first job in the service area for departure (if ever).
If the job has infinite requested service time, this method does nothing, even if the start is scheduled at positive or negative infinity.
With zero requested service time, the job departs immediately.
This is also the case if time (AbstractSimEntity.getLastUpdateTime()) is at positive or negative infinity
AND the job has finite requested service time.
In all other cases, a suitable departure event is scheduled through rescheduleDepartureEvent().
AbstractSimQueue.getDepartureEvents(),
AbstractSimQueue.cancelDepartureEvent(org.javades.jqueues.r5.entity.jq.SimJQEvent.Departure<J, Q>),
AbstractSimQueue.jobsInServiceArea,
AbstractSimQueue.getFirstJobInServiceArea(),
getServiceTimeForJob(J),
AbstractSimEntity.getLastUpdateTime(),
AbstractSimQueue.scheduleDepartureEvent(double, J),
AbstractSimQueue.depart(double, J),
AbstractSimEntity.getLastUpdateTime()Copyright © 2018. All rights reserved.