1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.syncope.common.lib.types;
20
21 import java.io.Serializable;
22 import org.apache.commons.lang3.builder.EqualsBuilder;
23 import org.apache.commons.lang3.builder.HashCodeBuilder;
24 import org.apache.commons.lang3.builder.ToStringBuilder;
25 import org.apache.commons.lang3.builder.ToStringStyle;
26
27 public class ThreadPoolSettings implements Serializable {
28
29 private static final long serialVersionUID = -3860071577309258396L;
30
31 private int corePoolSize = 1;
32
33 private int maxPoolSize = Integer.MAX_VALUE;
34
35 private int queueCapacity = Integer.MAX_VALUE;
36
37 public int getCorePoolSize() {
38 return corePoolSize;
39 }
40
41 public void setCorePoolSize(final int corePoolSize) {
42 this.corePoolSize = corePoolSize;
43 }
44
45 public int getMaxPoolSize() {
46 return maxPoolSize;
47 }
48
49 public void setMaxPoolSize(final int maxPoolSize) {
50 this.maxPoolSize = maxPoolSize;
51 }
52
53 public int getQueueCapacity() {
54 return queueCapacity;
55 }
56
57 public void setQueueCapacity(final int queueCapacity) {
58 this.queueCapacity = queueCapacity;
59 }
60
61 @Override
62 public int hashCode() {
63 return new HashCodeBuilder().
64 append(corePoolSize).
65 append(maxPoolSize).
66 append(queueCapacity).
67 build();
68 }
69
70 @Override
71 public boolean equals(final Object obj) {
72 if (this == obj) {
73 return true;
74 }
75 if (obj == null) {
76 return false;
77 }
78 if (getClass() != obj.getClass()) {
79 return false;
80 }
81 final ThreadPoolSettings other = (ThreadPoolSettings) obj;
82 return new EqualsBuilder().
83 append(corePoolSize, other.corePoolSize).
84 append(maxPoolSize, other.maxPoolSize).
85 append(queueCapacity, other.queueCapacity).
86 build();
87 }
88
89 @Override
90 public String toString() {
91 return new ToStringBuilder(this, ToStringStyle.SIMPLE_STYLE).
92 append(corePoolSize).
93 append(maxPoolSize).
94 append(queueCapacity).
95 build();
96 }
97 }