1
2
3
4
5
6
7
8
9
10
11 package org.mule.util.queue;
12
13 import org.mule.api.MuleContext;
14 import org.mule.api.store.ListableObjectStore;
15
16 import java.io.Serializable;
17
18 public class QueueConfiguration
19 {
20 protected final int capacity;
21 protected final ListableObjectStore<Serializable> objectStore;
22
23 public QueueConfiguration(MuleContext context, int capacity, ListableObjectStore<Serializable> objectStore)
24 {
25 this.capacity = capacity;
26 this.objectStore = objectStore;
27 }
28
29 public QueueConfiguration(int capacity, ListableObjectStore<Serializable> objectStore)
30 {
31 this.capacity = capacity;
32 this.objectStore = objectStore;
33 }
34
35 @Override
36 public int hashCode()
37 {
38 final int prime = 31;
39 int result = 1;
40 result = prime * result + capacity;
41 result = prime * result + objectStore.hashCode();
42 return result;
43 }
44
45 @Override
46 public boolean equals(Object obj)
47 {
48 if (this == obj)
49 {
50 return true;
51 }
52 if (obj == null)
53 {
54 return false;
55 }
56 if (getClass() != obj.getClass())
57 {
58 return false;
59 }
60 QueueConfiguration other = (QueueConfiguration) obj;
61 if (capacity != other.capacity)
62 {
63 return false;
64 }
65 if (!objectStore.equals(objectStore))
66 {
67 return false;
68 }
69 return true;
70 }
71
72 public boolean isPersistent()
73 {
74 return objectStore.isPersistent();
75 }
76 }