public class DefaultWorkloadSchedule extends DefaultSimEntityEventMap implements WorkloadSchedule, WorkloadScheduleHandler
WorkloadSchedule.Copyright (C) 2005-2017 Jan de Jongh, TNO
This file is covered by the LICENSE file in the root of this project.
| Constructor and Description |
|---|
DefaultWorkloadSchedule(Map<Double,Set<E>> queueEvents)
Creates a new
DefaultWorkloadSchedule, filling out all the internal sets and maps from scanning a map of
SimJQEvents. |
DefaultWorkloadSchedule(Set<? extends SimQueue> queues,
Map<Double,Set<E>> queueEvents)
Creates a new
DefaultWorkloadSchedule, filling out all the internal sets and maps from scanning a map of
SimJQEvents. |
DefaultWorkloadSchedule(Set<? extends SimQueue> queues,
Set<E> queueEvents)
Creates a new
DefaultWorkloadSchedule, filling out all the internal sets and maps from scanning a set of
SimJQEvents. |
DefaultWorkloadSchedule(Set<E> queueEvents)
Creates a new
DefaultWorkloadSchedule, filling out all the internal sets and maps from scanning a set of
SimJQEvents. |
| Modifier and Type | Method and Description |
|---|---|
Map<SimJob,List<Double>> |
getArrivalTimesMap(SimQueue queue)
Gets the arrival times indexed by job at given queue.
|
Map<Class<? extends SimJQEvent>,SimEntitySimpleEventType.Member> |
getEventMap()
Returns a appropriate event map for this handler
for queue-access vacations, arrivals, revocations and server-access credits.
|
WorkloadScheduleHandler |
getHandler(String name)
Gets a handler by name.
|
String |
getHandlerName()
Returns the name of the handler.
|
NavigableMap<Double,List<SimJob>> |
getJobArrivalsMap(SimQueue queue)
Gets the job arrivals indexed by time at given queue.
|
NavigableMap<Double,List<Map<SimJob,Boolean>>> |
getJobRevocationsMap(SimQueue queue)
Gets the job revocations indexed by time at given queue.
|
Set<SimJob> |
getJobs()
Gets the jobs (in no particular order) operating (arriving, revoking, ...) at least once at any of the queues.
|
Set<SimJob> |
getJobs(SimQueue queue)
Gets the jobs (in no particular order) operating (arriving, revoking, ...) at least once at given queue.
|
double |
getNextEventTimeBeyond(SimQueue queue,
double time,
Set<SimEntitySimpleEventType.Member> eventTypes)
Returns the time of the next event(s), and optionally their types,
scheduled strictly beyond a given time at a specific queue.
|
Set<SimJQEvent> |
getProcessedQueueEvents()
Gets the underlying queue events that were processed for this workload representation.
|
NavigableMap<Double,List<Boolean>> |
getQueueAccessVacationMap(SimQueue queue)
Returns the queue-access vacation settings in time for a specific queue.
|
Set<SimJQEvent> |
getQueueEvents()
Gets the underlying queue events (all) of this workload representation.
|
Set<SimQueue> |
getQueues()
Gets the queues (in no particular order) to which this workload representation applies.
|
Map<SimJob,List<Map<Double,Boolean>>> |
getRevocationTimesMap(SimQueue queue)
Gets the revocation times indexed by job at given queue.
|
NavigableMap<Double,List<Integer>> |
getServerAccessCreditsMap(SimQueue queue)
Returns the server-access-credits settings in time for a specific queue.
|
boolean |
needsScan()
Returns
true. |
void |
registerHandler(WorkloadScheduleHandler handler)
Registers a handler for
SimJQEvents, and, upon request of the handler, passes control to it for scanning. |
Set<SimJQEvent> |
scan(DefaultWorkloadSchedule workloadSchedule)
Scans the host
DefaultWorkloadSchedule and builds internal data structures. |
getEntityEvents, getSimJobTimeSimEntityEventMap, getSimQueueTimeSimEntityEventMap, getTimeSimJobSimEntityEventMap, getTimeSimQueueSimEntityEventMapclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithasEventsBeyond, isSingleQueue, isSingleVisit, isSingleVisit, isUnambiguous_ROELgetEntityEvents, getSimJobTimeSimEntityEventMap, getSimQueueTimeSimEntityEventMap, getTimeSimJobSimEntityEventMap, getTimeSimQueueSimEntityEventMappublic DefaultWorkloadSchedule(Set<? extends SimQueue> queues, Set<E> queueEvents) throws WorkloadScheduleException
DefaultWorkloadSchedule, filling out all the internal sets and maps from scanning a set of
SimJQEvents.E - The event type.queues - The queues to consider; events related to other queues are ignored; if null,
consider all queues found in the queueEvents set.queueEvents - The set of events to parse (parsing is actually done in this constructor).WorkloadScheduleException - If the workload is invalid or ambiguous (for instance).public DefaultWorkloadSchedule(Set<E> queueEvents) throws WorkloadScheduleException
DefaultWorkloadSchedule, filling out all the internal sets and maps from scanning a set of
SimJQEvents.
With this constructor, all queues found in the queueEvents are considered.
Implemented as this (null, queueEvents).
E - The event type.queueEvents - The set of events to parse (parsing is actually done in this constructor).WorkloadScheduleException - If the workload is invalid or ambiguous (for instance).public DefaultWorkloadSchedule(Set<? extends SimQueue> queues, Map<Double,Set<E>> queueEvents) throws WorkloadScheduleException
DefaultWorkloadSchedule, filling out all the internal sets and maps from scanning a map of
SimJQEvents.E - The event type.queues - The queues to consider; events related to other queues are ignored; if null,
consider all queues found in the queueEvents set.queueEvents - The set of events (as a map) to parse (parsing is actually done in this constructor).WorkloadScheduleException - If the workload is invalid or ambiguous (for instance).public DefaultWorkloadSchedule(Map<Double,Set<E>> queueEvents) throws WorkloadScheduleException
DefaultWorkloadSchedule, filling out all the internal sets and maps from scanning a map of
SimJQEvents.
With this constructor, all queues found in the queueEvents are considered.
Implemented as this (null, queueEvents).
E - The event type.queueEvents - The set of events (as a map) to parse (parsing is actually done in this constructor).WorkloadScheduleException - If the workload is invalid or ambiguous (for instance).public double getNextEventTimeBeyond(SimQueue queue, double time, Set<SimEntitySimpleEventType.Member> eventTypes) throws WorkloadScheduleException
WorkloadSchedulegetNextEventTimeBeyond in interface WorkloadSchedulequeue - The queue, may be null or not in WorkloadSchedule.getQueues(), in which case Double.NaN is returned.time - The time from which to search, use Double.NaN to retrieve the first-event time (which
may be Double.NEGATIVE_INFINITY).eventTypes - An optional set to store the (possible multiple) event types; a non-null set is cleared upon entry.Double.NaN if no such event exists.WorkloadScheduleException - If the workload is invalid, or this schedule is incapable of parsing it (completely).WorkloadSchedule.hasEventsBeyond(org.javades.jqueues.r5.entity.jq.queue.SimQueue, double)public final void registerHandler(WorkloadScheduleHandler handler) throws WorkloadScheduleException
SimJQEvents, and, upon request of the handler, passes control to it for scanning.handler - The handler.IllegalArgumentException - If the handler or its name are null,
if a handler with the same name has been registered already,
if the handler's event map has a null key,
or if it tries to register SimJQEvents that are already registered
by other handlers.WorkloadScheduleException - If the workload is invalid or ambiguous (for instance).WorkloadScheduleHandlerpublic final WorkloadScheduleHandler getHandler(String name)
name - The name to look for.null if not found.public final Set<SimJQEvent> getQueueEvents()
WorkloadScheduleA unmodifiable view must be returned.
getQueueEvents in interface WorkloadSchedulepublic final Set<SimJQEvent> getProcessedQueueEvents()
WorkloadSchedule
The set returned must always be a subset of WorkloadSchedule.getQueueEvents().
A unmodifiable view must be returned.
getProcessedQueueEvents in interface WorkloadSchedulepublic final Set<SimQueue> getQueues()
WorkloadScheduleThe set must be fixed upon construction.
A unmodifiable view must be returned.
getQueues in interface WorkloadSchedulepublic final NavigableMap<Double,List<Boolean>> getQueueAccessVacationMap(SimQueue queue)
WorkloadScheduleA unmodifiable view must be returned.
getQueueAccessVacationMap in interface WorkloadSchedulequeue - The queue, may be null or not in WorkloadSchedule.getQueues(), in which case an empty map is returned.public final Set<SimJob> getJobs()
WorkloadScheduleNote that this set may include jobs that did not arrive at any queue.
A unmodifiable view must be returned.
getJobs in interface WorkloadSchedulenull set
operating (arriving, revoking, ...) at least once at any of the queues.public final Set<SimJob> getJobs(SimQueue queue)
WorkloadSchedule
The set returned must always be a subset of WorkloadSchedule.getJobs(SimQueue).
Note that this set may include jobs that did not arrive at the queue.
A unmodifiable view must be returned.
getJobs in interface WorkloadSchedulequeue - The queue, may be null or not in WorkloadSchedule.getQueues(), in which case an empty set is returned.null set
operating (arriving, revoking, ...) at least once at given queue.public final Map<SimJob,List<Double>> getArrivalTimesMap(SimQueue queue)
WorkloadScheduleA unmodifiable view must be returned.
getArrivalTimesMap in interface WorkloadSchedulequeue - The queue, may be null or not in WorkloadSchedule.getQueues(), in which case an empty map is returned.public final NavigableMap<Double,List<SimJob>> getJobArrivalsMap(SimQueue queue)
WorkloadScheduleA unmodifiable view must be returned.
getJobArrivalsMap in interface WorkloadSchedulequeue - The queue, may be null or not in WorkloadSchedule.getQueues(), in which case an empty map is returned.public final Map<SimJob,List<Map<Double,Boolean>>> getRevocationTimesMap(SimQueue queue)
WorkloadScheduleA unmodifiable view must be returned.
The inner map yields the 'interruptService' argument for the event time. It has only one entry.
getRevocationTimesMap in interface WorkloadSchedulequeue - The queue, may be null or not in WorkloadSchedule.getQueues(), in which case an empty map is returned.public final NavigableMap<Double,List<Map<SimJob,Boolean>>> getJobRevocationsMap(SimQueue queue)
WorkloadScheduleA unmodifiable view must be returned.
The inner map yields the 'interruptService' argument for the job. It has only one entry.
getJobRevocationsMap in interface WorkloadSchedulequeue - The queue, may be null or not in WorkloadSchedule.getQueues(), in which case an empty map is returned.public final NavigableMap<Double,List<Integer>> getServerAccessCreditsMap(SimQueue queue)
WorkloadScheduleA unmodifiable view must be returned.
getServerAccessCreditsMap in interface WorkloadSchedulequeue - The queue, may be null or not in WorkloadSchedule.getQueues(), in which case an empty map is returned.public final String getHandlerName()
WorkloadScheduleHandler
The handler name must be unique within the realm of the DefaultWorkloadSchedule at which this
handler registers. For SimQueue state extensions, the convention is to use
the interface name appended with "Handler", like, "SimQueueHandler" and "SimQueueWithGateHandler".
getHandlerName in interface WorkloadScheduleHandlerpublic final Map<Class<? extends SimJQEvent>,SimEntitySimpleEventType.Member> getEventMap()
getEventMap in interface WorkloadScheduleHandlerSimQueueEvent.QueueAccessVacation,
SimJQEvent.Arrival,
SimJQEvent.Revocation,
SimQueueEvent.ServerAccessCredits,
SimQueueSimpleEventType.QUEUE_ACCESS_VACATION,
SimJQSimpleEventType.ARRIVAL,
SimJQSimpleEventType.REVOCATION,
SimQueueSimpleEventType.SERVER_ACCESS_CREDITSpublic final boolean needsScan()
true.needsScan in interface WorkloadScheduleHandlerregisterHandler(org.javades.jqueues.r5.util.predictor.workload.WorkloadScheduleHandler),
WorkloadScheduleHandler.scan(org.javades.jqueues.r5.util.predictor.workload.DefaultWorkloadSchedule)public final Set<SimJQEvent> scan(DefaultWorkloadSchedule workloadSchedule)
WorkloadScheduleHandlerDefaultWorkloadSchedule and builds internal data structures.
Called by our host DefaultWorkloadSchedule only upon registration,
and if we ask for it WorkloadScheduleHandler.needsScan().
scan in interface WorkloadScheduleHandlerworkloadSchedule - The host at which we registered.SimJQEvents processed by this handler,
in a set with no particular member ordering; may be null or empty.registerHandler(org.javades.jqueues.r5.util.predictor.workload.WorkloadScheduleHandler),
WorkloadScheduleHandler.scan(org.javades.jqueues.r5.util.predictor.workload.DefaultWorkloadSchedule)Copyright © 2018. All rights reserved.