Remove monitored locks (fair), use basic version
This commit is contained in:
@@ -23,8 +23,6 @@ import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.ItemFactory;
|
||||
import constants.game.GameConstants;
|
||||
import net.server.audit.locks.MonitoredLockType;
|
||||
import net.server.audit.locks.factory.MonitoredReentrantLockFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import provider.Data;
|
||||
@@ -42,6 +40,7 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
/**
|
||||
* @author Matze
|
||||
@@ -57,7 +56,7 @@ public class Storage {
|
||||
private byte slots;
|
||||
private final Map<InventoryType, List<Item>> typeItems = new HashMap<>();
|
||||
private List<Item> items = new LinkedList<>();
|
||||
private final Lock lock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.STORAGE, true);
|
||||
private final Lock lock = new ReentrantLock(true);
|
||||
|
||||
private Storage(int id, byte slots, int meso) {
|
||||
this.id = id;
|
||||
|
||||
@@ -28,9 +28,6 @@ import constants.id.MobId;
|
||||
import net.packet.Packet;
|
||||
import net.server.PlayerStorage;
|
||||
import net.server.Server;
|
||||
import net.server.audit.locks.MonitoredLockType;
|
||||
import net.server.audit.locks.MonitoredReentrantLock;
|
||||
import net.server.audit.locks.factory.MonitoredReentrantLockFactory;
|
||||
import net.server.channel.Channel;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -45,6 +42,8 @@ import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.MINUTES;
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
@@ -100,7 +99,7 @@ public class Expedition {
|
||||
private final boolean silent;
|
||||
private final int minSize;
|
||||
private final int maxSize;
|
||||
private final MonitoredReentrantLock pL = MonitoredReentrantLockFactory.createLock(MonitoredLockType.EIM_PARTY, true);
|
||||
private final Lock pL = new ReentrantLock(true);
|
||||
|
||||
public Expedition(Character player, ExpeditionType met, boolean sil, int minPlayers, int maxPlayers) {
|
||||
leader = player;
|
||||
|
||||
@@ -29,10 +29,6 @@ import config.YamlConfig;
|
||||
import constants.id.MobId;
|
||||
import constants.skills.*;
|
||||
import net.packet.Packet;
|
||||
import net.server.audit.LockCollector;
|
||||
import net.server.audit.locks.MonitoredLockType;
|
||||
import net.server.audit.locks.MonitoredReentrantLock;
|
||||
import net.server.audit.locks.factory.MonitoredReentrantLockFactory;
|
||||
import net.server.channel.Channel;
|
||||
import net.server.coordinator.world.MonsterAggroCoordinator;
|
||||
import net.server.services.task.channel.MobAnimationService;
|
||||
@@ -101,7 +97,7 @@ public class Monster extends AbstractLoadedLife {
|
||||
private boolean availablePuppetUpdate = true;
|
||||
|
||||
private final Lock externalLock = new ReentrantLock();
|
||||
private MonitoredReentrantLock monsterLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.MOB, true);
|
||||
private final Lock monsterLock = new ReentrantLock(true);
|
||||
private final Lock statiLock = new ReentrantLock();
|
||||
private final Lock animationLock = new ReentrantLock();
|
||||
private final Lock aggroUpdateLock = new ReentrantLock();
|
||||
@@ -2197,14 +2193,5 @@ public class Monster extends AbstractLoadedLife {
|
||||
}
|
||||
|
||||
this.getMap().dismissRemoveAfter(this);
|
||||
disposeLocks();
|
||||
}
|
||||
|
||||
private void disposeLocks() {
|
||||
LockCollector.getInstance().registerDisposeAction(() -> emptyLocks());
|
||||
}
|
||||
|
||||
private void emptyLocks() {
|
||||
monsterLock = monsterLock.dispose();
|
||||
}
|
||||
}
|
||||
@@ -25,13 +25,12 @@ import client.Character;
|
||||
import client.Client;
|
||||
import constants.game.GameConstants;
|
||||
import constants.id.MapId;
|
||||
import net.server.audit.locks.MonitoredLockType;
|
||||
import net.server.audit.locks.MonitoredReentrantLock;
|
||||
import net.server.audit.locks.factory.MonitoredReentrantLockFactory;
|
||||
import scripting.portal.PortalScriptManager;
|
||||
import tools.PacketCreator;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
public class GenericPortal implements Portal {
|
||||
private String name;
|
||||
@@ -43,7 +42,7 @@ public class GenericPortal implements Portal {
|
||||
private int id;
|
||||
private String scriptName;
|
||||
private boolean portalState;
|
||||
private MonitoredReentrantLock scriptLock = null;
|
||||
private Lock scriptLock = null;
|
||||
|
||||
public GenericPortal(int type) {
|
||||
this.type = type;
|
||||
@@ -120,7 +119,7 @@ public class GenericPortal implements Portal {
|
||||
|
||||
if (scriptName != null) {
|
||||
if (scriptLock == null) {
|
||||
scriptLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.PORTAL, true);
|
||||
scriptLock = new ReentrantLock(true);
|
||||
}
|
||||
} else {
|
||||
scriptLock = null;
|
||||
|
||||
@@ -33,8 +33,6 @@ import client.processor.npc.FredrickProcessor;
|
||||
import config.YamlConfig;
|
||||
import net.packet.Packet;
|
||||
import net.server.Server;
|
||||
import net.server.audit.locks.MonitoredLockType;
|
||||
import net.server.audit.locks.factory.MonitoredReentrantLockFactory;
|
||||
import server.ItemInformationProvider;
|
||||
import server.Trade;
|
||||
import tools.DatabaseConnection;
|
||||
@@ -50,6 +48,7 @@ import java.time.Instant;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
/**
|
||||
* @author XoticStory
|
||||
@@ -76,7 +75,7 @@ public class HiredMerchant extends AbstractMapObject {
|
||||
private final Visitor[] visitors = new Visitor[3];
|
||||
private final LinkedList<PastVisitor> visitorHistory = new LinkedList<>();
|
||||
private final LinkedHashSet<String> blacklist = new LinkedHashSet<>(); // case-sensitive character names
|
||||
private final Lock visitorLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.VISITOR_MERCH, true);
|
||||
private final Lock visitorLock = new ReentrantLock(true);
|
||||
|
||||
private record Visitor(Character chr, Instant enteredAt) {}
|
||||
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
package server.maps;
|
||||
|
||||
import client.Character;
|
||||
import net.server.audit.locks.MonitoredLockType;
|
||||
import net.server.audit.locks.factory.MonitoredReentrantLockFactory;
|
||||
import server.TimerManager;
|
||||
import tools.PacketCreator;
|
||||
|
||||
@@ -29,6 +27,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
|
||||
@@ -38,7 +37,7 @@ import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
public class MiniDungeon {
|
||||
List<Character> players = new ArrayList<>();
|
||||
ScheduledFuture<?> timeoutTask = null;
|
||||
Lock lock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.MINIDUNGEON, true);
|
||||
private final Lock lock = new ReentrantLock(true);
|
||||
|
||||
int baseMap;
|
||||
long expireTime;
|
||||
|
||||
@@ -29,8 +29,6 @@ import client.inventory.Item;
|
||||
import client.inventory.manipulator.InventoryManipulator;
|
||||
import client.inventory.manipulator.KarmaManipulator;
|
||||
import net.packet.Packet;
|
||||
import net.server.audit.locks.MonitoredLockType;
|
||||
import net.server.audit.locks.factory.MonitoredReentrantLockFactory;
|
||||
import server.Trade;
|
||||
import tools.PacketCreator;
|
||||
import tools.Pair;
|
||||
@@ -38,6 +36,7 @@ import tools.Pair;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
/**
|
||||
* @author Matze
|
||||
@@ -56,7 +55,7 @@ public class PlayerShop extends AbstractMapObject {
|
||||
private final List<String> bannedList = new ArrayList<>();
|
||||
private final List<Pair<Character, String>> chatLog = new LinkedList<>();
|
||||
private final Map<Integer, Byte> chatSlot = new LinkedHashMap<>();
|
||||
private final Lock visitorLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.VISITOR_PSHOP, true);
|
||||
private final Lock visitorLock = new ReentrantLock(true);
|
||||
|
||||
public PlayerShop(Character owner, String description, int itemid) {
|
||||
this.setPosition(owner.getPosition());
|
||||
|
||||
@@ -24,8 +24,6 @@ package server.maps;
|
||||
import client.Client;
|
||||
import config.YamlConfig;
|
||||
import net.packet.Packet;
|
||||
import net.server.audit.locks.MonitoredLockType;
|
||||
import net.server.audit.locks.factory.MonitoredReentrantLockFactory;
|
||||
import net.server.services.task.channel.OverallService;
|
||||
import net.server.services.type.ChannelServices;
|
||||
import scripting.reactor.ReactorScriptManager;
|
||||
@@ -38,6 +36,7 @@ import java.awt.*;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
/**
|
||||
* @author Lerk
|
||||
@@ -58,8 +57,8 @@ public class Reactor extends AbstractMapObject {
|
||||
private Runnable delayedRespawnRun = null;
|
||||
private GuardianSpawnPoint guardian = null;
|
||||
private byte facingDirection = 0;
|
||||
private final Lock reactorLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.REACTOR, true);
|
||||
private final Lock hitLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.REACTOR_HIT, true);
|
||||
private final Lock reactorLock = new ReentrantLock(true);
|
||||
private final Lock hitLock = new ReentrantLock(true);
|
||||
|
||||
public Reactor(ReactorStats stats, int rid) {
|
||||
this.evstate = (byte) 0;
|
||||
|
||||
Reference in New Issue
Block a user