Skip to content
This repository was archived by the owner on Jan 28, 2020. It is now read-only.

Commit b79ee54

Browse files
committed
Merge pull request #8 from flavioperezcarreto/master
Fix founds with SonarQube
2 parents 5e9a251 + 3d0f2c7 commit b79ee54

7 files changed

Lines changed: 372 additions & 353 deletions

File tree

src/main/java/org/elasticsearch/plugins/changes/ChangesPlugin.java

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,27 @@
2626
import org.elasticsearch.plugins.changes.module.ChangesModule;
2727

2828
public class ChangesPlugin extends AbstractPlugin {
29-
private static final ESLogger log=Loggers.getLogger(ChangesPlugin.class);
30-
private final Collection<Class<? extends Module>> modules;
31-
32-
public ChangesPlugin() {
33-
log.info("Starting ChangesPlugin");
34-
35-
Collection<Class<? extends Module>> tempList=new ArrayList<Class<? extends Module>>(1);
36-
tempList.add(ChangesModule.class);
37-
modules=Collections.unmodifiableCollection(tempList);
38-
}
39-
40-
@Override
41-
public Collection<Class<? extends Module>> modules() {
42-
return modules;
43-
}
44-
45-
public String description() {
46-
return "Changes Plugin";
47-
}
48-
49-
public String name() {
50-
return "changes";
51-
}
29+
private static final ESLogger LOG = Loggers.getLogger(ChangesPlugin.class);
30+
private final Collection<Class<? extends Module>> modules;
31+
32+
public ChangesPlugin() {
33+
LOG.info("Starting ChangesPlugin");
34+
35+
Collection<Class<? extends Module>> tempList=new ArrayList<Class<? extends Module>>(1);
36+
tempList.add(ChangesModule.class);
37+
modules=Collections.unmodifiableCollection(tempList);
38+
}
39+
40+
@Override
41+
public Collection<Class<? extends Module>> modules() {
42+
return modules;
43+
}
44+
45+
public String description() {
46+
return "Changes Plugin";
47+
}
48+
49+
public String name() {
50+
return "changes";
51+
}
5252
}

src/main/java/org/elasticsearch/plugins/changes/beans/Change.java

Lines changed: 66 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -16,54 +16,70 @@
1616
package org.elasticsearch.plugins.changes.beans;
1717

1818
public class Change implements Comparable<Change> {
19-
long timestamp;
20-
Type type;
21-
String id;
22-
long version;
23-
24-
public long getTimestamp() {
25-
return timestamp;
26-
}
27-
28-
public void setTimestamp(long timestamp) {
29-
this.timestamp = timestamp;
30-
}
31-
32-
public Type getType() {
33-
return type;
34-
}
35-
36-
public void setType(Type type) {
37-
this.type = type;
38-
}
39-
40-
public String getId() {
41-
return id;
42-
}
43-
44-
public void setId(String id) {
45-
this.id = id;
46-
}
47-
48-
public long getVersion() {
49-
return version;
50-
}
51-
52-
public void setVersion(long version) {
53-
this.version = version;
54-
}
55-
56-
public enum Type {
57-
INDEX,CREATE,DELETE;
58-
}
59-
60-
public int compareTo(Change o) {
61-
if (this.timestamp<o.timestamp) {
62-
return -1;
63-
} else if (this.timestamp>o.timestamp) {
64-
return 1;
65-
} else {
66-
return 0;
67-
}
68-
}
19+
long timestamp;
20+
Type type;
21+
String id;
22+
long version;
23+
24+
public long getTimestamp() {
25+
return timestamp;
26+
}
27+
28+
public void setTimestamp(long timestamp) {
29+
this.timestamp = timestamp;
30+
}
31+
32+
public Type getType() {
33+
return type;
34+
}
35+
36+
public void setType(Type type) {
37+
this.type = type;
38+
}
39+
40+
public String getId() {
41+
return id;
42+
}
43+
44+
public void setId(String id) {
45+
this.id = id;
46+
}
47+
48+
public long getVersion() {
49+
return version;
50+
}
51+
52+
public void setVersion(long version) {
53+
this.version = version;
54+
}
55+
56+
public enum Type {
57+
INDEX,CREATE,DELETE;
58+
}
59+
60+
@Override
61+
public int compareTo(Change o) {
62+
if (this.timestamp<o.timestamp) {
63+
return -1;
64+
} else if (this.timestamp>o.timestamp) {
65+
return 1;
66+
} else {
67+
return 0;
68+
}
69+
}
70+
71+
@Override
72+
public boolean equals(Object o) {
73+
if (!(o instanceof Change)) {
74+
return false;
75+
}
76+
77+
Change other = (Change)o;
78+
return this.timestamp == other.timestamp;
79+
}
80+
81+
@Override
82+
public int hashCode() {
83+
return this.hashCode();
84+
}
6985
}

src/main/java/org/elasticsearch/plugins/changes/beans/IndexChangeWatcher.java

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -19,42 +19,42 @@
1919
import java.util.concurrent.TimeUnit;
2020

2121
public class IndexChangeWatcher {
22-
String indexName;
23-
Change change;
24-
Semaphore barrier;
25-
long timeout;
26-
27-
public IndexChangeWatcher() {
28-
this.barrier=new Semaphore(0);
29-
this.timeout=15*60*1000;
30-
}
31-
32-
public IndexChangeWatcher(long timeout) {
33-
this.barrier=new Semaphore(0);
34-
this.timeout=timeout;
35-
}
36-
37-
public void permit() {
38-
barrier.release();
39-
}
40-
41-
public boolean aquire() throws InterruptedException {
42-
return barrier.tryAcquire(timeout, TimeUnit.MILLISECONDS);
43-
}
44-
45-
public String getIndexName() {
46-
return indexName;
47-
}
48-
49-
public void setIndexName(String indexName) {
50-
this.indexName = indexName;
51-
}
52-
53-
public Change getChange() {
54-
return change;
55-
}
56-
57-
public void setChange(Change change) {
58-
this.change = change;
59-
}
22+
String indexName;
23+
Change change;
24+
Semaphore barrier;
25+
long timeout;
26+
27+
public IndexChangeWatcher() {
28+
this.barrier=new Semaphore(0);
29+
this.timeout=15*60*1000;
30+
}
31+
32+
public IndexChangeWatcher(long timeout) {
33+
this.barrier=new Semaphore(0);
34+
this.timeout=timeout;
35+
}
36+
37+
public void permit() {
38+
barrier.release();
39+
}
40+
41+
public boolean aquire() throws InterruptedException {
42+
return barrier.tryAcquire(timeout, TimeUnit.MILLISECONDS);
43+
}
44+
45+
public String getIndexName() {
46+
return indexName;
47+
}
48+
49+
public void setIndexName(String indexName) {
50+
this.indexName = indexName;
51+
}
52+
53+
public Change getChange() {
54+
return change;
55+
}
56+
57+
public void setChange(Change change) {
58+
this.change = change;
59+
}
6060
}

0 commit comments

Comments
 (0)