Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Please note that this build includes changes to meet upstreams requirements for nullability annotations. While we aim for a level of accuracy, these might not be 100% correct, if there are any issues, please speak to us on discord, or open an issue on the tracker to discuss. Bukkit Changes: 9a6a1de3 Remove nullability annotations from enum constructors 3f0591ea SPIGOT-2540: Add nullability annotations to entire Bukkit API CraftBukkit Changes: 8d8475fc SPIGOT-4666: Force parameter in HumanEntity#sleep 8b1588e2 Fix ExplosionPrimeEvent#setFire not working with EnderCrystals 39a287b7 Don't ignore newlines in PlayerListHeader/Footer Spigot Changes: cf694d87 Add nullability annotations
This commit is contained in:
parent
c3c889523f
commit
0976d52bbd
261 changed files with 3224 additions and 2923 deletions
|
@ -1,4 +1,4 @@
|
|||
From 6c27ed542ca4cd73af3d8ae98f29511c827003f3 Mon Sep 17 00:00:00 2001
|
||||
From 3fe3136ff948b8361bfadeb5e0acd6836bf8831c Mon Sep 17 00:00:00 2001
|
||||
From: crast <contact@jamescrasta.com>
|
||||
Date: Sat, 1 Jun 2013 13:52:30 -0600
|
||||
Subject: [PATCH] Reduce thread synchronization in MetadataStoreBase
|
||||
|
@ -8,31 +8,22 @@ limited synchronized portions to allow much higher concurrency in
|
|||
MetadataStore as well as far less locking, especially on reads
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/metadata/MetadataStoreBase.java b/src/main/java/org/bukkit/metadata/MetadataStoreBase.java
|
||||
index 093c1445..64c0f0a7 100644
|
||||
index 9dbc32d8..32728628 100644
|
||||
--- a/src/main/java/org/bukkit/metadata/MetadataStoreBase.java
|
||||
+++ b/src/main/java/org/bukkit/metadata/MetadataStoreBase.java
|
||||
@@ -4,9 +4,10 @@ import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
@@ -5,9 +5,10 @@ import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
+import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public abstract class MetadataStoreBase<T> {
|
||||
- private Map<String, Map<Plugin, MetadataValue>> metadataMap = new HashMap<String, Map<Plugin, MetadataValue>>();
|
||||
+ private Map<String, Map<Plugin, MetadataValue>> metadataMap = new ConcurrentHashMap<String, Map<Plugin, MetadataValue>>();
|
||||
+ private Map<String, Map<Plugin, MetadataValue>> metadataMap = new ConcurrentHashMap<String, Map<Plugin, MetadataValue>>(); // Paper
|
||||
|
||||
/**
|
||||
* Adds a metadata value to an object. Each metadata value is owned by a
|
||||
@@ -30,7 +31,7 @@ public abstract class MetadataStoreBase<T> {
|
||||
* @throws IllegalArgumentException If value is null, or the owning plugin
|
||||
* is null
|
||||
*/
|
||||
- public synchronized void setMetadata(T subject, String metadataKey, MetadataValue newMetadataValue) {
|
||||
+ public void setMetadata(T subject, String metadataKey, MetadataValue newMetadataValue) {
|
||||
Validate.notNull(newMetadataValue, "Value cannot be null");
|
||||
Plugin owningPlugin = newMetadataValue.getOwningPlugin();
|
||||
Validate.notNull(owningPlugin, "Plugin cannot be null");
|
||||
@@ -40,7 +41,9 @@ public abstract class MetadataStoreBase<T> {
|
||||
@@ -41,7 +42,9 @@ public abstract class MetadataStoreBase<T> {
|
||||
entry = new WeakHashMap<Plugin, MetadataValue>(1);
|
||||
metadataMap.put(key, entry);
|
||||
}
|
||||
|
@ -43,12 +34,12 @@ index 093c1445..64c0f0a7 100644
|
|||
}
|
||||
|
||||
/**
|
||||
@@ -53,10 +56,11 @@ public abstract class MetadataStoreBase<T> {
|
||||
* requested value.
|
||||
@@ -55,10 +58,11 @@ public abstract class MetadataStoreBase<T> {
|
||||
* @see MetadataStore#getMetadata(Object, String)
|
||||
*/
|
||||
- public synchronized List<MetadataValue> getMetadata(T subject, String metadataKey) {
|
||||
+ public List<MetadataValue> getMetadata(T subject, String metadataKey) {
|
||||
@NotNull
|
||||
- public synchronized List<MetadataValue> getMetadata(@NotNull T subject, @NotNull String metadataKey) {
|
||||
+ public List<MetadataValue> getMetadata(@NotNull T subject, @NotNull String metadataKey) { // Paper
|
||||
String key = disambiguate(subject, metadataKey);
|
||||
- if (metadataMap.containsKey(key)) {
|
||||
- Collection<MetadataValue> values = metadataMap.get(key).values();
|
||||
|
@ -58,21 +49,21 @@ index 093c1445..64c0f0a7 100644
|
|||
return Collections.unmodifiableList(new ArrayList<MetadataValue>(values));
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
@@ -71,7 +75,7 @@ public abstract class MetadataStoreBase<T> {
|
||||
@@ -73,7 +77,7 @@ public abstract class MetadataStoreBase<T> {
|
||||
* @param metadataKey the unique metadata key being queried.
|
||||
* @return the existence of the metadataKey within subject.
|
||||
*/
|
||||
- public synchronized boolean hasMetadata(T subject, String metadataKey) {
|
||||
+ public boolean hasMetadata(T subject, String metadataKey) {
|
||||
- public synchronized boolean hasMetadata(@NotNull T subject, @NotNull String metadataKey) {
|
||||
+ public boolean hasMetadata(@NotNull T subject, @NotNull String metadataKey) { // Paper
|
||||
String key = disambiguate(subject, metadataKey);
|
||||
return metadataMap.containsKey(key);
|
||||
}
|
||||
@@ -87,17 +91,18 @@ public abstract class MetadataStoreBase<T> {
|
||||
@@ -89,17 +93,18 @@ public abstract class MetadataStoreBase<T> {
|
||||
* org.bukkit.plugin.Plugin)
|
||||
* @throws IllegalArgumentException If plugin is null
|
||||
*/
|
||||
- public synchronized void removeMetadata(T subject, String metadataKey, Plugin owningPlugin) {
|
||||
+ public void removeMetadata(T subject, String metadataKey, Plugin owningPlugin) {
|
||||
- public synchronized void removeMetadata(@NotNull T subject, @NotNull String metadataKey, @NotNull Plugin owningPlugin) {
|
||||
+ public void removeMetadata(@NotNull T subject, @NotNull String metadataKey, @NotNull Plugin owningPlugin) { // Paper
|
||||
Validate.notNull(owningPlugin, "Plugin cannot be null");
|
||||
String key = disambiguate(subject, metadataKey);
|
||||
Map<Plugin, MetadataValue> entry = metadataMap.get(key);
|
||||
|
@ -91,15 +82,15 @@ index 093c1445..64c0f0a7 100644
|
|||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +115,7 @@ public abstract class MetadataStoreBase<T> {
|
||||
@@ -112,7 +117,7 @@ public abstract class MetadataStoreBase<T> {
|
||||
* @see MetadataStore#invalidateAll(org.bukkit.plugin.Plugin)
|
||||
* @throws IllegalArgumentException If plugin is null
|
||||
*/
|
||||
- public synchronized void invalidateAll(Plugin owningPlugin) {
|
||||
+ public void invalidateAll(Plugin owningPlugin) {
|
||||
- public synchronized void invalidateAll(@NotNull Plugin owningPlugin) {
|
||||
+ public void invalidateAll(@NotNull Plugin owningPlugin) { // Paper
|
||||
Validate.notNull(owningPlugin, "Plugin cannot be null");
|
||||
for (Map<Plugin, MetadataValue> values : metadataMap.values()) {
|
||||
if (values.containsKey(owningPlugin)) {
|
||||
--
|
||||
2.20.1
|
||||
2.21.0
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue