This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 2d844f02bc Mostly revert changes
2d844f02bc is described below
commit 2d844f02bc7c2e0ed18295d71e142ba5e44473aa
Author: remm <[email protected]>
AuthorDate: Thu Mar 20 12:47:16 2025 +0100
Mostly revert changes
Improve typing where it is easy, otherwise revert.
---
.../tribes/tipis/AbstractReplicatedMap.java | 38 +++++++++-------------
1 file changed, 16 insertions(+), 22 deletions(-)
diff --git a/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
b/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
index 3717a1b6e6..5fb1ceb925 100644
--- a/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
+++ b/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
@@ -170,7 +170,7 @@ public abstract class AbstractReplicatedMap<K, V>
* @param terminate - Flag for whether to terminate this map that
failed to start.
*/
public AbstractReplicatedMap(MapOwner owner, Channel channel, long
timeout, String mapContextName,
- int initialCapacity, float loadFactor, int channelSendOptions,
ClassLoader[] cls, boolean terminate) {
+ int initialCapacity, float loadFactor, int
channelSendOptions, ClassLoader[] cls, boolean terminate) {
innerMap = new ConcurrentHashMap<>(initialCapacity, loadFactor, 15);
init(owner, channel, mapContextName, timeout, channelSendOptions, cls,
terminate);
@@ -204,7 +204,7 @@ public abstract class AbstractReplicatedMap<K, V>
* @param terminate - Flag for whether to terminate this map that
failed to start.
*/
protected void init(MapOwner owner, Channel channel, String
mapContextName, long timeout, int channelSendOptions,
- ClassLoader[] cls, boolean terminate) {
+ ClassLoader[] cls, boolean terminate) {
long start = System.currentTimeMillis();
if (log.isInfoEnabled()) {
log.info(sm.getString("abstractReplicatedMap.init.start",
mapContextName));
@@ -225,12 +225,10 @@ public abstract class AbstractReplicatedMap<K, V>
// create a rpc channel and add the map as a listener
this.rpcChannel = new RpcChannel(this.mapContextName, channel, this);
- if (this.channel != null) {
- // add this map as a message listener
- this.channel.addChannelListener(this);
- // listen for membership notifications
- this.channel.addMembershipListener(this);
- }
+ // add this map as a message listener
+ this.channel.addChannelListener(this);
+ // listen for membership notifications
+ this.channel.addMembershipListener(this);
try {
// broadcast our map, this just notifies other members of our
existence
@@ -570,8 +568,7 @@ public abstract class AbstractReplicatedMap<K, V>
// backup request
if (mapmsg.getMsgType() == MapMessage.MSG_RETRIEVE_BACKUP) {
- @SuppressWarnings("unchecked")
- MapEntry<K,V> entry = innerMap.get((K) mapmsg.getKey());
+ MapEntry<K,V> entry = innerMap.get(mapmsg.getKey());
if (entry == null || (!entry.isSerializable())) {
return null;
}
@@ -675,7 +672,7 @@ public abstract class AbstractReplicatedMap<K, V>
}
if (mapmsg.getMsgType() == MapMessage.MSG_PROXY) {
- MapEntry<K,V> entry = innerMap.get((K) mapmsg.getKey());
+ MapEntry<K,V> entry = innerMap.get(mapmsg.getKey());
if (entry == null) {
entry = new MapEntry<>((K) mapmsg.getKey(), (V)
mapmsg.getValue());
MapEntry<K,V> old = innerMap.putIfAbsent(entry.getKey(),
entry);
@@ -691,11 +688,11 @@ public abstract class AbstractReplicatedMap<K, V>
}
if (mapmsg.getMsgType() == MapMessage.MSG_REMOVE) {
- innerMap.remove((K) mapmsg.getKey());
+ innerMap.remove(mapmsg.getKey());
}
if (mapmsg.getMsgType() == MapMessage.MSG_BACKUP ||
mapmsg.getMsgType() == MapMessage.MSG_COPY) {
- MapEntry<K,V> entry = innerMap.get((K) mapmsg.getKey());
+ MapEntry<K,V> entry = innerMap.get(mapmsg.getKey());
if (entry == null) {
entry = new MapEntry<>((K) mapmsg.getKey(), (V)
mapmsg.getValue());
entry.setBackup(mapmsg.getMsgType() == MapMessage.MSG_BACKUP);
@@ -750,7 +747,7 @@ public abstract class AbstractReplicatedMap<K, V>
} // end if
if (mapmsg.getMsgType() == MapMessage.MSG_ACCESS) {
- MapEntry<K,V> entry = innerMap.get((K) mapmsg.getKey());
+ MapEntry<K,V> entry = innerMap.get(mapmsg.getKey());
if (entry != null) {
entry.setBackupNodes(mapmsg.getBackupNodes());
entry.setPrimary(mapmsg.getPrimary());
@@ -761,7 +758,7 @@ public abstract class AbstractReplicatedMap<K, V>
}
if (mapmsg.getMsgType() == MapMessage.MSG_NOTIFY_MAPMEMBER) {
- MapEntry<K,V> entry = innerMap.get((K) mapmsg.getKey());
+ MapEntry<K,V> entry = innerMap.get(mapmsg.getKey());
if (entry != null) {
entry.setBackupNodes(mapmsg.getBackupNodes());
entry.setPrimary(mapmsg.getPrimary());
@@ -1000,8 +997,7 @@ public abstract class AbstractReplicatedMap<K, V>
}
public V remove(Object key, boolean notify) {
- @SuppressWarnings("unchecked")
- MapEntry<K,V> entry = innerMap.remove((K) key);
+ MapEntry<K,V> entry = innerMap.remove(key);
try {
if (getMapMembers().length > 0 && notify) {
@@ -1015,9 +1011,7 @@ public abstract class AbstractReplicatedMap<K, V>
return entry != null ? entry.getValue() : null;
}
- public MapEntry<K,V> getInternal(Object keyObject) {
- @SuppressWarnings("unchecked")
- K key = (K) keyObject;
+ public MapEntry<K,V> getInternal(Object key) {
return innerMap.get(key);
}
@@ -1261,7 +1255,7 @@ public abstract class AbstractReplicatedMap<K, V>
// todo, implement a counter variable instead
// only count active members in this node
int counter = 0;
- for (Entry<K,MapEntry<K,V>> e : innerMap.entrySet()) {
+ for (Entry<K,?> e : innerMap.entrySet()) {
if (e != null) {
MapEntry<K, V> entry = innerMap.get(e.getKey());
if (entry != null && entry.isActive() && entry.getValue() !=
null) {
@@ -1517,7 +1511,7 @@ public abstract class AbstractReplicatedMap<K, V>
}
public MapMessage(byte[] mapId, int msgtype, boolean diff,
Serializable key, Serializable value,
- byte[] diffvalue, Member primary, Member[] nodes) {
+ byte[] diffvalue, Member primary, Member[] nodes) {
this.mapId = mapId;
this.msgtype = msgtype;
this.diff = diff;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]