JobConsumerInfoImpl.java
2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* org.apache.sling.commons.osgi.PropertiesUtil
* org.osgi.framework.ServiceReference
*/
package com.adobe.granite.offloading.impl;
import com.adobe.granite.offloading.impl.JobConsumerInfo;
import org.apache.sling.commons.osgi.PropertiesUtil;
import org.osgi.framework.ServiceReference;
public class JobConsumerInfoImpl
implements JobConsumerInfo {
private ServiceReference serviceReference;
private String[] topics;
private long serviceID;
private int serviceRanking;
private String servicePID;
private boolean isExecutor;
public JobConsumerInfoImpl(ServiceReference serviceReference, boolean isExecutor) {
this.serviceReference = serviceReference;
this.isExecutor = isExecutor;
this.topics = PropertiesUtil.toStringArray((Object)serviceReference.getProperty("job.topics"));
this.serviceID = PropertiesUtil.toLong((Object)serviceReference.getProperty("service.id"), (long)0);
this.serviceRanking = PropertiesUtil.toInteger((Object)serviceReference.getProperty("service.ranking"), (int)-1);
this.servicePID = PropertiesUtil.toString((Object)serviceReference.getProperty("service.pid"), (String)"");
}
@Override
public int compareTo(JobConsumerInfo o) {
if (this.serviceRanking < o.getServiceRanking()) {
return 1;
}
if (this.serviceRanking > o.getServiceRanking()) {
return -1;
}
return this.serviceID < o.getServiceID() ? -1 : 1;
}
@Override
public String[] getTopics() {
return this.topics;
}
@Override
public long getServiceID() {
return this.serviceID;
}
@Override
public int getServiceRanking() {
return this.serviceRanking;
}
@Override
public String getServicePID() {
return this.servicePID;
}
@Override
public boolean isExecutor() {
return this.isExecutor;
}
public boolean equals(Object obj) {
if (obj instanceof JobConsumerInfo) {
return ((JobConsumerInfo)obj).getServiceID() == this.serviceID;
}
return false;
}
public int hashCode() {
return this.serviceReference.hashCode();
}
}