Skip to content

Commit 0ca5189

Browse files
improve overall performance & stability
1 parent ef7a270 commit 0ca5189

46 files changed

Lines changed: 104 additions & 199 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/main/java/su/interference/core/AllowRPredicate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ this software and associated documentation files (the "Software"), to deal in
2929
* @since 1.0
3030
*/
3131

32-
public interface AllowRPredicate {
32+
interface AllowRPredicate {
3333
boolean isAllowR();
3434
}

src/main/java/su/interference/core/ChunkIdComparator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public ChunkIdComparator(Session s) {
3939
this.s = s;
4040
}
4141

42+
@SuppressWarnings("unchecked")
4243
public int compare(Chunk c1, Chunk c2) {
4344
try {
4445
return c1.getId(null, s).compareTo(c2.getId(null, s));

src/main/java/su/interference/core/ChunkMap.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public ChunkMap(Frame frame) {
4747
this.frame = frame;
4848
}
4949

50+
@SuppressWarnings("unchecked")
5051
public synchronized void sort() {
5152
Collections.sort(list);
5253
sorted = true;

src/main/java/su/interference/core/DataChunkId.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ private byte[] getBytes(Field f, Object o) throws IllegalAccessException, Unsupp
6262
}
6363

6464
//serializer
65+
@SuppressWarnings("unchecked")
6566
public DataChunkId (Object o, Session s) throws IOException, InvocationTargetException, NoSuchMethodException, InternalException, ClassNotFoundException, InstantiationException, IllegalAccessException {
6667
Class c = o.getClass();
6768
final SystemEntity sa = (SystemEntity)c.getAnnotation(SystemEntity.class);

src/main/java/su/interference/core/EntityFactory.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public EntityFactory(Class<T> cl, Session s) {
7171
this.s = s;
7272
}
7373

74+
@SuppressWarnings("unchecked")
7475
public T get(Object[] params) {
7576
T o = null;
7677
try {

src/main/java/su/interference/core/Frame.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -360,11 +360,7 @@ public synchronized byte[] getFrame() throws InvalidFrame {
360360
}
361361

362362
public boolean equals (Frame bl) {
363-
if ((this.file==bl.getFile())&&(this.pointer==bl.getPointer())) {
364-
return true;
365-
} else {
366-
return false;
367-
}
363+
return (this.file == bl.getFile()) && (this.pointer == bl.getPointer());
368364
}
369365

370366
public int compareTo(Object obj) {
@@ -456,8 +452,7 @@ public synchronized int updateChunk(DataChunk chunk, Object o, Session s, LLT ll
456452
// chunk.getHeader().setState(Header.RECORD_UPDATED_STATE);
457453
chunk.getHeader().setLen(ncb.length);
458454
chunk.getHeader().setTran(tran);
459-
final int newlen = chunk.getBytesAmount();
460-
return newlen;
455+
return chunk.getBytesAmount();
461456
}
462457

463458
public synchronized void deleteChunk (int ptr, Session s, LLT llt) {
@@ -608,6 +603,7 @@ public synchronized void rollbackTransaction(Transaction tran, ArrayList<FrameDa
608603
llt.commit();
609604
}
610605

606+
@SuppressWarnings("unchecked")
611607
public HashMap getLiveTransactions() {
612608
final HashMap rtran = new HashMap<Long, Transaction>();
613609
for (Chunk c : data.getChunks()) {

src/main/java/su/interference/core/IndexElementKey.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public IndexElementKey (int p1, long p2) {
5353
this.key[1] = p2;
5454
}
5555

56+
@SuppressWarnings("unchecked")
5657
public int compareTo(final Object obj) {
5758
final IndexElementKey j = (IndexElementKey)obj;
5859

@@ -72,8 +73,7 @@ public int compareTo(final Object obj) {
7273

7374
public boolean equals(final Object obj) {
7475
final IndexElementKey j = (IndexElementKey)obj;
75-
if (this.compareTo(j) == 0) { return true; }
76-
return false;
76+
return this.compareTo(j) == 0;
7777
}
7878

7979
public Object[] getKey() {

src/main/java/su/interference/core/IndexElementList.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,10 @@ public IndexElement get(final int index) {
127127
}
128128

129129
private boolean isFill() {
130-
if (this.elementList.size()>=MAX_LIST_SIZE) {
131-
return true;
132-
}
133-
return false;
130+
return this.elementList.size() >= MAX_LIST_SIZE;
134131
}
135132

133+
@SuppressWarnings("unchecked")
136134
public synchronized IndexElementKey sort() {
137135
Collections.sort(this.elementList);
138136
this.sorted = true;

src/main/java/su/interference/core/IndexFrame.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,7 @@ public DataChunk get (int index) {
219219
}
220220

221221
private boolean isFill(DataChunk ie) {
222-
if (ie.getBytesAmount()>this.getFrameFree()) {
223-
return true;
224-
}
225-
return false;
222+
return ie.getBytesAmount() > this.getFrameFree();
226223
}
227224

228225
public ValueSet sort() throws InternalException {

src/main/java/su/interference/core/Instance.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ private static void registerMetrics() throws Exception {
421421
Metrics.register(Metrics.METER, "imUndoFrames");
422422
}
423423

424+
@SuppressWarnings("unchecked")
424425
private void checkInMemoryIndexes() {
425426
final MapField map = tt.getMapFieldByColumn("name");
426427
final Set<Map.Entry> xx = map.getMap().entrySet();
@@ -430,6 +431,7 @@ private void checkInMemoryIndexes() {
430431
}
431432
}
432433

434+
@SuppressWarnings("unchecked")
433435
private void startProcesses(Session s) throws Exception {
434436
final Table t = getTableByName("su.interference.persistent.Process");
435437
final List<Process> pss = Instance.getInstance().getProcesses();
@@ -704,8 +706,7 @@ public TransFrame getTransFrameById(long transId, long cframeId, long uframe) {
704706
@Deprecated
705707
public synchronized ArrayList<TransFrame> getTransFrameByObjectId (int objectId) {
706708
//final Table t = getTableByName("su.interference.persistent.TransFrame");
707-
final ArrayList<TransFrame> r = new ArrayList<TransFrame>();
708-
return r;
709+
return new ArrayList<TransFrame>();
709710
}
710711

711712
public RetrieveLock getRetrieveLockById(RetrieveLock p) {

0 commit comments

Comments
 (0)