This commit is contained in:
parent
0f85b0ac92
commit
7d6134c183
@ -1190,6 +1190,8 @@ Fluid spawning item
|
||||
Fix fluid shader
|
||||
Re-enable fluid simulation
|
||||
Remove concurrent datastructure usage in cell management
|
||||
Auto close prepared queries that are iterated over
|
||||
Fix viewport loading
|
||||
|
||||
|
||||
# TODO
|
||||
|
||||
@ -70,6 +70,7 @@ public class ClientLoading {
|
||||
ClientLoading.initClientThread();
|
||||
}
|
||||
//while we don't know what races are playable, wait
|
||||
WindowUtils.updateLoadingWindow("Waiting on lore");
|
||||
while(Globals.gameConfigCurrent.getCreatureTypeLoader().getPlayableRaces().size() == 0){
|
||||
try {
|
||||
TimeUnit.MILLISECONDS.sleep(5);
|
||||
|
||||
@ -145,7 +145,7 @@ public class ThreadManager {
|
||||
if(thread.getThread().isAlive()){
|
||||
String errorMessage = "Failed to interrupt thread! " + thread.getLabel();
|
||||
System.err.println(errorMessage);
|
||||
throw new IllegalStateException();
|
||||
throw new Error(errorMessage);
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
CodeUtils.todo(e, "Think about how to handle this");
|
||||
|
||||
@ -6,7 +6,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Semaphore;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
/**
|
||||
* The creature type loader
|
||||
@ -26,7 +26,7 @@ public class CreatureTypeLoader {
|
||||
/**
|
||||
* The lock on playable races
|
||||
*/
|
||||
Semaphore playableRaceLock = new Semaphore(1);
|
||||
ReentrantLock lock = new ReentrantLock();
|
||||
|
||||
/**
|
||||
* Adds a playable race to the loader
|
||||
@ -42,9 +42,9 @@ public class CreatureTypeLoader {
|
||||
*/
|
||||
public List<String> getPlayableRaces(){
|
||||
List<String> races = null;
|
||||
playableRaceLock.acquireUninterruptibly();
|
||||
lock.lock();
|
||||
races = playableRaceNames;
|
||||
playableRaceLock.release();
|
||||
lock.unlock();
|
||||
return races;
|
||||
}
|
||||
|
||||
@ -60,9 +60,9 @@ public class CreatureTypeLoader {
|
||||
* @param races The list of playable races
|
||||
*/
|
||||
public void loadPlayableRaces(List<String> races){
|
||||
playableRaceLock.acquireUninterruptibly();
|
||||
lock.lock();
|
||||
playableRaceNames = races;
|
||||
playableRaceLock.release();
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -66,7 +66,9 @@ public class DatabaseController {
|
||||
argumentIndex++;
|
||||
}
|
||||
//actually execute
|
||||
return statement.execute();
|
||||
boolean result = statement.execute();
|
||||
statement.close();
|
||||
return result;
|
||||
} catch (SQLException ex) {
|
||||
LoggerInterface.loggerFileIO.ERROR("SQL query execution error", ex);
|
||||
}
|
||||
@ -81,6 +83,10 @@ public class DatabaseController {
|
||||
*/
|
||||
public DatabaseResult executePreparedQuery(String statementRaw, Object...arguments){
|
||||
DatabaseResult rVal = DatabaseResult.createQuery(statementRaw);
|
||||
if(conn == null){
|
||||
rVal.succeeded = false;
|
||||
return rVal;
|
||||
}
|
||||
try {
|
||||
PreparedStatement statement = conn.prepareStatement(statementRaw);
|
||||
|
||||
@ -137,7 +143,9 @@ public class DatabaseController {
|
||||
*/
|
||||
public void disconnect(){
|
||||
try {
|
||||
if(this.conn != null){
|
||||
conn.close();
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
LoggerInterface.loggerEngine.ERROR("Error disconnecting from DB", ex);
|
||||
}
|
||||
|
||||
@ -65,7 +65,11 @@ public class DatabaseResultIterator implements Iterator<DatabaseResultRow> {
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
try {
|
||||
return !rs.isAfterLast();
|
||||
boolean rVal = !rs.isAfterLast();
|
||||
if(!rVal && rs != null){
|
||||
rs.close();
|
||||
}
|
||||
return rVal;
|
||||
} catch (SQLException e) {
|
||||
LoggerInterface.loggerEngine.ERROR("Critical failure in DatabaseResultIterator", e);
|
||||
return false;
|
||||
|
||||
@ -110,7 +110,7 @@ public class TestEngineUtils {
|
||||
for(LoadingThread thread : Globals.threadManager.getLoadingThreads()){
|
||||
errorMessage = errorMessage + thread.getType() + "\n";
|
||||
}
|
||||
Assertions.fail("Failed to startup");
|
||||
Assertions.fail(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user