-
Notifications
You must be signed in to change notification settings - Fork 913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ARTEMIS-196 Implement Consumer Priority #2488
Conversation
Ready for review. Ill look to merge within the week. As noted by the Jira ticket, this is to add feature that is in ActiveMQ5 (http://activemq.apache.org/consumer-priority.html) so part of bringing feature parity, also note feature is in RabbitMQ also. Think this might be the lowest Jira Ticket number i've worked on :) |
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/Consumer.java
Show resolved
Hide resolved
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueConsumers.java
Show resolved
Hide resolved
...is-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueConsumersImpl.java
Show resolved
Hide resolved
...is-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueConsumersImpl.java
Show resolved
Hide resolved
...is-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueConsumersImpl.java
Outdated
Show resolved
Hide resolved
...is-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueConsumersImpl.java
Show resolved
Hide resolved
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
Show resolved
Hide resolved
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
Show resolved
Hide resolved
...mis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ResetableIterator.java
Show resolved
Hide resolved
...apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionCreateConsumerMessage.java
Show resolved
Hide resolved
...apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionCreateConsumerMessage.java
Show resolved
Hide resolved
...ocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java
Show resolved
Hide resolved
I have taken a fast look and already written down some comment: it looks ok to me, but I need to look further in the |
@franz1981 alot of comments where why integer vs byte, whilst legacy ActiveMQ only supported 0-127 in open wire, many other brokers support integer for this feature, e.g. QPID for AMQP supports -2^31 to 2^31-1 like wise rabbitmq. e.g. RabbitMQ - https://www.rabbitmq.com/consumer-priority.html "Set the x-priority argument in the basic.consume method to an integer value" This is set on the consumer (its not per message) so size isn't an issue it makes sense to support the int and not constrain our selves un-neededly, making people migrating AMQP easier. |
@michaelandrepearce Yep, I have written it everytime while reading the code mate, sorry :) |
Reflection would not be good here, getArray is HOT path, its reason why i need it. Also it wont solve all issues, if you see i dont actually synconize in the Level, i removed this, as we have the sync only at the top level add, remove methods, thus saving extra locks that we would have if just extended CopyOnWriteArrayList. We still need a custom implementation as we need the array of levels, its just the design principles is based on CopyOnWriteArrayList, e.g. modifications modify the array by copying not changing the existing array, and all read access uses the existing arrays to avoid reads needing copies. E.g. read path = hotpath, modification is not. |
@michaelandrepearce Consider that a static final MethodHandle::invokeExact has performance similar to a direct call, not a reflective call http://mail.openjdk.java.net/pipermail/jigsaw-dev/2017-January/010894.html |
@franz1981 is that java 8? I thought it was Java 9+ |
@michaelandrepearce It has been introduced into Java 8 to support the lambda as they are now, Java 9 has introduced VarHandle, that has a similar name and overlapping functionalities :P |
2ee7eb7
to
d731ffe
Compare
@franz1981 can you check your private email, a few queries on MethodHandle ;) especially on a accessing method thats private/package but where the JVM doesnt allow reflection access override, due to security manager policy settings. |
Yep, it is a common scenario to use a security manager so I prefer to not force adding any exception on the security manger to allow just this calls to work |
Cool so will leave as is then. thanks for the review! |
Add consumer priority support Includes refactor of consumer iterating in QueueImpl to its own logical class, to be able to implement. Add OpenWire JMS Test - taken from ActiveMQ5 Add Core JMS Test Add AMQP Test Add Docs
d731ffe
to
d6c4036
Compare
Im going to close this for the other PR #2490 |
Add consumer priority support
Includes refactor of consumer iterating in QueueImpl to its own logical class, to be able to implement.
Add OpenWire JMS Test - taken from ActiveMQ5
Add Core JMS Test
Add AMQP Test
Add Docs