Close #471 - sync sqlite operations to guard against deadlocks

This commit is contained in:
md_5 2013-07-01 21:25:39 +10:00
parent 06e732d8c7
commit 12941ffe62

View File

@ -33,7 +33,7 @@ public class SQLReconnectHandler extends AbstractReconnectManager
}
@Override
protected ServerInfo getStoredServer(ProxiedPlayer player)
protected synchronized ServerInfo getStoredServer(ProxiedPlayer player)
{
String server = null;
try ( PreparedStatement ps = connection.prepareStatement( "SELECT server FROM players WHERE username = ?" ) )
@ -62,7 +62,7 @@ public class SQLReconnectHandler extends AbstractReconnectManager
}
@Override
public void setServer(ProxiedPlayer player)
public synchronized void setServer(ProxiedPlayer player)
{
try ( PreparedStatement ps = connection.prepareStatement( "UPDATE players SET server = ?, seen = ? WHERE username = ?" ) )
@ -83,7 +83,7 @@ public class SQLReconnectHandler extends AbstractReconnectManager
}
@Override
public void close()
public synchronized void close()
{
try
{