Archiviert
13
0

Removed the ReadWriteLock as it's superseeded by the BlockingHashMap.

Dieser Commit ist enthalten in:
Kristian S. Stangeland 2012-11-23 08:52:02 +01:00
Ursprung c49b1ddc02
Commit d53b6dbee1
2 geänderte Dateien mit 1 neuen und 19 gelöschten Zeilen

Datei anzeigen

@ -1,9 +1,6 @@
package com.comphenix.protocol.injector.player;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.bukkit.Server;
import org.bukkit.entity.Player;
@ -29,8 +26,6 @@ class NetLoginInjector {
// The current error rerporter
private ErrorReporter reporter;
private ReadWriteLock injectionLock = new ReentrantReadWriteLock();
// Used to create fake players
private TemporaryPlayerFactory tempPlayerFactory = new TemporaryPlayerFactory();
@ -46,9 +41,6 @@ class NetLoginInjector {
* @return An injected NetLoginHandler, or the original object.
*/
public Object onNetLoginCreated(Object inserting) {
injectionLock.writeLock().lock();
try {
// Make sure we actually need to inject during this phase
if (!injectionHandler.isInjectionNecessary(GamePhase.LOGIN))
@ -73,19 +65,9 @@ class NetLoginInjector {
reporter.reportDetailed(this, "Unable to hook NetLoginHandler.", e, inserting);
return inserting;
} finally {
injectionLock.writeLock().unlock();
}
}
/**
* Retrieve the lock used for reading.
* @return Reading lock.
*/
public Lock getReadLock() {
return injectionLock.readLock();
}
/**
* Invoked when a NetLoginHandler should be reverted.
* @param inserting - the original NetLoginHandler.

Datei anzeigen

@ -216,7 +216,7 @@ public class PlayerInjectionHandler {
* @throws InterruptedException If the thread was interrupted during the wait.
*/
public Player getPlayerByConnection(DataInputStream inputStream, long playerTimeout, TimeUnit unit) throws InterruptedException {
// Wait until the connection owner has been established
PlayerInjector injector = dataInputLookup.get(inputStream, playerTimeout, unit);
if (injector != null) {