Remove unnecessary code

This commit is contained in:
Ville Skyttä 2016-03-26 15:02:05 +02:00 committed by jbertram
parent 6fbf80ed2a
commit 3a2d5de49e
8 changed files with 41 additions and 60 deletions

View File

@ -473,7 +473,7 @@ public class ActiveMQSession implements QueueSession, TopicSession {
else {
localTopic = new ActiveMQTopic(topic.getTopicName());
}
return internalCreateSharedConsumer(localTopic, name, messageSelector, ConsumerDurability.NON_DURABLE, true);
return internalCreateSharedConsumer(localTopic, name, messageSelector, ConsumerDurability.NON_DURABLE);
}
@Override
@ -523,7 +523,7 @@ public class ActiveMQSession implements QueueSession, TopicSession {
else {
localTopic = new ActiveMQTopic(topic.getTopicName());
}
return internalCreateSharedConsumer(localTopic, name, messageSelector, ConsumerDurability.DURABLE, true);
return internalCreateSharedConsumer(localTopic, name, messageSelector, ConsumerDurability.DURABLE);
}
enum ConsumerDurability {
@ -536,8 +536,7 @@ public class ActiveMQSession implements QueueSession, TopicSession {
private ActiveMQMessageConsumer internalCreateSharedConsumer(final ActiveMQDestination dest,
final String subscriptionName,
String selectorString,
ConsumerDurability durability,
final boolean shared) throws JMSException {
ConsumerDurability durability) throws JMSException {
try {
if (dest.isQueue()) {

View File

@ -16,7 +16,6 @@
*/
package org.apache.activemq.artemis.core.protocol.stomp.v12;
import org.apache.activemq.artemis.core.protocol.stomp.FrameEventListener;
import org.apache.activemq.artemis.core.protocol.stomp.ActiveMQStompException;
import org.apache.activemq.artemis.core.protocol.stomp.Stomp;
import org.apache.activemq.artemis.core.protocol.stomp.StompConnection;
@ -30,7 +29,7 @@ import org.apache.activemq.artemis.core.server.ServerMessage;
import static org.apache.activemq.artemis.core.protocol.stomp.ActiveMQStompProtocolMessageBundle.BUNDLE;
public class StompFrameHandlerV12 extends StompFrameHandlerV11 implements FrameEventListener {
public class StompFrameHandlerV12 extends StompFrameHandlerV11 {
public StompFrameHandlerV12(StompConnection connection) {
super(connection);

View File

@ -158,7 +158,7 @@ public abstract class ComparisonExpression extends BinaryExpression implements B
@Override
public boolean matches(Filterable message) throws FilterException {
Object object = evaluate(message);
return object != null && object == Boolean.TRUE;
return object == Boolean.TRUE;
}
}
@ -392,19 +392,19 @@ public abstract class ComparisonExpression extends BinaryExpression implements B
}
else if (lc == Byte.class) {
if (rc == Short.class) {
lv = Short.valueOf(((Number) lv).shortValue());
lv = ((Number) lv).shortValue();
}
else if (rc == Integer.class) {
lv = Integer.valueOf(((Number) lv).intValue());
lv = ((Number) lv).intValue();
}
else if (rc == Long.class) {
lv = Long.valueOf(((Number) lv).longValue());
lv = ((Number) lv).longValue();
}
else if (rc == Float.class) {
lv = new Float(((Number) lv).floatValue());
lv = ((Number) lv).floatValue();
}
else if (rc == Double.class) {
lv = new Double(((Number) lv).doubleValue());
lv = ((Number) lv).doubleValue();
}
else if (convertStringExpressions && rc == String.class) {
rv = Byte.valueOf((String) rv);
@ -415,16 +415,16 @@ public abstract class ComparisonExpression extends BinaryExpression implements B
}
else if (lc == Short.class) {
if (rc == Integer.class) {
lv = Integer.valueOf(((Number) lv).intValue());
lv = ((Number) lv).intValue();
}
else if (rc == Long.class) {
lv = Long.valueOf(((Number) lv).longValue());
lv = ((Number) lv).longValue();
}
else if (rc == Float.class) {
lv = new Float(((Number) lv).floatValue());
lv = ((Number) lv).floatValue();
}
else if (rc == Double.class) {
lv = new Double(((Number) lv).doubleValue());
lv = ((Number) lv).doubleValue();
}
else if (convertStringExpressions && rc == String.class) {
rv = Short.valueOf((String) rv);
@ -435,13 +435,13 @@ public abstract class ComparisonExpression extends BinaryExpression implements B
}
else if (lc == Integer.class) {
if (rc == Long.class) {
lv = Long.valueOf(((Number) lv).longValue());
lv = ((Number) lv).longValue();
}
else if (rc == Float.class) {
lv = new Float(((Number) lv).floatValue());
lv = ((Number) lv).floatValue();
}
else if (rc == Double.class) {
lv = new Double(((Number) lv).doubleValue());
lv = ((Number) lv).doubleValue();
}
else if (convertStringExpressions && rc == String.class) {
rv = Integer.valueOf((String) rv);
@ -452,13 +452,13 @@ public abstract class ComparisonExpression extends BinaryExpression implements B
}
else if (lc == Long.class) {
if (rc == Integer.class) {
rv = Long.valueOf(((Number) rv).longValue());
rv = ((Number) rv).longValue();
}
else if (rc == Float.class) {
lv = new Float(((Number) lv).floatValue());
lv = ((Number) lv).floatValue();
}
else if (rc == Double.class) {
lv = new Double(((Number) lv).doubleValue());
lv = ((Number) lv).doubleValue();
}
else if (convertStringExpressions && rc == String.class) {
rv = Long.valueOf((String) rv);
@ -468,14 +468,11 @@ public abstract class ComparisonExpression extends BinaryExpression implements B
}
}
else if (lc == Float.class) {
if (rc == Integer.class) {
rv = new Float(((Number) rv).floatValue());
}
else if (rc == Long.class) {
rv = new Float(((Number) rv).floatValue());
if (rc == Integer.class || rc == Long.class) {
rv = ((Number) rv).floatValue();
}
else if (rc == Double.class) {
lv = new Double(((Number) lv).doubleValue());
lv = ((Number) lv).doubleValue();
}
else if (convertStringExpressions && rc == String.class) {
rv = Float.valueOf((String) rv);
@ -485,14 +482,8 @@ public abstract class ComparisonExpression extends BinaryExpression implements B
}
}
else if (lc == Double.class) {
if (rc == Integer.class) {
rv = new Double(((Number) rv).doubleValue());
}
else if (rc == Long.class) {
rv = new Double(((Number) rv).doubleValue());
}
else if (rc == Float.class) {
rv = new Double(((Number) rv).doubleValue());
if (rc == Integer.class || rc == Long.class || rc == Float.class) {
rv = ((Number) rv).doubleValue();
}
else if (convertStringExpressions && rc == String.class) {
rv = Double.valueOf((String) rv);
@ -545,7 +536,7 @@ public abstract class ComparisonExpression extends BinaryExpression implements B
@Override
public boolean matches(Filterable message) throws FilterException {
Object object = evaluate(message);
return object != null && object == Boolean.TRUE;
return object == Boolean.TRUE;
}
}

View File

@ -87,7 +87,7 @@ public abstract class LogicExpression extends BinaryExpression implements Boolea
@Override
public boolean matches(Filterable message) throws FilterException {
Object object = evaluate(message);
return object != null && object == Boolean.TRUE;
return object == Boolean.TRUE;
}
}

View File

@ -86,13 +86,7 @@ public abstract class UnaryExpression implements Expression {
return null;
}
if ((inList != null && inList.contains(rvalue)) ^ not) {
return Boolean.TRUE;
}
else {
return Boolean.FALSE;
}
return (inList != null && inList.contains(rvalue)) ^ not;
}
@Override
@ -138,7 +132,7 @@ public abstract class UnaryExpression implements Expression {
@Override
public boolean matches(Filterable message) throws FilterException {
Object object = evaluate(message);
return object != null && object == Boolean.TRUE;
return object == Boolean.TRUE;
}
}
@ -150,7 +144,7 @@ public abstract class UnaryExpression implements Expression {
if (lvalue == null) {
return null;
}
return lvalue.booleanValue() ? Boolean.FALSE : Boolean.TRUE;
return !lvalue.booleanValue();
}
@Override
@ -179,7 +173,7 @@ public abstract class UnaryExpression implements Expression {
if (!rvalue.getClass().equals(Boolean.class)) {
return Boolean.FALSE;
}
return ((Boolean) rvalue).booleanValue() ? Boolean.TRUE : Boolean.FALSE;
return ((Boolean) rvalue).booleanValue();
}
@Override
@ -197,16 +191,16 @@ public abstract class UnaryExpression implements Expression {
private static Number negate(Number left) {
Class clazz = left.getClass();
if (clazz == Integer.class) {
return new Integer(-left.intValue());
return -left.intValue();
}
else if (clazz == Long.class) {
return new Long(-left.longValue());
return -left.longValue();
}
else if (clazz == Float.class) {
return new Float(-left.floatValue());
return -left.floatValue();
}
else if (clazz == Double.class) {
return new Double(-left.doubleValue());
return -left.doubleValue();
}
else if (clazz == BigDecimal.class) {
// We ussually get a big deciamal when we have Long.MIN_VALUE

View File

@ -77,7 +77,7 @@ public final class XPathExpression implements BooleanExpression {
@Override
public boolean matches(Filterable message) throws FilterException {
Object object = evaluate(message);
return object != null && object == Boolean.TRUE;
return object == Boolean.TRUE;
}
}

View File

@ -46,7 +46,7 @@ public final class XQueryExpression implements BooleanExpression {
@Override
public boolean matches(Filterable message) throws FilterException {
Object object = evaluate(message);
return object != null && object == Boolean.TRUE;
return object == Boolean.TRUE;
}
}

View File

@ -265,13 +265,11 @@ public final class BindingsImpl implements Bindings {
boolean routed = false;
if (!exclusiveBindings.isEmpty()) {
for (Binding binding : exclusiveBindings) {
if (binding.getFilter() == null || binding.getFilter().match(message)) {
binding.getBindable().route(message, context);
for (Binding binding : exclusiveBindings) {
if (binding.getFilter() == null || binding.getFilter().match(message)) {
binding.getBindable().route(message, context);
routed = true;
}
routed = true;
}
}