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