public class ALIMIT<J extends SimJob,Q extends ALIMIT> extends AbstractServerlessSimQueue<J,Q>
ALIMIT queue jobs depart without service in arrival order,
but are dropped if they exceed a give arrival-rate limit.
This SimQueue is server-less, actually, without waiting area as well (it never exposes jobs present).
The operation of this SimQueue is controlled by the rateLimit property, see getRateLimit().
It must be non-negative and is set upon construction; and cannot be changed afterwards.
If set to zero, this queue behaves as DROP.
If so to positive infinite, this queue behaves as ZERO.
| Modifier and Type | Class and Description |
|---|---|
protected static class |
ALIMIT.RateLimitExpirationEvent<Q extends ALIMIT>
The default
SimEvent used internally for scheduling rate-limit expirations. |
AbstractSimEntity.Notifier, AbstractSimEntity.PreNotificationHookSimQueue.AutoRevocationPolicySimEntity.Action, SimEntity.UnknownNotificationTypePolicy, SimEntity.UnknownOperationPolicyeventsScheduled, SANITYUSE_ARRAY_OPTIMIZATION| Constructor and Description |
|---|
ALIMIT(org.javades.jsimulation.r5.SimEventList eventList,
double rateLimit)
Creates a
ALIMIT queue with (irrelevant) infinite buffer size given an event list and (arrival) rate limit. |
| Modifier and Type | Method and Description |
|---|---|
ALIMIT<J,Q> |
getCopySimQueue()
Returns a new
ALIMIT object on the same SimEventList with the same (arrival) rate limit. |
Object |
getQoS()
Calls super method (in order to make implementation final).
|
Class |
getQoSClass()
Calls super method (in order to make implementation final).
|
double |
getRateLimit()
Returns the (immutable) rate limit for arrivals (non-negative).
|
protected void |
insertJobInQueueUponArrival(J job,
double time)
Does nothing.
|
protected boolean |
isRateLimited()
Returns whether this queue is currently (arrival) rate limited.
|
protected void |
rateLimitExpiration(ALIMIT.RateLimitExpirationEvent<Q> event)
Notification of rate-limit expiration from an internally-scheduled
ALIMIT.RateLimitExpirationEvent. |
protected void |
removeJobFromQueueUponDeparture(J departingJob,
double time)
Does nothing.
|
protected void |
removeJobFromQueueUponDrop(J job,
double time)
Does nothing.
|
protected void |
removeJobFromQueueUponRevokation(J job,
double time,
boolean auto)
Throws
IllegalStateException. |
protected void |
rescheduleAfterArrival(J job,
double time)
Drops the job if the queue is currently rate-limited,
but makes it depart immediately otherwise, scheduling a new
ALIMIT.RateLimitExpirationEvent if needed. |
protected void |
rescheduleAfterDeparture(J departedJob,
double time)
Does nothing.
|
protected void |
rescheduleAfterDrop(J job,
double time)
Does nothing.
|
protected void |
rescheduleAfterRevokation(J job,
double time,
boolean auto)
Throws
IllegalStateException. |
protected void |
resetEntitySubClass()
Calls super method and properly sets the rate limitation.
|
protected ALIMIT.RateLimitExpirationEvent<Q> |
scheduleRateLimitExpirationEvent(double expirationTime)
Schedules a suitable
SimEvent for a rate-limit expiration on the event list. |
String |
toStringDefault()
Returns "ALIMIT[rateLimit]".
|
getServiceTimeForJob, insertJobInQueueUponStart, isStartArmed, queueAccessVacationDropSubClass, rescheduleAfterStart, rescheduleForNewServerAccessCredits, setServerAccessCreditsSubClassgetBufferSize, getNumberOfServersarrive, 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 ALIMIT(org.javades.jsimulation.r5.SimEventList eventList,
double rateLimit)
ALIMIT queue with (irrelevant) infinite buffer size given an event list and (arrival) rate limit.eventList - The event list to use.rateLimit - The (arrival) rate limit, non-negative.IllegalArgumentException - If the rate limit is strictly negative.public ALIMIT<J,Q> getCopySimQueue()
ALIMIT object on the same SimEventList with the same (arrival) rate limit.ALIMIT object on the same SimEventList with the same (arrival) rate limit.AbstractSimEntity.getEventList(),
getRateLimit()public String toStringDefault()
toStringDefault in interface SimEntitytoStringDefault in class AbstractSimQueue<J extends SimJob,Q extends ALIMIT>SimEntity.setName(java.lang.String),
Object.toString()public final double getRateLimit()
The (arrival) rate limit is set upon construction, and cannot be changed afterwards.
protected final boolean isRateLimited()
public final Class getQoSClass()
null.public final Object getQoS()
null.protected final void resetEntitySubClass()
Since we always schedule ALIMIT.RateLimitExpirationEvent through AbstractSimQueue.eventsScheduled,
our super-class will cancel them automatically (if needed).
resetEntitySubClass in class AbstractSimQueue<J extends SimJob,Q extends ALIMIT>isRateLimitedprotected final void insertJobInQueueUponArrival(J job, double time)
insertJobInQueueUponArrival in class AbstractSimQueue<J extends SimJob,Q extends ALIMIT>job - The job that arrived.time - The current time (i.e., arrival time of the job).AbstractSimQueue.arrive(double, J),
AbstractSimQueue.rescheduleAfterArrival(J, double)protected final void rescheduleAfterArrival(J job, double time)
ALIMIT.RateLimitExpirationEvent if needed.rescheduleAfterArrival in class AbstractSimQueue<J extends SimJob,Q extends ALIMIT>job - The job that arrived (and is already present in AbstractSimQueue.getJobs()).time - The current time (i.e., the arrival time of the job).isRateLimited,
AbstractSimQueue.depart(double, J),
AbstractSimQueue.drop(J, double),
insertJobInQueueUponArrival(J, double)protected final void removeJobFromQueueUponDrop(J job, double time)
removeJobFromQueueUponDrop in class AbstractSimQueue<J extends SimJob,Q extends ALIMIT>job - The job that is to be dropped.time - The current time (i.e., drop time of the job).AbstractSimQueue.drop(J, double),
AbstractSimQueue.rescheduleAfterDrop(J, double)protected final void rescheduleAfterDrop(J job, double time)
rescheduleAfterDrop in class AbstractSimQueue<J extends SimJob,Q extends ALIMIT>job - The jobs that was dropped.time - The current time (i.e., drop time of the job).AbstractSimQueue.drop(J, double),
AbstractSimQueue.removeJobFromQueueUponDrop(J, double)protected final void removeJobFromQueueUponRevokation(J job, double time, boolean auto)
IllegalStateException.removeJobFromQueueUponRevokation in class AbstractSimQueue<J extends SimJob,Q extends ALIMIT>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.IllegalStateException - Always, as a call to this method is unexpected.AbstractSimQueue.revoke(double, J, boolean),
AbstractSimQueue.autoRevoke(double, J),
AbstractSimQueue.rescheduleAfterRevokation(J, double, boolean),
SimQueue.AutoRevocationPolicyprotected final void rescheduleAfterRevokation(J job, double time, boolean auto)
IllegalStateException.rescheduleAfterRevokation in class AbstractSimQueue<J extends SimJob,Q extends ALIMIT>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.IllegalStateException - Always, as a call to this method is unexpected.AbstractSimQueue.revoke(double, J, boolean),
AbstractSimQueue.autoRevoke(double, J),
AbstractSimQueue.removeJobFromQueueUponRevokation(J, double, boolean),
SimQueue.AutoRevocationPolicyprotected final void rateLimitExpiration(ALIMIT.RateLimitExpirationEvent<Q> event)
ALIMIT.RateLimitExpirationEvent.
Resets the RateLimited property.
Removes the event for AbstractSimQueue.eventsScheduled.
event - The event that invoked us through its SimEventAction, non-null.protected final ALIMIT.RateLimitExpirationEvent<Q> scheduleRateLimitExpirationEvent(double expirationTime)
SimEvent for a rate-limit expiration on the event list.
The implementation creates a new ALIMIT.RateLimitExpirationEvent,
adds it to AbstractSimQueue.eventsScheduled and schedules the new event on the event list.
Effectively, this ensures that unless the event is canceled,
the method rateLimitExpiration(org.javades.jqueues.r5.entity.jq.queue.serverless.ALIMIT.RateLimitExpirationEvent<Q>) is invoked upon reaching the event.
expirationTime - The scheduled expiration time.AbstractSimEntity.getEventList(),
AbstractSimEntity.getLastUpdateTime(),
AbstractSimQueue.eventsScheduledprotected final void removeJobFromQueueUponDeparture(J departingJob, double time)
removeJobFromQueueUponDeparture in class AbstractSimQueue<J extends SimJob,Q extends ALIMIT>departingJob - The job that departs.time - The departure (current) time.AbstractSimQueue.depart(double, J),
AbstractSimQueue.rescheduleAfterDeparture(J, double)protected final void rescheduleAfterDeparture(J departedJob, double time)
rescheduleAfterDeparture in class AbstractSimQueue<J extends SimJob,Q extends ALIMIT>departedJob - The departed job.time - The departure (current) time.AbstractSimQueue.depart(double, J),
AbstractSimQueue.removeJobFromQueueUponDeparture(J, double)Copyright © 2018. All rights reserved.