ARTEMIS-4345: update to Error Prone 2.20.0 and fix up new errors
This commit is contained in:
parent
f60a7d5c04
commit
cb9e1fedc8
|
@ -48,9 +48,8 @@ public class FileBrokerTest {
|
||||||
public void startWithoutJMS() throws Exception {
|
public void startWithoutJMS() throws Exception {
|
||||||
ServerDTO serverDTO = new ServerDTO();
|
ServerDTO serverDTO = new ServerDTO();
|
||||||
serverDTO.configuration = "broker-nojms.xml";
|
serverDTO.configuration = "broker-nojms.xml";
|
||||||
FileBroker broker = null;
|
FileBroker broker = new FileBroker(serverDTO, new ActiveMQJAASSecurityManager(), null);
|
||||||
try {
|
try {
|
||||||
broker = new FileBroker(serverDTO, new ActiveMQJAASSecurityManager(), null);
|
|
||||||
broker.start();
|
broker.start();
|
||||||
JMSServerManagerImpl jmsServerManager = (JMSServerManagerImpl) broker.getComponents().get("jms");
|
JMSServerManagerImpl jmsServerManager = (JMSServerManagerImpl) broker.getComponents().get("jms");
|
||||||
Assert.assertNull(jmsServerManager);
|
Assert.assertNull(jmsServerManager);
|
||||||
|
@ -59,7 +58,6 @@ public class FileBrokerTest {
|
||||||
Assert.assertTrue(activeMQServer.isStarted());
|
Assert.assertTrue(activeMQServer.isStarted());
|
||||||
Assert.assertTrue(broker.isStarted());
|
Assert.assertTrue(broker.isStarted());
|
||||||
} finally {
|
} finally {
|
||||||
assert broker != null;
|
|
||||||
broker.stop();
|
broker.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,7 +143,6 @@ public class FileBrokerTest {
|
||||||
|
|
||||||
locator.close();
|
locator.close();
|
||||||
} finally {
|
} finally {
|
||||||
assert broker != null;
|
|
||||||
broker.stop();
|
broker.stop();
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
replacePatternInFile(path, "X", "guest");
|
replacePatternInFile(path, "X", "guest");
|
||||||
|
@ -194,7 +191,6 @@ public class FileBrokerTest {
|
||||||
|
|
||||||
locator.close();
|
locator.close();
|
||||||
} finally {
|
} finally {
|
||||||
assert broker != null;
|
|
||||||
broker.stop();
|
broker.stop();
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
replacePatternInFile(path, "X", "guest");
|
replacePatternInFile(path, "X", "guest");
|
||||||
|
|
|
@ -106,7 +106,9 @@ public class ActiveMQScheduledComponentTest {
|
||||||
local.start();
|
local.start();
|
||||||
final long newInitialDelay = 1000;
|
final long newInitialDelay = 1000;
|
||||||
//the parameters are valid?
|
//the parameters are valid?
|
||||||
assert initialDelay != newInitialDelay && newInitialDelay != period;
|
Assert.assertTrue(initialDelay != newInitialDelay);
|
||||||
|
Assert.assertTrue(newInitialDelay != period);
|
||||||
|
|
||||||
local.setInitialDelay(newInitialDelay);
|
local.setInitialDelay(newInitialDelay);
|
||||||
local.stop();
|
local.stop();
|
||||||
Assert.assertEquals("the initial dalay can't change", newInitialDelay, local.getInitialDelay());
|
Assert.assertEquals("the initial dalay can't change", newInitialDelay, local.getInitialDelay());
|
||||||
|
|
|
@ -160,7 +160,7 @@ public class SparseArrayLinkedListTest {
|
||||||
for (int i = 1; i < elements; i++) {
|
for (int i = 1; i < elements; i++) {
|
||||||
list.add(i);
|
list.add(i);
|
||||||
}
|
}
|
||||||
Assert.assertEquals(elements - 1, list.remove(e -> e != zero));
|
Assert.assertEquals(elements - 1, list.remove(e -> !zero.equals(e)));
|
||||||
final ArrayList<Integer> remaining = new ArrayList<>();
|
final ArrayList<Integer> remaining = new ArrayList<>();
|
||||||
Assert.assertEquals(1, list.clear(remaining::add));
|
Assert.assertEquals(1, list.clear(remaining::add));
|
||||||
Assert.assertEquals(0, list.size());
|
Assert.assertEquals(0, list.size());
|
||||||
|
|
|
@ -25,6 +25,7 @@ import java.util.HashMap;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.jgroups.JChannel;
|
import org.jgroups.JChannel;
|
||||||
|
@ -51,20 +52,8 @@ public final class ActiveMQRaUtils {
|
||||||
* @param you Second value
|
* @param you Second value
|
||||||
* @return True if object equals else false.
|
* @return True if object equals else false.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("StringEquality")
|
|
||||||
public static boolean compare(final String me, final String you) {
|
public static boolean compare(final String me, final String you) {
|
||||||
// If both null or intern equals
|
return Objects.equals(me, you);
|
||||||
if (me == you) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if me null and you are not
|
|
||||||
if (me == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// me will not be null, test for equality
|
|
||||||
return me.equals(you);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,18 +64,7 @@ public final class ActiveMQRaUtils {
|
||||||
* @return True if object equals else false.
|
* @return True if object equals else false.
|
||||||
*/
|
*/
|
||||||
public static boolean compare(final Integer me, final Integer you) {
|
public static boolean compare(final Integer me, final Integer you) {
|
||||||
// If both null or intern equals
|
return Objects.equals(me, you);
|
||||||
if (me == you) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if me null and you are not
|
|
||||||
if (me == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// me will not be null, test for equality
|
|
||||||
return me.equals(you);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -97,18 +75,7 @@ public final class ActiveMQRaUtils {
|
||||||
* @return True if object equals else false.
|
* @return True if object equals else false.
|
||||||
*/
|
*/
|
||||||
public static boolean compare(final Long me, final Long you) {
|
public static boolean compare(final Long me, final Long you) {
|
||||||
// If both null or intern equals
|
return Objects.equals(me, you);
|
||||||
if (me == you) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if me null and you are not
|
|
||||||
if (me == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// me will not be null, test for equality
|
|
||||||
return me.equals(you);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -119,18 +86,7 @@ public final class ActiveMQRaUtils {
|
||||||
* @return True if object equals else false.
|
* @return True if object equals else false.
|
||||||
*/
|
*/
|
||||||
public static boolean compare(final Double me, final Double you) {
|
public static boolean compare(final Double me, final Double you) {
|
||||||
// If both null or intern equals
|
return Objects.equals(me, you);
|
||||||
if (me == you) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if me null and you are not
|
|
||||||
if (me == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// me will not be null, test for equality
|
|
||||||
return me.equals(you);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -141,18 +97,7 @@ public final class ActiveMQRaUtils {
|
||||||
* @return True if object equals else false.
|
* @return True if object equals else false.
|
||||||
*/
|
*/
|
||||||
public static boolean compare(final Boolean me, final Boolean you) {
|
public static boolean compare(final Boolean me, final Boolean you) {
|
||||||
// If both null or intern equals
|
return Objects.equals(me, you);
|
||||||
if (me == you) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if me null and you are not
|
|
||||||
if (me == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// me will not be null, test for equality
|
|
||||||
return me.equals(you);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -828,9 +828,9 @@ public class ActiveMQActivationSpec extends ConnectionFactoryProperties implemen
|
||||||
|
|
||||||
if (acknowledgeMode != null ? !acknowledgeMode.equals(that.acknowledgeMode) : that.acknowledgeMode != null)
|
if (acknowledgeMode != null ? !acknowledgeMode.equals(that.acknowledgeMode) : that.acknowledgeMode != null)
|
||||||
return false;
|
return false;
|
||||||
if (subscriptionDurability != that.subscriptionDurability)
|
if (subscriptionDurability != null ? !subscriptionDurability.equals(that.subscriptionDurability) : that.subscriptionDurability != null)
|
||||||
return false;
|
return false;
|
||||||
if (shareSubscriptions != that.shareSubscriptions)
|
if (shareSubscriptions != null ? !shareSubscriptions.equals(that.shareSubscriptions) : that.shareSubscriptions != null)
|
||||||
return false;
|
return false;
|
||||||
if (strConnectorClassName != null ? !strConnectorClassName.equals(that.strConnectorClassName) : that.strConnectorClassName != null)
|
if (strConnectorClassName != null ? !strConnectorClassName.equals(that.strConnectorClassName) : that.strConnectorClassName != null)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1410,9 +1410,18 @@ public class ConfigurationImplTest extends ActiveMQTestBase {
|
||||||
|
|
||||||
Assert.assertEquals(1, configuration.getSecurityRoles().size());
|
Assert.assertEquals(1, configuration.getSecurityRoles().size());
|
||||||
Assert.assertEquals(1, configuration.getSecurityRoles().get("TEST").size());
|
Assert.assertEquals(1, configuration.getSecurityRoles().get("TEST").size());
|
||||||
Assert.assertTrue(configuration.getSecurityRoles().get("TEST").stream().findFirst().orElse(null).isConsume());
|
|
||||||
Assert.assertTrue(configuration.getSecurityRoles().get("TEST").stream().findFirst().orElse(null).isSend());
|
Role role = configuration.getSecurityRoles().get("TEST").stream().findFirst().orElse(null);
|
||||||
Assert.assertFalse(configuration.getSecurityRoles().get("TEST").stream().findFirst().orElse(null).isCreateAddress());
|
Assert.assertNotNull(role);
|
||||||
|
Assert.assertTrue(role.isConsume());
|
||||||
|
|
||||||
|
role = configuration.getSecurityRoles().get("TEST").stream().findFirst().orElse(null);
|
||||||
|
Assert.assertNotNull(role);
|
||||||
|
Assert.assertTrue(role.isSend());
|
||||||
|
|
||||||
|
role = configuration.getSecurityRoles().get("TEST").stream().findFirst().orElse(null);
|
||||||
|
Assert.assertNotNull(role);
|
||||||
|
Assert.assertFalse(role.isCreateAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1450,8 +1459,14 @@ public class ConfigurationImplTest extends ActiveMQTestBase {
|
||||||
// verify new addition
|
// verify new addition
|
||||||
Assert.assertEquals(2, configuration.getSecurityRoles().size());
|
Assert.assertEquals(2, configuration.getSecurityRoles().size());
|
||||||
Assert.assertEquals(1, configuration.getSecurityRoles().get("TEST").size());
|
Assert.assertEquals(1, configuration.getSecurityRoles().get("TEST").size());
|
||||||
Assert.assertFalse(configuration.getSecurityRoles().get("TEST").stream().findFirst().orElse(null).isConsume());
|
|
||||||
Assert.assertTrue(configuration.getSecurityRoles().get("TEST").stream().findFirst().orElse(null).isSend());
|
Role role = configuration.getSecurityRoles().get("TEST").stream().findFirst().orElse(null);
|
||||||
|
Assert.assertNotNull(role);
|
||||||
|
Assert.assertFalse(role.isConsume());
|
||||||
|
|
||||||
|
role = configuration.getSecurityRoles().get("TEST").stream().findFirst().orElse(null);
|
||||||
|
Assert.assertNotNull(role);
|
||||||
|
Assert.assertTrue(role.isSend());
|
||||||
|
|
||||||
// verify augmentation
|
// verify augmentation
|
||||||
Assert.assertEquals(2, configuration.getSecurityRoles().get("#").size());
|
Assert.assertEquals(2, configuration.getSecurityRoles().get("#").size());
|
||||||
|
|
6
pom.xml
6
pom.xml
|
@ -103,7 +103,7 @@
|
||||||
<jetty.version>10.0.15</jetty.version>
|
<jetty.version>10.0.15</jetty.version>
|
||||||
<tomcat.servlet-api.version>8.5.78</tomcat.servlet-api.version>
|
<tomcat.servlet-api.version>8.5.78</tomcat.servlet-api.version>
|
||||||
<jgroups.version>5.2.0.Final</jgroups.version>
|
<jgroups.version>5.2.0.Final</jgroups.version>
|
||||||
<errorprone.version>2.10.0</errorprone.version>
|
<errorprone.version>2.20.0</errorprone.version>
|
||||||
<maven.bundle.plugin.version>5.1.9</maven.bundle.plugin.version>
|
<maven.bundle.plugin.version>5.1.9</maven.bundle.plugin.version>
|
||||||
<maven.checkstyle.plugin.version>3.2.2</maven.checkstyle.plugin.version>
|
<maven.checkstyle.plugin.version>3.2.2</maven.checkstyle.plugin.version>
|
||||||
<jib.maven.plugin.version>3.3.2</jib.maven.plugin.version>
|
<jib.maven.plugin.version>3.3.2</jib.maven.plugin.version>
|
||||||
|
@ -1099,7 +1099,7 @@
|
||||||
<arg>--add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED</arg>
|
<arg>--add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED</arg>
|
||||||
<arg>--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED</arg>
|
<arg>--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED</arg>
|
||||||
<arg>-XDcompilePolicy=simple</arg>
|
<arg>-XDcompilePolicy=simple</arg>
|
||||||
<arg>-Xplugin:ErrorProne -Xep:ThreadLocalUsage:ERROR -Xep:MissingOverride:ERROR -Xep:NonAtomicVolatileUpdate:ERROR -Xep:SynchronizeOnNonFinalField:ERROR -Xep:StaticQualifiedUsingExpression:ERROR -Xep:WaitNotInLoop:ERROR -XepExcludedPaths:.*/generated-sources/.*</arg>
|
<arg>-Xplugin:ErrorProne -Xep:ThreadLocalUsage:ERROR -Xep:MissingOverride:ERROR -Xep:NonAtomicVolatileUpdate:ERROR -Xep:SynchronizeOnNonFinalField:ERROR -Xep:StaticQualifiedUsingExpression:ERROR -Xep:WaitNotInLoop:ERROR -Xep:BanJNDI:OFF -XepExcludedPaths:.*/generated-sources/.*</arg>
|
||||||
</compilerArgs>
|
</compilerArgs>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
@ -1133,7 +1133,7 @@
|
||||||
<arg>--add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED</arg>
|
<arg>--add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED</arg>
|
||||||
<arg>--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED</arg>
|
<arg>--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED</arg>
|
||||||
<arg>-XDcompilePolicy=simple</arg>
|
<arg>-XDcompilePolicy=simple</arg>
|
||||||
<arg>-Xplugin:ErrorProne -Xep:ThreadLocalUsage:ERROR -Xep:MissingOverride:WARN -Xep:NonAtomicVolatileUpdate:ERROR -Xep:SynchronizeOnNonFinalField:ERROR -Xep:StaticQualifiedUsingExpression:ERROR -Xep:WaitNotInLoop:ERROR -XepExcludedPaths:.*/generated-sources/.*</arg>
|
<arg>-Xplugin:ErrorProne -Xep:ThreadLocalUsage:ERROR -Xep:MissingOverride:WARN -Xep:NonAtomicVolatileUpdate:ERROR -Xep:SynchronizeOnNonFinalField:ERROR -Xep:StaticQualifiedUsingExpression:ERROR -Xep:WaitNotInLoop:ERROR -Xep:BanJNDI:OFF -XepExcludedPaths:.*/generated-sources/.*</arg>
|
||||||
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
|
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
|
||||||
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
|
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
|
||||||
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
|
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
|
||||||
|
|
|
@ -685,7 +685,8 @@ public class LargeMessageCompressTest extends LargeMessageTest {
|
||||||
int compressed = deflater.deflate(output);
|
int compressed = deflater.deflate(output);
|
||||||
deflater.end();
|
deflater.end();
|
||||||
|
|
||||||
assert compressed > min && compressed < max;
|
Assert.assertTrue(compressed > min);
|
||||||
|
Assert.assertTrue(compressed < max);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -33,6 +33,7 @@ import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||||
|
@ -213,11 +214,7 @@ public abstract class StompTestBase extends ActiveMQTestBase {
|
||||||
|
|
||||||
final String role = "testRole";
|
final String role = "testRole";
|
||||||
securityManager.getConfiguration().addRole(defUser, role);
|
securityManager.getConfiguration().addRole(defUser, role);
|
||||||
config.getSecurityRoles().put("#", new HashSet<Role>() {
|
config.getSecurityRoles().put("#", new HashSet<Role>(Set.of(new Role(role, true, true, true, true, true, true, true, true, true, true))));
|
||||||
{
|
|
||||||
add(new Role(role, true, true, true, true, true, true, true, true, true, true));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return activeMQServer;
|
return activeMQServer;
|
||||||
|
|
|
@ -21,6 +21,7 @@ import javax.jms.Queue;
|
||||||
import javax.jms.Topic;
|
import javax.jms.Topic;
|
||||||
import javax.management.MBeanServer;
|
import javax.management.MBeanServer;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.activemq.artemis.api.core.TransportConfiguration;
|
import org.apache.activemq.artemis.api.core.TransportConfiguration;
|
||||||
import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
|
import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
|
||||||
|
@ -162,11 +163,7 @@ public class JMSClusteredTestBase extends ActiveMQTestBase {
|
||||||
.setMaxHops(MAX_HOPS)
|
.setMaxHops(MAX_HOPS)
|
||||||
.setConfirmationWindowSize(1024)
|
.setConfirmationWindowSize(1024)
|
||||||
.setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND)
|
.setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND)
|
||||||
.setStaticConnectors(new ArrayList<String>() {
|
.setStaticConnectors(new ArrayList<String>(List.of(destinationLabel))));
|
||||||
{
|
|
||||||
add(destinationLabel);
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
configuration.getAddressSettings().put("#", new AddressSettings().setRedistributionDelay(0));
|
configuration.getAddressSettings().put("#", new AddressSettings().setRedistributionDelay(0));
|
||||||
|
|
||||||
|
|
|
@ -361,7 +361,7 @@ public class TimedBufferTest extends ActiveMQTestBase {
|
||||||
public void timeoutShouldMatchFlushIOPSWithNotBlockingFlush() {
|
public void timeoutShouldMatchFlushIOPSWithNotBlockingFlush() {
|
||||||
//use a large timeout in order to be reactive
|
//use a large timeout in order to be reactive
|
||||||
final long timeout = TimeUnit.MILLISECONDS.toNanos(100);
|
final long timeout = TimeUnit.MILLISECONDS.toNanos(100);
|
||||||
assert ((int) timeout) > 0;
|
assertTrue(timeout > 0);
|
||||||
//it is optimistic: the timeout and the blockingDeviceFlushTime are a perfect match
|
//it is optimistic: the timeout and the blockingDeviceFlushTime are a perfect match
|
||||||
final long deviceTime = timeout;
|
final long deviceTime = timeout;
|
||||||
final int bufferSize = Env.osPageSize();
|
final int bufferSize = Env.osPageSize();
|
||||||
|
@ -374,7 +374,7 @@ public class TimedBufferTest extends ActiveMQTestBase {
|
||||||
//wait the first flush to happen
|
//wait the first flush to happen
|
||||||
observer.waitUntilFlushIsDone(1);
|
observer.waitUntilFlushIsDone(1);
|
||||||
//for a not-blocking flush I'm expecting the TimedBuffer has near to finished sleeping now
|
//for a not-blocking flush I'm expecting the TimedBuffer has near to finished sleeping now
|
||||||
assert observer.flushesDone() == 1;
|
assertEquals(1, observer.flushesDone());
|
||||||
//issue a new write
|
//issue a new write
|
||||||
timedBuffer.addBytes(LONG_ENCODER, true, DummyCallback.getInstance());
|
timedBuffer.addBytes(LONG_ENCODER, true, DummyCallback.getInstance());
|
||||||
//the countdown on the TimedBuffer is already started even before this addBytes
|
//the countdown on the TimedBuffer is already started even before this addBytes
|
||||||
|
@ -383,7 +383,7 @@ public class TimedBufferTest extends ActiveMQTestBase {
|
||||||
observer.waitUntilFlushIsDone(2);
|
observer.waitUntilFlushIsDone(2);
|
||||||
final long flushDone = System.nanoTime();
|
final long flushDone = System.nanoTime();
|
||||||
final long elapsedTime = flushDone - endOfWriteRequest;
|
final long elapsedTime = flushDone - endOfWriteRequest;
|
||||||
assert observer.flushesDone() == 2;
|
assertEquals(2, observer.flushesDone());
|
||||||
//it is much more than what is expected!!if it will fail it means that the timed IOPS = 1/(timeout + blockingDeviceFlushTime)!!!!!!
|
//it is much more than what is expected!!if it will fail it means that the timed IOPS = 1/(timeout + blockingDeviceFlushTime)!!!!!!
|
||||||
//while it has to be IOPS = 1/timeout
|
//while it has to be IOPS = 1/timeout
|
||||||
logger.debug("elapsed time: {} with timeout: {}", elapsedTime, timeout);
|
logger.debug("elapsed time: {} with timeout: {}", elapsedTime, timeout);
|
||||||
|
@ -402,7 +402,7 @@ public class TimedBufferTest extends ActiveMQTestBase {
|
||||||
public void timeoutShouldMatchFlushIOPSWithBlockingFlush() {
|
public void timeoutShouldMatchFlushIOPSWithBlockingFlush() {
|
||||||
//use a large timeout in order to be reactive
|
//use a large timeout in order to be reactive
|
||||||
final long timeout = TimeUnit.MILLISECONDS.toNanos(100);
|
final long timeout = TimeUnit.MILLISECONDS.toNanos(100);
|
||||||
assert ((int) timeout) > 0;
|
assertTrue(timeout > 0);
|
||||||
//it is optimistic: the timeout and the blockingDeviceFlushTime are a perfect match
|
//it is optimistic: the timeout and the blockingDeviceFlushTime are a perfect match
|
||||||
final long deviceTime = timeout;
|
final long deviceTime = timeout;
|
||||||
final int bufferSize = Env.osPageSize();
|
final int bufferSize = Env.osPageSize();
|
||||||
|
@ -415,7 +415,7 @@ public class TimedBufferTest extends ActiveMQTestBase {
|
||||||
//wait the first flush to happen
|
//wait the first flush to happen
|
||||||
observer.waitUntilFlushIsDone(1);
|
observer.waitUntilFlushIsDone(1);
|
||||||
//for a blocking flush I'm expecting the TimedBuffer has started sleeping now
|
//for a blocking flush I'm expecting the TimedBuffer has started sleeping now
|
||||||
assert observer.flushesDone() == 1;
|
assertEquals(1, observer.flushesDone());
|
||||||
//issue a new write
|
//issue a new write
|
||||||
timedBuffer.addBytes(LONG_ENCODER, true, DummyCallback.getInstance());
|
timedBuffer.addBytes(LONG_ENCODER, true, DummyCallback.getInstance());
|
||||||
//the countdown on the TimedBuffer is already started even before this addBytes
|
//the countdown on the TimedBuffer is already started even before this addBytes
|
||||||
|
@ -424,7 +424,7 @@ public class TimedBufferTest extends ActiveMQTestBase {
|
||||||
observer.waitUntilFlushIsDone(2);
|
observer.waitUntilFlushIsDone(2);
|
||||||
final long flushDone = System.nanoTime();
|
final long flushDone = System.nanoTime();
|
||||||
final long elapsedTime = flushDone - endOfWriteRequest;
|
final long elapsedTime = flushDone - endOfWriteRequest;
|
||||||
assert observer.flushesDone() == 2;
|
assertEquals(2, observer.flushesDone());
|
||||||
//it is much more than what is expected!!if it will fail it means that the timed IOPS = 1/(timeout + blockingDeviceFlushTime)!!!!!!
|
//it is much more than what is expected!!if it will fail it means that the timed IOPS = 1/(timeout + blockingDeviceFlushTime)!!!!!!
|
||||||
//while it has to be IOPS = 1/timeout
|
//while it has to be IOPS = 1/timeout
|
||||||
logger.debug("elapsed time: {} with timeout: {}", elapsedTime, timeout);
|
logger.debug("elapsed time: {} with timeout: {}", elapsedTime, timeout);
|
||||||
|
|
Loading…
Reference in New Issue