Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 30 additions & 4 deletions jme3-lwjgl/src/main/java/com/jme3/audio/lwjgl/LwjglALC.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,36 @@ public class LwjglALC implements ALC {

@Override
public void createALC() {
try {
AL.create();
} catch (LWJGLException ex) {
throw new RuntimeException(ex);
int numRetriesRemaining = 4;
int retryDelayMsec = 100; // start with an 0.1-second delay

while (true) {
try {
AL.create();
break;

} catch (LWJGLException exception1) {
if (numRetriesRemaining < 1) {
throw new RuntimeException(exception1);
}

// Retry to mitigate JME Issue 1383.
--numRetriesRemaining;
System.out.printf("Caught an LWJGLException from AL.create(). "
+ "Will retry after %d msec, "
+ "with %d more retr%s remaining.%n",
retryDelayMsec,
numRetriesRemaining,
(numRetriesRemaining == 1) ? "y" : "ies");

try {
Thread.sleep(retryDelayMsec);
} catch (InterruptedException exception2) {
}

// Triple the wait time after each failure.
retryDelayMsec *= 3;
}
}
}

Expand Down