mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-26 16:22:06 +01:00
Don't use manager's constructor in connectionCreated
This could cause duplicate managers. Use getInstanceFor() instead. SMACK-403.
This commit is contained in:
parent
89838f5843
commit
4c8af8c17f
1 changed files with 2 additions and 2 deletions
|
@ -51,7 +51,7 @@ public class CarbonManager {
|
||||||
static {
|
static {
|
||||||
Connection.addConnectionCreationListener(new ConnectionCreationListener() {
|
Connection.addConnectionCreationListener(new ConnectionCreationListener() {
|
||||||
public void connectionCreated(Connection connection) {
|
public void connectionCreated(Connection connection) {
|
||||||
new CarbonManager(connection);
|
getInstanceFor(connection);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ public class CarbonManager {
|
||||||
*
|
*
|
||||||
* @return a CarbonManager instance
|
* @return a CarbonManager instance
|
||||||
*/
|
*/
|
||||||
public static CarbonManager getInstanceFor(Connection connection) {
|
public static synchronized CarbonManager getInstanceFor(Connection connection) {
|
||||||
CarbonManager carbonManager = instances.get(connection);
|
CarbonManager carbonManager = instances.get(connection);
|
||||||
|
|
||||||
if (carbonManager == null) {
|
if (carbonManager == null) {
|
||||||
|
|
Loading…
Reference in a new issue