mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-09 05:24:44 +01:00
null listener thread ref so will be restarted
Once it died it stayed dead: bad.
This commit is contained in:
parent
3023ae1af6
commit
6b449bb079
1 changed files with 9 additions and 14 deletions
|
@ -417,7 +417,6 @@ public class BTService extends XWJIService {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case START_BACKGROUND:
|
case START_BACKGROUND:
|
||||||
startListener();
|
|
||||||
noteLastUsed( this ); // prevent timer from killing immediately
|
noteLastUsed( this ); // prevent timer from killing immediately
|
||||||
setTimeoutTimer();
|
setTimeoutTimer();
|
||||||
break;
|
break;
|
||||||
|
@ -540,7 +539,6 @@ public class BTService extends XWJIService {
|
||||||
static void startYourself()
|
static void startYourself()
|
||||||
{
|
{
|
||||||
Log.d( TAG, "startYourself()" );
|
Log.d( TAG, "startYourself()" );
|
||||||
// DbgUtils.assertOnUIThread();
|
|
||||||
synchronized ( s_listener ) {
|
synchronized ( s_listener ) {
|
||||||
if ( s_listener[0] == null ) {
|
if ( s_listener[0] == null ) {
|
||||||
s_listener[0] = new BTListenerThread();
|
s_listener[0] = new BTListenerThread();
|
||||||
|
@ -552,19 +550,14 @@ public class BTService extends XWJIService {
|
||||||
static void stopYourself( BTListenerThread self )
|
static void stopYourself( BTListenerThread self )
|
||||||
{
|
{
|
||||||
Log.d( TAG, "stopYourself()" );
|
Log.d( TAG, "stopYourself()" );
|
||||||
BTListenerThread listener;
|
BTListenerThread curListener;
|
||||||
synchronized ( s_listener ) {
|
synchronized ( s_listener ) {
|
||||||
listener = s_listener[0];
|
curListener = s_listener[0];
|
||||||
s_listener[0] = null;
|
s_listener[0] = null;
|
||||||
}
|
}
|
||||||
if ( null != listener ) {
|
if ( null != curListener ) {
|
||||||
Assert.assertTrue( self == null || self == listener );
|
Assert.assertTrue( self == null || self == curListener );
|
||||||
listener.stopListening();
|
curListener.stopListening();
|
||||||
try {
|
|
||||||
listener.join( 100 );
|
|
||||||
} catch ( InterruptedException ie ) {
|
|
||||||
Log.ex( TAG, ie );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -608,6 +601,7 @@ public class BTService extends XWJIService {
|
||||||
}
|
}
|
||||||
|
|
||||||
closeServerSocket();
|
closeServerSocket();
|
||||||
|
stopYourself( this ); // need to clear the ref so can restart
|
||||||
Log.d( TAG, "BTListenerThread.run() exiting" );
|
Log.d( TAG, "BTListenerThread.run() exiting" );
|
||||||
} // run()
|
} // run()
|
||||||
|
|
||||||
|
@ -808,7 +802,8 @@ public class BTService extends XWJIService {
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
Log.d( TAG, "BTListenerThread.run() starting" );
|
String className = getClass().getSimpleName();
|
||||||
|
Log.d( TAG, "%s.run() starting", className );
|
||||||
for ( ; ; ) {
|
for ( ; ; ) {
|
||||||
BTQueueElem elem;
|
BTQueueElem elem;
|
||||||
// onTheWayOut: mFinishing can change while we're in poll()
|
// onTheWayOut: mFinishing can change while we're in poll()
|
||||||
|
@ -862,7 +857,7 @@ public class BTService extends XWJIService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Log.d( TAG, "BTListenerThread.run() exiting (owner was %s)",
|
Log.d( TAG, "%s.run() exiting (owner was %s)", className,
|
||||||
BTService.this );
|
BTService.this );
|
||||||
} // run
|
} // run
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue