1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-26 05:52: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:
Florian Schmaus 2014-02-07 12:15:04 +01:00
parent 89838f5843
commit 4c8af8c17f

View file

@ -51,7 +51,7 @@ public class CarbonManager {
static {
Connection.addConnectionCreationListener(new ConnectionCreationListener() {
public void connectionCreated(Connection connection) {
new CarbonManager(connection);
getInstanceFor(connection);
}
});
}
@ -73,7 +73,7 @@ public class CarbonManager {
*
* @return a CarbonManager instance
*/
public static CarbonManager getInstanceFor(Connection connection) {
public static synchronized CarbonManager getInstanceFor(Connection connection) {
CarbonManager carbonManager = instances.get(connection);
if (carbonManager == null) {