DJ - The delegate-job type.DQ - The queue-type for delegate jobs.J - The job type.Q - The queue type for jobs.public class EncJL<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 imposes (independent) limits on the numbers of jobs in waiting area,
service area and queueing system as a whole.
Jobs whose arrival exceeds any limit will be dropped,
and jobs are detained in the waiting area if
their potential start would exceed the limit on the number of jobs in the service area.
Apart from local drops, this queue uses the server-access credits on the encapsulated queue to restrict the number of jobs in the service area.
For any limit, Integer.MAX_VALUE is treated as infinity,
and that value effectively disables monitoring that particular limit.
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,
EncTLAbstractSimQueueComposite.RealDelegateJobMapper<J extends SimJob,DJ extends SimJob>AbstractSimEntity.Notifier, AbstractSimEntity.PreNotificationHookSimQueue.AutoRevocationPolicySimEntity.Action, SimEntity.UnknownNotificationTypePolicy, SimEntity.UnknownOperationPolicyrealDelegateJobMappereventsScheduled, SANITYUSE_ARRAY_OPTIMIZATION| Constructor and Description |
|---|
EncJL(org.javades.jsimulation.r5.SimEventList eventList,
DQ queue,
DelegateSimJobFactory delegateSimJobFactory,
int maxJw,
int maxJs,
int maxJ)
Creates an encapsulator queue given an event list and a queue and limits on respective number of jobs.
|
| Modifier and Type | Method and Description |
|---|---|
EncJL<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, and equal limits on respective number of jobs. |
int |
getMaxJobs()
Returns the maximum number of jobs allowed in the queueing system.
|
int |
getMaxJobsInServiceArea()
Returns the maximum number of jobs allowed in the service area.
|
int |
getMaxJobsInWaitingArea()
Returns the maximum number of jobs allowed in the waiting area.
|
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.
|
protected void |
insertJobInQueueUponStart(J job,
double time)
Calls super method.
|
boolean |
isStartArmed()
XXXXXCalls super method (in order to make implementation final).
|
protected void |
processSubQueueNotifications(List<MultiSimQueueNotificationProcessor.Notification<DJ,DQ>> notifications)
Calls super method after removing and local processing all start events from the sub-queues.
|
protected void |
queueAccessVacationDropSubClass(double time,
J job)
Calls super method (in order to make implementation final).
|
protected void |
removeJobFromQueueUponDeparture(J departingJob,
double time)
Calls super method.
|
protected void |
removeJobFromQueueUponDrop(J job,
double time)
Calls super method (in order to make implementation final).
|
protected void |
removeJobFromQueueUponRevokation(J job,
double time,
boolean auto)
Calls super method (in order to make implementation final).
|
protected void |
rescheduleAfterArrival(J job,
double time)
Calls super method if allowed in view of the limits of this queue; drops the job otherwise.
|
protected void |
rescheduleAfterDeparture(J departedJob,
double time)
Calls super method and sets the server-access credits on the encapsulated queue.
|
protected void |
rescheduleAfterDrop(J job,
double time)
Calls super method and sets the server-access credits on the encapsulated queue.
|
protected void |
rescheduleAfterRevokation(J job,
double time,
boolean auto)
Calls super method and sets the server-access credits on the encapsulated queue.
|
protected void |
rescheduleAfterStart(J job,
double time)
Calls super method.
|
protected void |
rescheduleForNewServerAccessCredits(double time)
Calls super method (in order to make implementation final).
|
protected void |
resetEntitySubClass()
Calls super method and sets the server-access credits on the encapsulated queue.
|
protected void |
setServerAccessCreditsSubClass()
Calls super method (in order to make implementation final).
|
String |
toStringDefault()
Returns "EncJL(maxJw,maxJs,maxJ)[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 EncJL(org.javades.jsimulation.r5.SimEventList eventList,
DQ queue,
DelegateSimJobFactory delegateSimJobFactory,
int maxJw,
int maxJs,
int maxJ)
The server-access credits on the encapsulated queue are set accordingly.
eventList - The event list to use.queue - The encapsulated queue.delegateSimJobFactory - An optional factory for the delegate SimJobs.maxJw - The maximum number of jobs allowed in the waiting area, non-negative,
Integer.MAX_VALUE is treated as infinity.maxJs - The maximum number of jobs allowed in the service area, non-negative,
Integer.MAX_VALUE is treated as infinity.maxJ - The maximum number of jobs allowed in the queueing system, non-negative,
Integer.MAX_VALUE is treated as infinity.IllegalArgumentException - If the event list or the queue is null,
or any of the limit arguments is strictly negative.DelegateSimJobFactory,
DefaultDelegateSimJobFactorypublic EncJL<DJ,DQ,J,Q> getCopySimQueue()
EncTL object on the same SimEventList with a copy of the encapsulated
queue, the same delegate-job factory, and equal limits on respective number of jobs.EncTL object on the same SimEventList with a copy of the encapsulated
queue, the same delegate-job factory, and equal limits on respective number of jobs.UnsupportedOperationException - If the encapsulated queue could not be copied through SimQueue.getCopySimQueue().AbstractSimEntity.getEventList(),
AbstractEncapsulatorSimQueue.getEncapsulatedQueue(),
AbstractSimQueueComposite.getDelegateSimJobFactory(),
getMaxJobsInWaitingArea(),
getMaxJobsInServiceArea(),
getMaxJobs()public String toStringDefault()
In the output, the value Integer.MAX_VALUE is replaced with "inf".
toStringDefault in interface SimEntitytoStringDefault in class AbstractSimQueue<J extends SimJob,Q extends Enc>AbstractEncapsulatorSimQueue.getEncapsulatedQueue(),
getMaxJobsInWaitingArea(),
getMaxJobsInServiceArea(),
getMaxJobs()public final int getMaxJobsInWaitingArea()
Integer.MAX_VALUE is treated as infinity.public final int getMaxJobsInServiceArea()
Integer.MAX_VALUE is treated as infinity.public final int getMaxJobs()
Integer.MAX_VALUE is treated as infinity.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).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)
Note that starting a job can never require re-assessment of the server-access credits on the encapsulated queue.
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)
Removing the start events first is needed in order to properly update the local server-access credits with (atomic) sub-queue notifications with multiple start events in combination with other events.
This method opens a top-level event since we are processing the events ahead of our super implementation.
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.AbstractSimEntity.clearAndUnlockPendingNotificationsIfLocked(),
AbstractSimEntity.fireAndLockPendingNotifications(),
SimJQSimpleEventType.START,
AbstractSimQueue.start(double, J)Copyright © 2018. All rights reserved.