DJ - The delegate-job type.DQ - The queue-type for delegate jobs.J - The job type.Q - The queue type for jobs.public class EncTL<DJ extends SimJob,DQ extends SimQueue,J extends SimJob,Q extends Enc> extends AbstractEncapsulatorSimQueue<DJ,DQ,J,Q>
SimQueueComposite encapsulating a single SimQueue
equipped with fixed expiration limits on waiting time, service time and sojourn time.
This composite queue mimics (precisely) the SimQueue interface of the encapsulated queue,
yet "removes" real jobs if their waiting, service of sojourn time exceeds a given, fixed limit.
On the encapsulated queue, the delegate job is removed through SimQueue.revoke(double, J, boolean).
By default, real jobs for which its waiting, service or sojourn time expires will depart,
and in that sense, cannot be distinguished from regular departures on the encapsulated queue.
However, one can control this behavior through EncTL.ExpirationMethod and setExprirationMethod(org.javades.jqueues.r5.entity.jq.queue.composite.enc.EncTL.ExpirationMethod).
The semantics of either expiration time being zero are a bit tricky, but in essence, the encapsulated queue takes precedence.
In other words, setting an expiration time to zero, does not (always) enforce
the applicable expiration events to take place.
For instance, if the encapsulated queue takes a job into service immediately upon arrival (like PS does),
maxWaitingTime = 0 has no effect, i.e., no revocation (due to expiration) takes place.
However, setting an expiration time to Double.POSITIVE_INFINITY is legal,
and effectively disables monitoring that particular (waiting/service/sojourn) time on the encapsulated queue.
Refer to AbstractEncapsulatorSimQueue,
AbstractSimQueueComposite
and SimQueueComposite
for more details on encapsulated queues.
Copyright (C) 2005-2017 Jan de Jongh, TNO
This file is covered by the LICENSE file in the root of this project.
SimQueueComposite,
Enc,
EncJL| Modifier and Type | Class and Description |
|---|---|
static class |
EncTL.ExpirationMethod
The method for "presenting" jobs for which a time expires at the composite (this) queue.
|
AbstractSimQueueComposite.RealDelegateJobMapper<J extends SimJob,DJ extends SimJob>AbstractSimEntity.Notifier, AbstractSimEntity.PreNotificationHookSimQueue.AutoRevocationPolicySimEntity.Action, SimEntity.UnknownNotificationTypePolicy, SimEntity.UnknownOperationPolicyrealDelegateJobMappereventsScheduled, SANITYUSE_ARRAY_OPTIMIZATION| Constructor and Description |
|---|
EncTL(org.javades.jsimulation.r5.SimEventList eventList,
DQ queue,
DelegateSimJobFactory delegateSimJobFactory,
double maxWaitingTime,
double maxServiceTime,
double maxSojournTime)
Creates an encapsulator queue given an event list and a queue and limits on waiting time, service time and sojourn time.
|
| Modifier and Type | Method and Description |
|---|---|
EncTL<DJ,DQ,J,Q> |
getCopySimQueue()
Returns a new
EncTL object on the same SimEventList with a copy of the encapsulated
queue, the same delegate-job factory, equal respective expiration times, and the same expiration method. |
EncTL.ExpirationMethod |
getExprirationMethod()
Returns the expiration method.
|
double |
getMaxServiceTime()
Returns the maximum service time.
|
double |
getMaxSojournTime()
Returns the maximum sojourn time.
|
double |
getMaxWaitingTime()
Returns the maximum waiting time.
|
Object |
getQoS()
Calls super method (in order to make implementation final).
|
Class |
getQoSClass()
Calls super method (in order to make implementation final).
|
protected double |
getServiceTimeForJob(J job)
Calls super method (in order to make implementation final).
|
protected void |
insertJobInQueueUponArrival(J job,
double time)
Calls super method and inserts the job in the local administration.
|
protected void |
insertJobInQueueUponStart(J job,
double time)
Calls super method and performs sanity checks.
|
boolean |
isStartArmed()
Calls super method (in order to make implementation final).
|
protected void |
processSubQueueNotifications(List<MultiSimQueueNotificationProcessor.Notification<DJ,DQ>> notifications)
Calls super method (in order to make implementation final).
|
protected void |
queueAccessVacationDropSubClass(double time,
J job)
Calls super method (in order to make implementation final).
|
protected void |
removeJobFromQueueUponDeparture(J departingJob,
double time)
Removes the job from the local administration and calls super method.
|
protected void |
removeJobFromQueueUponDrop(J job,
double time)
Removes the job from the local administration and calls super method.
|
protected void |
removeJobFromQueueUponRevokation(J job,
double time,
boolean auto)
Removes the job from the local administration and calls super method.
|
protected void |
rescheduleAfterArrival(J job,
double time)
Assesses the expiration settings for the newly arrived job,
and either makes it exit or reschedules the expiration event and calls super method.
|
protected void |
rescheduleAfterDeparture(J departedJob,
double time)
Calls super method and reschedules the expiration event if needed.
|
protected void |
rescheduleAfterDrop(J job,
double time)
Calls super method and reschedules the expiration event if needed.
|
protected void |
rescheduleAfterRevokation(J job,
double time,
boolean auto)
Calls super method and reschedules the expiration event if needed.
|
protected void |
rescheduleAfterStart(J job,
double time)
Calls super method and assesses the expiration settings for the newly started job,
and either makes it exit when necessary; always reschedules the expiration event.
|
protected void |
rescheduleForNewServerAccessCredits(double time)
Calls super method (in order to make implementation final).
|
protected void |
resetEntitySubClass()
Calls super method and resets the internal administration.
|
void |
setExprirationMethod(EncTL.ExpirationMethod exprirationMethod)
Sets the expiration method.
|
protected void |
setServerAccessCreditsSubClass()
Calls super method (in order to make implementation final).
|
String |
toStringDefault()
Returns "EncTL(maxWai,maxSer,maxSoj)[encapsulated queue]".
|
getEncapsulatedQueueaddRealJobLocal, getCopySimQueues, getCopySubSimQueues, getDelegateJob, getDelegateJobMild, getDelegateSimJobFactory, getIndex, getIndex, getQueue, getQueue, getQueues, getRealJob, getRealJob, getSimQueueSelector, isDelegateJob, isRealJob, notifyResetEntity, notifyStateChanged, notifyUpdate, removeJobsFromQueueLocal, resetSimQueueSelector, selectFirstQueue, selectNextQueue, setDelegateSimJobFactoryarrive, 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, waitarrive, 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, updatepublic EncTL(org.javades.jsimulation.r5.SimEventList eventList,
DQ queue,
DelegateSimJobFactory delegateSimJobFactory,
double maxWaitingTime,
double maxServiceTime,
double maxSojournTime)
The constructor sets the EncTL.ExpirationMethod to EncTL.ExpirationMethod.DEPARTURE.
eventList - The event list to use.queue - The encapsulated queue.delegateSimJobFactory - An optional factory for the delegate SimJobs.maxWaitingTime - The maximum waiting time, non-negative, Double.POSITIVE_INFINITY is allowed.maxServiceTime - The maximum service time, non-negative, Double.POSITIVE_INFINITY is allowed.maxSojournTime - The maximum sojourn time, non-negative, Double.POSITIVE_INFINITY is allowed.IllegalArgumentException - If the event list or the queue is null,
or any of the time arguments is strictly negative.DelegateSimJobFactory,
DefaultDelegateSimJobFactorypublic EncTL<DJ,DQ,J,Q> getCopySimQueue()
EncTL object on the same SimEventList with a copy of the encapsulated
queue, the same delegate-job factory, equal respective expiration times, and the same expiration method.EncTL object on the same SimEventList with a copy of the encapsulated
queue, the same delegate-job factory, equal respective expiration times, and the same expiration method.UnsupportedOperationException - If the encapsulated queue could not be copied through SimQueue.getCopySimQueue().AbstractSimEntity.getEventList(),
AbstractEncapsulatorSimQueue.getEncapsulatedQueue(),
AbstractSimQueueComposite.getDelegateSimJobFactory(),
getMaxWaitingTime(),
getMaxServiceTime(),
getMaxSojournTime(),
getExprirationMethod(),
setExprirationMethod(org.javades.jqueues.r5.entity.jq.queue.composite.enc.EncTL.ExpirationMethod)public String toStringDefault()
toStringDefault in interface SimEntitytoStringDefault in class AbstractSimQueue<J extends SimJob,Q extends Enc>AbstractEncapsulatorSimQueue.getEncapsulatedQueue(),
getMaxWaitingTime(),
getMaxServiceTime(),
getMaxSojournTime()public final EncTL.ExpirationMethod getExprirationMethod()
null.EncTL.ExpirationMethodpublic final void setExprirationMethod(EncTL.ExpirationMethod exprirationMethod)
exprirationMethod - The new expiration method, non-null.IllegalArgumentException - If the method is null.EncTL.ExpirationMethodpublic final double getMaxWaitingTime()
Setting this maximum to Double.POSITIVE_INFINITY effectively disables (the applicable) expirations.
Double.POSITIVE_INFINITY are allowed.public final double getMaxServiceTime()
Setting this maximum to Double.POSITIVE_INFINITY effectively disables (the applicable) expirations.
Double.POSITIVE_INFINITY are allowed.public final double getMaxSojournTime()
Setting this maximum to Double.POSITIVE_INFINITY effectively disables (the applicable) expirations.
Double.POSITIVE_INFINITY are allowed.public final Object getQoS()
public final Class getQoSClass()
protected final void resetEntitySubClass()
resetEntitySubClass in class AbstractEncapsulatorSimQueue<DJ extends SimJob,DQ extends SimQueue,J extends SimJob,Q extends Enc>AbstractSimQueue.removeJobFromQueueUponRevokation(J, double, boolean),
AbstractSimQueue.rescheduleAfterRevokation(J, double, boolean),
SimEntity.resetEntity(),
SimQueueSelector.resetSimQueueSelector(),
SimQueue.setServerAccessCredits(double, int),
SimQueue.isStartArmed()protected final void queueAccessVacationDropSubClass(double time,
J job)
queueAccessVacationDropSubClass in class AbstractSimQueue<J extends SimJob,Q extends Enc>time - The time the job was dropped, i.e., the current time.job - The dropped job.AbstractSimQueue.arrive(double, J),
AbstractSimQueue.setQueueAccessVacation(double, boolean)protected final void insertJobInQueueUponArrival(J job, double time)
insertJobInQueueUponArrival in class AbstractEncapsulatorSimQueue<DJ extends SimJob,DQ extends SimQueue,J extends SimJob,Q extends Enc>job - The job that arrived.time - The current time (i.e., arrival time of the job).AbstractSimQueueComposite.addRealJobLocal(J),
AbstractEncapsulatorSimQueue.rescheduleAfterArrival(J, double)protected final void rescheduleAfterArrival(J job, double time)
rescheduleAfterArrival in class AbstractEncapsulatorSimQueue<DJ extends SimJob,DQ extends SimQueue,J extends SimJob,Q extends Enc>job - The job that arrived (and is already present in AbstractSimQueue.getJobs()).time - The current time (i.e., the arrival time of the job).SimQueue.arrive(double, J),
AbstractEncapsulatorSimQueue.insertJobInQueueUponArrival(J, double)protected final void removeJobFromQueueUponDrop(J job, double time)
removeJobFromQueueUponDrop in class AbstractEncapsulatorSimQueue<DJ extends SimJob,DQ extends SimQueue,J extends SimJob,Q extends Enc>job - The job that is to be dropped.time - The current time (i.e., drop time of the job).AbstractSimQueue.drop(J, double),
AbstractEncapsulatorSimQueue.rescheduleAfterDrop(J, double),
AbstractEncapsulatorSimQueue.removeJobFromQueueUponRevokation(J, double, boolean),
AbstractSimQueueComposite.removeJobsFromQueueLocal(J, DJ),
AbstractSimQueueComposite.getDelegateJob(SimJob),
SimJob.getQueue()protected final void rescheduleAfterDrop(J job, double time)
rescheduleAfterDrop in class AbstractEncapsulatorSimQueue<DJ extends SimJob,DQ extends SimQueue,J extends SimJob,Q extends Enc>job - The jobs that was dropped.time - The current time (i.e., drop time of the job).AbstractEncapsulatorSimQueue.removeJobFromQueueUponDrop(J, double),
AbstractEncapsulatorSimQueue.rescheduleAfterRevokation(J, double, boolean)protected final void removeJobFromQueueUponRevokation(J job, double time, boolean auto)
removeJobFromQueueUponRevokation in class AbstractEncapsulatorSimQueue<DJ extends SimJob,DQ extends SimQueue,J extends SimJob,Q extends Enc>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.revoke(double, J, boolean),
AbstractSimQueue.autoRevoke(double, J),
SimJQEvent.Revocation,
AbstractEncapsulatorSimQueue.rescheduleAfterRevokation(J, double, boolean),
AbstractSimQueueComposite.getDelegateJob(SimJob),
SimJob.getQueue(),
AbstractSimQueueComposite.removeJobsFromQueueLocal(J, DJ)protected final void rescheduleAfterRevokation(J job, double time, boolean auto)
rescheduleAfterRevokation in class AbstractEncapsulatorSimQueue<DJ extends SimJob,DQ extends SimQueue,J extends SimJob,Q extends Enc>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.SimJQEvent.Revocation,
AbstractEncapsulatorSimQueue.removeJobFromQueueUponRevokation(J, double, boolean),
AbstractEncapsulatorSimQueue.processSubQueueNotifications(java.util.List<org.javades.jqueues.r5.listener.MultiSimQueueNotificationProcessor.Notification<DJ, DQ>>)public final boolean isStartArmed()
isStartArmed in interface SimQueue<J extends SimJob,Q extends Enc>isStartArmed in class AbstractEncapsulatorSimQueue<DJ extends SimJob,DQ extends SimQueue,J extends SimJob,Q extends Enc>SimQueue.isStartArmed()protected final void setServerAccessCreditsSubClass()
setServerAccessCreditsSubClass in class AbstractEncapsulatorSimQueue<DJ extends SimJob,DQ extends SimQueue,J extends SimJob,Q extends Enc>AbstractSimQueue.getServerAccessCredits(),
AbstractSimEntity.getLastUpdateTime(),
SimQueue.setServerAccessCredits(double, int),
AbstractEncapsulatorSimQueue.rescheduleForNewServerAccessCredits(double)protected final void rescheduleForNewServerAccessCredits(double time)
rescheduleForNewServerAccessCredits in class AbstractEncapsulatorSimQueue<DJ extends SimJob,DQ extends SimQueue,J extends SimJob,Q extends Enc>time - The current time (i.e., the time at which new server-access credits became available).AbstractEncapsulatorSimQueue.setServerAccessCreditsSubClass()protected final void insertJobInQueueUponStart(J job, double time)
insertJobInQueueUponStart in class AbstractEncapsulatorSimQueue<DJ extends SimJob,DQ extends SimQueue,J extends SimJob,Q extends Enc>job - The job that starts.time - The current time (i.e., start time of the job).IllegalStateException - If sanity checks fail.AbstractSimQueue.isJob(org.javades.jqueues.r5.entity.jq.job.SimJob),
AbstractSimQueue.isJobInServiceArea(org.javades.jqueues.r5.entity.jq.job.SimJob),
AbstractSimQueueComposite.getDelegateJob(J),
AbstractEncapsulatorSimQueue.rescheduleAfterStart(J, double)protected final void rescheduleAfterStart(J job, double time)
rescheduleAfterStart in class AbstractEncapsulatorSimQueue<DJ extends SimJob,DQ extends SimQueue,J extends SimJob,Q extends Enc>job - The job that started (and is already present in AbstractSimQueue.getJobsInServiceArea().time - The current time (i.e., the start time of the job).AbstractSimQueue.isJob(org.javades.jqueues.r5.entity.jq.job.SimJob),
AbstractSimQueue.isJobInServiceArea(org.javades.jqueues.r5.entity.jq.job.SimJob),
AbstractSimQueueComposite.getDelegateJob(J),
AbstractEncapsulatorSimQueue.insertJobInQueueUponStart(J, double)protected final double getServiceTimeForJob(J job)
getServiceTimeForJob in class AbstractEncapsulatorSimQueue<DJ extends SimJob,DQ extends SimQueue,J extends SimJob,Q extends Enc>job - The job, non-null.protected final void removeJobFromQueueUponDeparture(J departingJob, double time)
removeJobFromQueueUponDeparture in class AbstractEncapsulatorSimQueue<DJ extends SimJob,DQ extends SimQueue,J extends SimJob,Q extends Enc>departingJob - The job that departs.time - The departure (current) time.AbstractSimQueue.depart(double, J),
AbstractEncapsulatorSimQueue.rescheduleAfterDeparture(J, double),
AbstractEncapsulatorSimQueue.removeJobFromQueueUponRevokation(J, double, boolean),
AbstractSimQueueComposite.removeJobsFromQueueLocal(J, DJ),
AbstractSimQueueComposite.getDelegateJob(SimJob),
SimJob.getQueue()protected final void rescheduleAfterDeparture(J departedJob, double time)
rescheduleAfterDeparture in class AbstractEncapsulatorSimQueue<DJ extends SimJob,DQ extends SimQueue,J extends SimJob,Q extends Enc>departedJob - The departed job.time - The departure (current) time.AbstractEncapsulatorSimQueue.removeJobFromQueueUponDeparture(J, double),
AbstractEncapsulatorSimQueue.rescheduleAfterRevokation(J, double, boolean)protected final void processSubQueueNotifications(List<MultiSimQueueNotificationProcessor.Notification<DJ,DQ>> notifications)
processSubQueueNotifications in class AbstractEncapsulatorSimQueue<DJ extends SimJob,DQ extends SimQueue,J extends SimJob,Q extends Enc>notifications - The sub-queue notifications, will be modified; empty upon return.MultiSimQueueNotificationProcessor,
MultiSimQueueNotificationProcessor.Processor,
MultiSimQueueNotificationProcessor.setProcessor(org.javades.jqueues.r5.listener.MultiSimQueueNotificationProcessor.Processor),
SimEntitySimpleEventType.RESET,
SimJQSimpleEventType.ARRIVAL,
SimQueueSimpleEventType.QUEUE_ACCESS_VACATION,
SimQueueSimpleEventType.QAV_START,
SimQueueSimpleEventType.QAV_END,
SimQueueSimpleEventType.SERVER_ACCESS_CREDITS,
SimQueueSimpleEventType.OUT_OF_SAC,
SimQueueSimpleEventType.REGAINED_SAC,
SimQueueSimpleEventType.STA_FALSE,
SimQueueSimpleEventType.STA_TRUE,
SimJQSimpleEventType.DROP,
SimJQSimpleEventType.REVOCATION,
SimJQSimpleEventType.AUTO_REVOCATION,
SimJQSimpleEventType.START,
SimJQSimpleEventType.DEPARTURE,
AbstractSimEntity.addPendingNotification(java.util.Map<org.javades.jqueues.r5.entity.SimEntitySimpleEventType.Member, org.javades.jqueues.r5.entity.SimEntityEvent>),
SimQueue.arrive(double, J),
AbstractSimQueue.start(double, J),
AbstractSimQueueComposite.selectNextQueue(double, J, DQ),
AbstractSimQueue.depart(double, J),
AbstractSimQueue.triggerPotentialNewStartArmed(double),
AbstractSimEntity.clearAndUnlockPendingNotificationsIfLocked(),
AbstractSimEntity.fireAndLockPendingNotifications()Copyright © 2018. All rights reserved.