use volatile for thread object in xmppconnection
This commit is contained in:
parent
c4ca381c7f
commit
658caec342
|
@ -173,13 +173,12 @@ public class XmppConnection implements Runnable {
|
||||||
private SaslMechanism saslMechanism;
|
private SaslMechanism saslMechanism;
|
||||||
private URL redirectionUrl = null;
|
private URL redirectionUrl = null;
|
||||||
private String verifiedHostname = null;
|
private String verifiedHostname = null;
|
||||||
private Thread mThread;
|
private volatile Thread mThread;
|
||||||
private CountDownLatch mStreamCountDownLatch;
|
private CountDownLatch mStreamCountDownLatch;
|
||||||
|
|
||||||
public XmppConnection(final Account account, final XmppConnectionService service) {
|
public XmppConnection(final Account account, final XmppConnectionService service) {
|
||||||
this.account = account;
|
this.account = account;
|
||||||
final String tag = account.getJid().asBareJid().toString();
|
this.mXmppConnectionService = service;
|
||||||
mXmppConnectionService = service;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void fixResource(Context context, Account account) {
|
private static void fixResource(Context context, Account account) {
|
||||||
|
@ -438,7 +437,7 @@ public class XmppConnection implements Runnable {
|
||||||
*
|
*
|
||||||
* @return true if server returns with valid xmpp, false otherwise
|
* @return true if server returns with valid xmpp, false otherwise
|
||||||
*/
|
*/
|
||||||
private boolean startXmpp(Socket socket) throws Exception {
|
private synchronized boolean startXmpp(Socket socket) throws Exception {
|
||||||
if (Thread.currentThread().isInterrupted()) {
|
if (Thread.currentThread().isInterrupted()) {
|
||||||
throw new InterruptedException();
|
throw new InterruptedException();
|
||||||
}
|
}
|
||||||
|
@ -485,7 +484,7 @@ public class XmppConnection implements Runnable {
|
||||||
connect();
|
connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processStream() throws XmlPullParserException, IOException, NoSuchAlgorithmException {
|
private void processStream() throws XmlPullParserException, IOException {
|
||||||
final CountDownLatch streamCountDownLatch = new CountDownLatch(1);
|
final CountDownLatch streamCountDownLatch = new CountDownLatch(1);
|
||||||
this.mStreamCountDownLatch = streamCountDownLatch;
|
this.mStreamCountDownLatch = streamCountDownLatch;
|
||||||
Tag nextTag = tagReader.readTag();
|
Tag nextTag = tagReader.readTag();
|
||||||
|
|
Loading…
Reference in New Issue