[
https://issues.apache.org/jira/browse/ARTEMIS-2118?focusedWorklogId=198383&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-198383
]
ASF GitHub Bot logged work on ARTEMIS-2118:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 13/Feb/19 22:50
Start Date: 13/Feb/19 22:50
Worklog Time Spent: 10m
Work Description: michaelandrepearce commented on pull request #2548:
ARTEMIS-2118 Enhanced Message Groups Support
URL: https://github.com/apache/activemq-artemis/pull/2548#discussion_r256623980
##########
File path:
artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/IntHashMap.java
##########
@@ -0,0 +1,878 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.utils.collections;
+
+import java.io.Serializable;
+import java.util.AbstractCollection;
+import java.util.AbstractSet;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Objects;
+import java.util.function.IntFunction;
+
+import static java.util.Objects.requireNonNull;
+
+/**
+ * {@link java.util.Map} implementation specialised for int keys using open
addressing and
+ * linear probing for cache efficient access.
+ *
+ * @param <V> type of values stored in the {@link java.util.Map}
+ */
+public class IntHashMap<V> implements Map<Integer, V>, Serializable {
+ /**
+ * Default load factor to be used in open addressing hashed data structures.
+ */
+ static final float DEFAULT_LOAD_FACTOR = 0.55f;
+ static final int MIN_CAPACITY = 8;
+
+ private final float loadFactor;
+ private int resizeThreshold;
+ private int size;
+ private final boolean shouldAvoidAllocation;
+
+ private int[] keys;
+ private Object[] values;
+
+ private ValueCollection valueCollection;
+ private KeySet keySet;
+ private EntrySet entrySet;
+
+ public IntHashMap() {
+ this(MIN_CAPACITY, DEFAULT_LOAD_FACTOR, true);
+ }
+
+ public IntHashMap(
+ final int initialCapacity,
+ final float loadFactor) {
+ this(initialCapacity, loadFactor, true);
+ }
+
+ /**
+ * Construct a new map allowing a configuration for initial capacity and
load factor.
+ * @param initialCapacity for the backing array
+ * @param loadFactor limit for resizing on puts
+ * @param shouldAvoidAllocation should allocation be avoided by caching
iterators and map entries.
+ */
+ public IntHashMap(
Review comment:
I actually dont need this class, just realised Netty has one, so can use it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 198383)
Time Spent: 3h 40m (was: 3.5h)
> Enhanced Message Groups Support
> --------------------------------
>
> Key: ARTEMIS-2118
> URL: https://issues.apache.org/jira/browse/ARTEMIS-2118
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Components: Broker
> Reporter: Michael Andre Pearce
> Assignee: Michael Andre Pearce
> Priority: Major
> Time Spent: 3h 40m
> Remaining Estimate: 0h
>
> This ticket is for supporting some Message Group Enhancements.
>
> Currently Artemis implements message groups in a simple way, equivalent to
> SimpleMessageGroupMap in activemq5.
> [http://activemq.apache.org/message-groups.html]
> "SimpleMessageGroupMap keeps track of every group but suffers from unbounded
> memory use."
>
> For use cases migrating from activemq5 its important artemis supports similar
> MessageGroupHashBucked feature.
> "MessageGroupHashBucked keeps track of every group and has bounded memory
> use."
> As such, this JIRA is to add support for being able to enable a semantic
> equivalent to MessageGroupHashBucket from activemq5, at the queue level.
>
> Also currently it is not possible for a specific queue disable grouping, this
> can be useful where a shared address by many queues, where some consumers
> care for ordering and others do not.
> Lastly add an ability to rebalance message groups when a consumer is added,
> this is useful where you want groups more evenly balanced when consumers come
> online, even after dispatching started.
>
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)