asmack reconnection启动两次

 

 

 

原文出处:http://issues.igniterealtime.org/browse/SMACK-325

 

# This patch file was generated by NetBeans IDE

# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.

# It uses platform neutral UTF-8 encoding.

# Above lines and this line are ignored by the patching process.

3d2

< import java.util.Random;

24,25d22

< private Thread reconnectionThread;

< private int randomBase = new Random().nextInt(11) + 5; // between 5 and 15 seconds

68c65

<     synchronized protected void reconnect() {

---

>     protected void reconnect() {

70,72d66

<             // avoid to run duplicated reconnectionThread -- fd: 16/09/2010

<             if (reconnectionThread!=null && reconnectionThread.isAlive()) return;

<

75c69

< reconnectionThread = new Thread() {

---

>             Thread reconnectionThread = new Thread() {

87d80

< // fd: 16/09/10; modified to add a random wait

89d81

< attempts++;

91c83

<                         return randomBase*6*5;      // between 2.5 and 7.5 minutes (~5 minutes)

---

>                         return 60 * 5;      // 5 minutes

94c86

<                         return randomBase*6;       // between 30 and 90 seconds (~1 minute)

---

>                         return 60;          // 1 minute

96,98c88

<                     return randomBase;              // between 5 and 15 seconds (~10 seconds)

---

>                     return 10;              // 10 seconds

 

 

你可能感兴趣的:(Connection)