Class JobClass
-
- All Implemented Interfaces:
-
java.io.Serializable,jline.lang.Copyable
public class JobClass extends NetworkElement implements Serializable
Superclass representing a class of jobs
-
-
Field Summary
Fields Modifier and Type Field Description protected JobClassTypetypeprotected intpriorityprotected booleancompletesprotected Stationrefstatprotected booleanisrefclassprotected intindexprotected doubledeadlinepublic Array<Integer>attributepublic intreplySignalClassIndexpublic Distributionpatiencepublic ImpatienceTypeimpatienceTypepublic BalkingStrategybalkingStrategypublic List<BalkingThreshold>balkingThresholdspublic DistributionretrialDelayDistributionpublic intmaxRetrialAttemptsprotected Stringname
-
Constructor Summary
Constructors Constructor Description JobClass(JobClassType type, String name)Creates a new job class with the specified type and name.
-
Method Summary
Modifier and Type Method Description Array<Integer>getAttribute()voidsetAttribute(Array<Integer> attribute)intgetReplySignalClassIndex()Gets the index of the reply signal class. voidsetReplySignalClassIndex(int signalClassIndex)Sets the reply signal class index for synchronous call semantics. DistributiongetPatience()Gets the global patience distribution for this job class. voidsetPatience(Distribution distribution)Sets the global patience distribution for this job class. ImpatienceTypegetImpatienceType()Gets the global impatience type for this job class. BalkingStrategygetBalkingStrategy()Gets the global balking strategy for this job class. List<BalkingThreshold>getBalkingThresholds()Gets the global balking thresholds for this job class. DistributiongetRetrialDelayDistribution()Gets the global retrial delay distribution for this job class. intgetMaxRetrialAttempts()Gets the maximum number of retrial attempts for this job class. booleangetCompletes()Checks if jobs in this class complete their service and leave the system. voidsetCompletes(boolean completes)intgetIndex()JobClassTypegetJobClassType()Returns the type of this job class. doublegetNumberOfJobs()Returns the number of jobs in this class. intgetPriority()Returns the priority level of this job class. voidsetPriority(int p)Sets the priority level for this job class. doublegetDeadline()Returns the relative deadline for jobs in this class. voidsetDeadline(double deadline)Sets the relative deadline for jobs in this class. StationgetReferenceStation()Returns the reference station for this job class. voidsetReferenceStation(Station ref)Sets the reference station for this job class. booleanisReferenceClass()Checks if this is a reference job class within its chain. voidsetReferenceClass(boolean isrefclass)Sets whether this job class is a reference class within its chain. booleanisReferenceStation(Node node)Checks if the specified node is the reference station for this class. booleanexpectsReply()Checks if this job class expects a reply signal after processing. voidsetPatience(ImpatienceType impatienceType, Distribution distribution)Sets the global impatience type and distribution for this job class. booleanhasPatience()Checks if this job class has a patience distribution configured. voidsetBalking(BalkingStrategy strategy, List<BalkingThreshold> thresholds)Sets the global balking configuration for this job class using queue-length thresholds. voidsetBalking(BalkingStrategy strategy, int minJobs, double probability)Sets the global balking configuration using a single threshold. booleanhasBalking()Checks if this job class has balking configured. voidsetRetrial(Distribution delayDistribution, int maxAttempts)Sets the global retrial configuration for this job class. voidsetRetrial(Distribution delayDistribution)Sets the global retrial configuration with unlimited retry attempts. booleanhasRetrial()Checks if this job class has retrial configured. voidprintSummary()Prints a summary of this job class configuration to the console. booleanhasImmediateFeedback()Checks if immediate feedback is enabled for this job class. voidsetImmediateFeedback(boolean enabled)Enables or disables immediate feedback for this job class globally. -
-
Constructor Detail
-
JobClass
JobClass(JobClassType type, String name)
Creates a new job class with the specified type and name.- Parameters:
type- the type of job class (OPEN, CLOSED, etc.name- the name for this job class
-
-
Method Detail
-
getAttribute
Array<Integer> getAttribute()
-
setAttribute
void setAttribute(Array<Integer> attribute)
-
getReplySignalClassIndex
int getReplySignalClassIndex()
Gets the index of the reply signal class.
- Returns:
the index of the reply signal class, or -1 if no reply is expected
-
setReplySignalClassIndex
void setReplySignalClassIndex(int signalClassIndex)
Sets the reply signal class index for synchronous call semantics. When a job of this class completes service, the server will block until receiving a REPLY signal from the signal class at the specified index.
- Parameters:
signalClassIndex- the index of the signal class that will unblock the server
-
getPatience
Distribution getPatience()
Gets the global patience distribution for this job class.
- Returns:
the patience distribution, or null if not set
-
setPatience
void setPatience(Distribution distribution)
Sets the global patience distribution for this job class. This applies to all queues unless overridden by a queue-specific patience setting. Defaults to RENEGING patience type for backwards compatibility.
- Parameters:
distribution- the patience time distribution
-
getImpatienceType
ImpatienceType getImpatienceType()
Gets the global impatience type for this job class.
- Returns:
the impatience type, or null if not set
-
getBalkingStrategy
BalkingStrategy getBalkingStrategy()
Gets the global balking strategy for this job class.
- Returns:
the balking strategy, or null if not configured
-
getBalkingThresholds
List<BalkingThreshold> getBalkingThresholds()
Gets the global balking thresholds for this job class.
- Returns:
list of balking thresholds, or null if not configured
-
getRetrialDelayDistribution
Distribution getRetrialDelayDistribution()
Gets the global retrial delay distribution for this job class.
- Returns:
the retrial delay distribution, or null if not configured
-
getMaxRetrialAttempts
int getMaxRetrialAttempts()
Gets the maximum number of retrial attempts for this job class.
- Returns:
maximum attempts (-1 for unlimited)
-
getCompletes
boolean getCompletes()
Checks if jobs in this class complete their service and leave the system.
- Returns:
true if jobs complete, false if they remain in the system
-
setCompletes
void setCompletes(boolean completes)
-
getIndex
int getIndex()
-
getJobClassType
JobClassType getJobClassType()
Returns the type of this job class.
- Returns:
the job class type (OPEN, CLOSED, etc.)
-
getNumberOfJobs
double getNumberOfJobs()
Returns the number of jobs in this class. Default implementation returns infinite (for open classes).
- Returns:
number of jobs in this class
-
getPriority
int getPriority()
Returns the priority level of this job class. Lower values indicate higher priority (priority 0 is highest).
- Returns:
the priority level
-
setPriority
void setPriority(int p)
Sets the priority level for this job class.
- Parameters:
p- the priority level to set
-
getDeadline
double getDeadline()
Returns the relative deadline for jobs in this class. The deadline is specified as time units from job arrival. A value of Double.POSITIVE_INFINITY indicates no deadline constraint.
- Returns:
the relative deadline in time units, or Double.POSITIVE_INFINITY if no deadline
-
setDeadline
void setDeadline(double deadline)
Sets the relative deadline for jobs in this class. Jobs will be assigned an absolute deadline of arrivalTime + deadline when they enter queues with EDD/EDF scheduling.
- Parameters:
deadline- the relative deadline in time units (must be >0), or Double.
-
getReferenceStation
Station getReferenceStation()
Returns the reference station for this job class. The reference station is used for normalization in closed networks.
- Returns:
the reference station, or null if not set
-
setReferenceStation
void setReferenceStation(Station ref)
Sets the reference station for this job class.
- Parameters:
ref- the station to use as reference
-
isReferenceClass
boolean isReferenceClass()
Checks if this is a reference job class within its chain.
- Returns:
true if this is a reference class
-
setReferenceClass
void setReferenceClass(boolean isrefclass)
Sets whether this job class is a reference class within its chain.
- Parameters:
isrefclass- true to make this a reference class
-
isReferenceStation
boolean isReferenceStation(Node node)
Checks if the specified node is the reference station for this class.
- Parameters:
node- the node to check- Returns:
true if the node is the reference station
-
expectsReply
boolean expectsReply()
Checks if this job class expects a reply signal after processing.
- Returns:
true if a reply signal is expected, false otherwise
-
setPatience
void setPatience(ImpatienceType impatienceType, Distribution distribution)
Sets the global impatience type and distribution for this job class. This applies to all queues unless overridden by a queue-specific patience setting.
- Parameters:
impatienceType- the type of impatience (RENEGING or BALKING)distribution- the patience time distribution
-
hasPatience
boolean hasPatience()
Checks if this job class has a patience distribution configured.
- Returns:
true if patience is configured, false otherwise
-
setBalking
void setBalking(BalkingStrategy strategy, List<BalkingThreshold> thresholds)
Sets the global balking configuration for this job class using queue-length thresholds. This applies to all queues unless overridden by a queue-specific balking setting.
- Parameters:
strategy- the balking strategy to usethresholds- list of balking thresholds mapping queue lengths to probabilities
-
setBalking
void setBalking(BalkingStrategy strategy, int minJobs, double probability)
Sets the global balking configuration using a single threshold. Convenience method for simple balking configurations.
- Parameters:
strategy- the balking strategy to useminJobs- minimum queue length to trigger balkingprobability- balking probability when queue length >= minJobs
-
hasBalking
boolean hasBalking()
Checks if this job class has balking configured.
- Returns:
true if balking is configured, false otherwise
-
setRetrial
void setRetrial(Distribution delayDistribution, int maxAttempts)
Sets the global retrial configuration for this job class. When a customer is rejected due to capacity, they will enter an orbit and retry after a delay drawn from the specified distribution.
- Parameters:
delayDistribution- the distribution for retrial delay timesmaxAttempts- maximum retry attempts (-1 for unlimited, 0 for no retries)
-
setRetrial
void setRetrial(Distribution delayDistribution)
Sets the global retrial configuration with unlimited retry attempts.
- Parameters:
delayDistribution- the distribution for retrial delay times
-
hasRetrial
boolean hasRetrial()
Checks if this job class has retrial configured.
- Returns:
true if retrial is configured, false otherwise
-
printSummary
void printSummary()
Prints a summary of this job class configuration to the console.
-
hasImmediateFeedback
boolean hasImmediateFeedback()
Checks if immediate feedback is enabled for this job class.
- Returns:
true if immediate feedback is enabled
-
setImmediateFeedback
void setImmediateFeedback(boolean enabled)
Enables or disables immediate feedback for this job class globally. When enabled, jobs of this class that self-loop at any station stay in service instead of rejoining the queue.
- Parameters:
enabled- true to enable immediate feedback, false to disable
-
-
-
-