OpenSplice Java 5 DCPS  v6.x
OpenSplice Java 5 OpenSplice Data Distribution Service Data-Centric Publish-Subscribe API
SchedulingImpl.java
Go to the documentation of this file.
1 /*
2  * Vortex OpenSplice
3  *
4  * This software and documentation are Copyright 2006 to 2021 ADLINK
5  * Technology Limited, its affiliated companies and licensors. All rights
6  * reserved.
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21 package org.opensplice.dds.core.policy;
22 
28 
29 public class SchedulingImpl extends QosPolicyImpl implements
31  private static final long serialVersionUID = -4704717290713490662L;
32  private final int priority;
33  private final SchedulingKind schedulingKind;
34  private final SchedulingClass schedulingClass;
35 
37  super(environment);
38  this.priority = 0;
39  this.schedulingKind = SchedulingKind.ABSOLUTE;
40  this.schedulingClass = SchedulingClass.DEFAULT;
41  }
42 
44  SchedulingClass schedulingClass, SchedulingKind schedulingKind,
45  int priority) {
46  super(environment);
47 
48  if (schedulingClass == null) {
49  throw new IllegalArgumentExceptionImpl(environment,
50  "Invalid scheduling class supplied.");
51  }
52  if (schedulingKind == null) {
53  throw new IllegalArgumentExceptionImpl(environment,
54  "Invalid scheduling kind supplied.");
55  }
56  this.schedulingClass = schedulingClass;
57  this.schedulingKind = schedulingKind;
58  this.priority = priority;
59  }
60 
61  @Override
62  public int getPriority() {
63  return this.priority;
64  }
65 
66  @Override
68  return this.schedulingKind;
69  }
70 
71  @Override
73  return this.schedulingClass;
74  }
75 
76  @Override
77  public Scheduling withPriority(int priority) {
78  return new SchedulingImpl(this.environment, this.schedulingClass,
79  this.schedulingKind, priority);
80  }
81 
82  @Override
83  public Scheduling withKind(SchedulingKind schedulingKind) {
84  return new SchedulingImpl(this.environment, this.schedulingClass,
85  schedulingKind, this.priority);
86  }
87 
88  @Override
90  return new SchedulingImpl(this.environment, schedulingClass,
91  this.schedulingKind, this.priority);
92  }
93 
94  @Override
95  public Class<? extends QosPolicy> getPolicyClass() {
96  return Scheduling.class;
97  }
98 
99  @Override
100  public boolean equals(Object other) {
101  if (!(other instanceof SchedulingImpl)) {
102  return false;
103  }
104  SchedulingImpl s = (SchedulingImpl) other;
105 
106  if (s.priority != this.priority) {
107  return false;
108  }
109  if (s.schedulingClass != this.schedulingClass) {
110  return false;
111  }
112  return (s.schedulingKind == this.schedulingKind);
113  }
114 
115  @Override
116  public int hashCode() {
117  final int prime = 31;
118  int result = 17;
119 
120  result = prime * result + this.priority;
121  result = prime * result + this.schedulingClass.hashCode();
122 
123  return prime * result + this.schedulingKind.hashCode();
124  }
125 
126 }
Scheduling withSchedulingClass(SchedulingClass schedulingClass)
Copy this policy and override the value of the property.
SchedulingImpl(OsplServiceEnvironment environment)
specifies the priority type, which may be either RELATIVE or ABSOLUTE.
Definition: Scheduling.java:92
SchedulingImpl(OsplServiceEnvironment environment, SchedulingClass schedulingClass, SchedulingKind schedulingKind, int priority)
Scheduling withPriority(int priority)
Copy this policy and override the value of the priority that will be assigned to threads spawned by t...
Scheduling for the Watchdog thread of a org.omg.dds.domain.DomainParticipant.
This QosPolicy specifies the scheduling parameters that will be used for a thread that is spawned by ...
Definition: Scheduling.java:45
This class is the abstract root for all the QoS policies.
Definition: QosPolicy.java:118
specifies the scheduling class used by the Operating System, which may be DEFAULT, REALTIME or TIMESHARING.
Class<? extends QosPolicy > getPolicyClass()
Scheduling withKind(SchedulingKind schedulingKind)
Copy this policy and override the value of the property.
Scheduling for the Listener thread of a org.omg.dds.domain.DomainParticipant.