Class ServerType
-
- All Implemented Interfaces:
-
java.io.Serializable,jline.lang.Copyable
public class ServerType extends Element implements Serializable
Represents a type of server within a heterogeneous multiserver queue.
A server type defines a group of identical servers with:
- A unique name identifying this server type
- A count of servers of this type
- A list of job classes that are compatible with (can be served by) this type
Server types enable modeling of heterogeneous multiserver queues where different servers may have different service rates and serve different subsets of job classes.
Example usage:
ServerType fastServer = new ServerType("Fast", 2); fastServer.addCompatibleClass(classA); fastServer.addCompatibleClass(classB); queue.addServerType(fastServer); queue.setService(classA, fastServer, new Exp(2.0));
-
-
Field Summary
Fields Modifier and Type Field Description public intidpublic intnumOfServerspublic List<JobClass>compatibleClassespublic QueueparentQueueprotected Stringname
-
Constructor Summary
Constructors Constructor Description ServerType(String name, int numOfServers)Creates a new server type with the specified name and number of servers. ServerType(String name, int numOfServers, List<JobClass> compatibleClasses)Creates a new server type with the specified name, number of servers, and compatible classes.
-
Method Summary
Modifier and Type Method Description intgetId()Gets the unique identifier of this server type within its queue. voidsetId(int id)Sets the unique identifier of this server type. intgetNumOfServers()Gets the number of servers of this type. voidsetNumOfServers(int numOfServers)Sets the number of servers of this type. List<JobClass>getCompatibleClasses()Gets the list of job classes compatible with this server type. voidsetCompatibleClasses(List<JobClass> classes)Sets the list of compatible job classes, replacing any existing list. QueuegetParentQueue()Gets the parent queue this server type belongs to. voidsetParentQueue(Queue queue)Sets the parent queue for this server type. voidaddCompatibleClass(JobClass jobClass)Adds a job class to the list of classes that can be served by this server type. booleanremoveCompatibleClass(JobClass jobClass)Removes a job class from the list of compatible classes. booleanisCompatible(JobClass jobClass)Checks if a job class is compatible with this server type. intgetNumCompatibleClasses()Gets the number of compatible job classes. booleanhasCompatibleClasses()Checks if this server type has any compatible classes defined. StringtoString()-
-
Constructor Detail
-
ServerType
ServerType(String name, int numOfServers)
Creates a new server type with the specified name and number of servers.- Parameters:
name- the name identifying this server type (e.g.numOfServers- the number of servers of this type (must be >= 1)
-
ServerType
ServerType(String name, int numOfServers, List<JobClass> compatibleClasses)
Creates a new server type with the specified name, number of servers, and compatible classes.- Parameters:
name- the name identifying this server typenumOfServers- the number of servers of this type (must be >= 1)compatibleClasses- initial list of compatible job classes
-
-
Method Detail
-
getId
int getId()
Gets the unique identifier of this server type within its queue.
- Returns:
the server type ID, or -1 if not yet added to a queue
-
setId
void setId(int id)
Sets the unique identifier of this server type. This is typically called by the Queue when the server type is added.
- Parameters:
id- the ID to assign
-
getNumOfServers
int getNumOfServers()
Gets the number of servers of this type.
- Returns:
the number of servers
-
setNumOfServers
void setNumOfServers(int numOfServers)
Sets the number of servers of this type.
- Parameters:
numOfServers- the number of servers (must be >= 1)
-
getCompatibleClasses
List<JobClass> getCompatibleClasses()
Gets the list of job classes compatible with this server type.
- Returns:
a new list containing the compatible job classes
-
setCompatibleClasses
void setCompatibleClasses(List<JobClass> classes)
Sets the list of compatible job classes, replacing any existing list.
- Parameters:
classes- the list of job classes to set as compatible
-
getParentQueue
Queue getParentQueue()
Gets the parent queue this server type belongs to.
- Returns:
the parent queue, or null if not yet added to a queue
-
setParentQueue
void setParentQueue(Queue queue)
Sets the parent queue for this server type. This is typically called by the Queue when the server type is added.
- Parameters:
queue- the parent queue
-
addCompatibleClass
void addCompatibleClass(JobClass jobClass)
Adds a job class to the list of classes that can be served by this server type.
- Parameters:
jobClass- the job class to add as compatible
-
removeCompatibleClass
boolean removeCompatibleClass(JobClass jobClass)
Removes a job class from the list of compatible classes.
- Parameters:
jobClass- the job class to remove- Returns:
true if the class was removed, false if it was not in the list
-
isCompatible
boolean isCompatible(JobClass jobClass)
Checks if a job class is compatible with this server type.
- Parameters:
jobClass- the job class to check- Returns:
true if the class can be served by this server type
-
getNumCompatibleClasses
int getNumCompatibleClasses()
Gets the number of compatible job classes.
- Returns:
the count of compatible classes
-
hasCompatibleClasses
boolean hasCompatibleClasses()
Checks if this server type has any compatible classes defined.
- Returns:
true if at least one compatible class is defined
-
-
-
-