mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-08 05:24:39 +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.Stack;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
// Implements read-locks and write-locks per game. A read lock is
|
||||
// obtainable when other read locks are granted but not when a
|
||||
// write lock is. Write-locks are exclusive.
|
||||
|
@ -156,24 +158,30 @@ public class GameLock implements AutoCloseable {
|
|||
return this;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public GameLock lock() throws InterruptedException
|
||||
{
|
||||
if ( BuildConfig.DEBUG ) {
|
||||
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
|
||||
{
|
||||
if ( BuildConfig.DEBUG ) {
|
||||
DbgUtils.assertOnUIThread( false );
|
||||
}
|
||||
return lockImpl( Long.MAX_VALUE, true );
|
||||
}
|
||||
// @NonNull
|
||||
// public GameLock lockRO() throws InterruptedException
|
||||
// {
|
||||
// if ( BuildConfig.DEBUG ) {
|
||||
// DbgUtils.assertOnUIThread( false );
|
||||
// }
|
||||
// GameLock result = lockImpl( Long.MAX_VALUE, true );
|
||||
// Assert.assertNotNull( result );
|
||||
// return result;
|
||||
// }
|
||||
|
||||
// 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 );
|
||||
GameLock result = null;
|
||||
|
|
|
@ -1007,6 +1007,8 @@ public class GameUtils {
|
|||
}
|
||||
}
|
||||
}
|
||||
} catch ( GameLock.GameLockedException gle ) {
|
||||
Log.e( TAG, "feedMessage(): game locked; dropping message" );
|
||||
}
|
||||
}
|
||||
return draw;
|
||||
|
|
Loading…
Reference in a new issue