mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-09 05:24:44 +01:00
catch uncaught exception
This commit is contained in:
parent
b0805b0b6a
commit
24386bd8c9
2 changed files with 19 additions and 9 deletions
|
@ -26,6 +26,8 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
|
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
// Implements read-locks and write-locks per game. A read lock is
|
// Implements read-locks and write-locks per game. A read lock is
|
||||||
// obtainable when other read locks are granted but not when a
|
// obtainable when other read locks are granted but not when a
|
||||||
// write lock is. Write-locks are exclusive.
|
// write lock is. Write-locks are exclusive.
|
||||||
|
@ -156,24 +158,30 @@ public class GameLock implements AutoCloseable {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
public GameLock lock() throws InterruptedException
|
public GameLock lock() throws InterruptedException
|
||||||
{
|
{
|
||||||
if ( BuildConfig.DEBUG ) {
|
if ( BuildConfig.DEBUG ) {
|
||||||
DbgUtils.assertOnUIThread( false );
|
DbgUtils.assertOnUIThread( false );
|
||||||
}
|
}
|
||||||
return lockImpl( Long.MAX_VALUE, false );
|
GameLock result = lockImpl( Long.MAX_VALUE, false );
|
||||||
|
Assert.assertNotNull( result );
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameLock lockRO() throws InterruptedException
|
// @NonNull
|
||||||
{
|
// public GameLock lockRO() throws InterruptedException
|
||||||
if ( BuildConfig.DEBUG ) {
|
// {
|
||||||
DbgUtils.assertOnUIThread( false );
|
// if ( BuildConfig.DEBUG ) {
|
||||||
}
|
// DbgUtils.assertOnUIThread( false );
|
||||||
return lockImpl( Long.MAX_VALUE, true );
|
// }
|
||||||
}
|
// GameLock result = lockImpl( Long.MAX_VALUE, true );
|
||||||
|
// Assert.assertNotNull( result );
|
||||||
|
// return result;
|
||||||
|
// }
|
||||||
|
|
||||||
// Version that's allowed to return null -- if maxMillis > 0
|
// Version that's allowed to return null -- if maxMillis > 0
|
||||||
public GameLock lock( long maxMillis )
|
public GameLock lock( long maxMillis ) throws GameLockedException
|
||||||
{
|
{
|
||||||
Assert.assertTrue( maxMillis <= THROW_TIME );
|
Assert.assertTrue( maxMillis <= THROW_TIME );
|
||||||
GameLock result = null;
|
GameLock result = null;
|
||||||
|
|
|
@ -1007,6 +1007,8 @@ public class GameUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch ( GameLock.GameLockedException gle ) {
|
||||||
|
Log.e( TAG, "feedMessage(): game locked; dropping message" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return draw;
|
return draw;
|
||||||
|
|
Loading…
Reference in a new issue