This closes #2650
This commit is contained in:
commit
bd6d5ecd72
|
@ -239,13 +239,7 @@ public final class XmlDataImporter extends ActionAbstract {
|
|||
messages = new TreeSet<XMLMessageImporter.MessageInfo>(new Comparator<XMLMessageImporter.MessageInfo>() {
|
||||
@Override
|
||||
public int compare(XMLMessageImporter.MessageInfo o1, XMLMessageImporter.MessageInfo o2) {
|
||||
if (o1.id == o2.id) {
|
||||
return 0;
|
||||
} else if (o1.id > o2.id) {
|
||||
return 1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
return Long.compare(o1.id, o2.id);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -25,10 +25,10 @@ import java.util.Arrays;
|
|||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -131,10 +131,10 @@ public class ConcurrentLongHashSetTest {
|
|||
final int threadIdx = i;
|
||||
|
||||
futures.add(executor.submit(() -> {
|
||||
Random random = new Random();
|
||||
final ThreadLocalRandom random = ThreadLocalRandom.current();
|
||||
|
||||
for (int j = 0; j < N; j++) {
|
||||
long key = Math.abs(random.nextLong());
|
||||
long key = random.nextLong(Long.MAX_VALUE);
|
||||
// Ensure keys are unique
|
||||
key -= key % (threadIdx + 1);
|
||||
|
||||
|
@ -165,10 +165,10 @@ public class ConcurrentLongHashSetTest {
|
|||
final int threadIdx = i;
|
||||
|
||||
futures.add(executor.submit(() -> {
|
||||
Random random = new Random();
|
||||
final ThreadLocalRandom random = ThreadLocalRandom.current();
|
||||
|
||||
for (int j = 0; j < N; j++) {
|
||||
long key = Math.abs(random.nextLong());
|
||||
long key = random.nextLong(Long.MAX_VALUE);
|
||||
// Ensure keys are unique
|
||||
key -= key % (threadIdx + 1);
|
||||
|
||||
|
|
|
@ -27,11 +27,11 @@ import java.util.ArrayList;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
|
@ -94,10 +94,10 @@ public class PriorityCollectionTest {
|
|||
final int threadIdx = i;
|
||||
|
||||
futures.add(executor.submit(() -> {
|
||||
Random random = new Random();
|
||||
final ThreadLocalRandom random = ThreadLocalRandom.current();
|
||||
|
||||
for (int j = 0; j < N; j++) {
|
||||
long key = Math.abs(random.nextLong());
|
||||
long key = random.nextLong(Long.MAX_VALUE);
|
||||
// Ensure keys are unique
|
||||
key -= key % (threadIdx + 1);
|
||||
|
||||
|
@ -128,10 +128,10 @@ public class PriorityCollectionTest {
|
|||
final int threadIdx = i;
|
||||
|
||||
futures.add(executor.submit(() -> {
|
||||
Random random = new Random();
|
||||
ThreadLocalRandom random = ThreadLocalRandom.current();
|
||||
|
||||
for (int j = 0; j < N; j++) {
|
||||
long key = Math.abs(random.nextLong());
|
||||
long key = random.nextLong(Long.MAX_VALUE);
|
||||
// Ensure keys are unique
|
||||
key -= key % (threadIdx + 1);
|
||||
|
||||
|
|
|
@ -387,7 +387,7 @@ public class ClientMessageImpl extends CoreMessage implements ClientMessageInter
|
|||
if (isLargeMessage()) {
|
||||
return getBodyBuffer().writerIndex();
|
||||
} else {
|
||||
return getBodyBuffer().writerIndex() - BODY_OFFSET;
|
||||
return (long) getBodyBuffer().writerIndex() - BODY_OFFSET;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ final class MappedSequentialFile implements SequentialFile {
|
|||
@Override
|
||||
public boolean fits(int size) {
|
||||
checkIsOpen();
|
||||
final long newPosition = this.mappedFile.position() + size;
|
||||
final long newPosition = (long) this.mappedFile.position() + size;
|
||||
final boolean hasRemaining = newPosition <= this.mappedFile.length();
|
||||
return hasRemaining;
|
||||
}
|
||||
|
|
|
@ -1641,7 +1641,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
|
|||
@Override
|
||||
public int compare(final Entry<Xid, Long> entry1, final Entry<Xid, Long> entry2) {
|
||||
// sort by creation time, oldest first
|
||||
return (int) (entry1.getValue() - entry2.getValue());
|
||||
return entry1.getValue().compareTo(entry2.getValue());
|
||||
}
|
||||
});
|
||||
String[] s = new String[xidsSortedByCreationTime.size()];
|
||||
|
@ -1680,7 +1680,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
|
|||
@Override
|
||||
public int compare(final Entry<Xid, Long> entry1, final Entry<Xid, Long> entry2) {
|
||||
// sort by creation time, oldest first
|
||||
return (int) (entry1.getValue() - entry2.getValue());
|
||||
return entry1.getValue().compareTo(entry2.getValue());
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1727,7 +1727,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
|
|||
@Override
|
||||
public int compare(final Entry<Xid, Long> entry1, final Entry<Xid, Long> entry2) {
|
||||
// sort by creation time, oldest first
|
||||
return (int) (entry1.getValue() - entry2.getValue());
|
||||
return entry1.getValue().compareTo(entry2.getValue());
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -110,13 +110,7 @@ public class PagePositionImpl implements PagePosition {
|
|||
return 1;
|
||||
} else if (pageNr < o.getPageNr()) {
|
||||
return -1;
|
||||
} else if (recordID > o.getRecordID()) {
|
||||
return 1;
|
||||
} else if (recordID < o.getRecordID()) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else return Long.compare(recordID, o.getRecordID());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1398,9 +1398,9 @@ public class QueueImpl extends CriticalComponentImpl implements Queue {
|
|||
if (pageSubscription != null) {
|
||||
// messageReferences will have depaged messages which we need to discount from the counter as they are
|
||||
// counted on the pageSubscription as well
|
||||
return pendingMetrics.getMessageCount() + getScheduledCount() + getDeliveringCount() + pageSubscription.getMessageCount();
|
||||
return (long) pendingMetrics.getMessageCount() + getScheduledCount() + getDeliveringCount() + pageSubscription.getMessageCount();
|
||||
} else {
|
||||
return pendingMetrics.getMessageCount() + getScheduledCount() + getDeliveringCount();
|
||||
return (long) pendingMetrics.getMessageCount() + getScheduledCount() + getDeliveringCount();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1419,9 +1419,9 @@ public class QueueImpl extends CriticalComponentImpl implements Queue {
|
|||
public long getDurableMessageCount() {
|
||||
if (isDurable()) {
|
||||
if (pageSubscription != null) {
|
||||
return pendingMetrics.getDurableMessageCount() + getDurableScheduledCount() + getDurableDeliveringCount() + pageSubscription.getMessageCount();
|
||||
return (long) pendingMetrics.getDurableMessageCount() + getDurableScheduledCount() + getDurableDeliveringCount() + pageSubscription.getMessageCount();
|
||||
} else {
|
||||
return pendingMetrics.getDurableMessageCount() + getDurableScheduledCount() + getDurableDeliveringCount();
|
||||
return (long) pendingMetrics.getDurableMessageCount() + getDurableScheduledCount() + getDurableDeliveringCount();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -1334,7 +1334,7 @@ public abstract class ActiveMQTestBase extends Assert {
|
|||
final ActiveMQServer backup) {
|
||||
ClientSessionFactoryInternal sessionFactory = (ClientSessionFactoryInternal) sessionFactoryP;
|
||||
final ActiveMQServerImpl actualServer = (ActiveMQServerImpl) backup;
|
||||
final long toWait = seconds * 1000;
|
||||
final long toWait = seconds * 1000L;
|
||||
final long time = System.currentTimeMillis();
|
||||
int loop = 0;
|
||||
//Note: if maxLoop is too small there won't be
|
||||
|
@ -1382,7 +1382,7 @@ public abstract class ActiveMQTestBase extends Assert {
|
|||
|
||||
public static final void waitForRemoteBackup(ClientSessionFactory sessionFactory, int seconds) {
|
||||
ClientSessionFactoryInternal factoryInternal = (ClientSessionFactoryInternal) sessionFactory;
|
||||
final long toWait = seconds * 1000;
|
||||
final long toWait = seconds * 1000L;
|
||||
final long time = System.currentTimeMillis();
|
||||
while (true) {
|
||||
if (factoryInternal.getBackupConnector() != null) {
|
||||
|
@ -1783,7 +1783,7 @@ public abstract class ActiveMQTestBase extends Assert {
|
|||
journal.load(committedRecords, preparedTransactions, null, false);
|
||||
|
||||
for (RecordInfo info : committedRecords) {
|
||||
Integer ikey = new Integer(info.getUserRecordType());
|
||||
Integer ikey = (int) info.getUserRecordType();
|
||||
AtomicInteger value = recordsType.get(ikey);
|
||||
if (value == null) {
|
||||
value = new AtomicInteger();
|
||||
|
@ -1812,7 +1812,7 @@ public abstract class ActiveMQTestBase extends Assert {
|
|||
if (key == 0) {
|
||||
System.out.println("huh?");
|
||||
}
|
||||
Integer ikey = new Integer(key);
|
||||
Integer ikey = (int) key;
|
||||
AtomicInteger value = recordsType.get(ikey);
|
||||
if (value == null) {
|
||||
value = new AtomicInteger();
|
||||
|
|
|
@ -1106,7 +1106,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase {
|
|||
public int compareTo(final OrderedConsumerHolder o) {
|
||||
int thisOrder = order;
|
||||
int otherOrder = o.order;
|
||||
return thisOrder < otherOrder ? -1 : thisOrder == otherOrder ? 0 : 1;
|
||||
return Integer.compare(thisOrder, otherOrder);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ public class PageCountSyncOnNonTXTest extends SpawnedTestBase {
|
|||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
timeToRun = 30000 + RandomUtil.randomPositiveInt() % 1000;
|
||||
timeToRun = 30000L + RandomUtil.randomPositiveInt() % 1000;
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue