Skip to content

Commit

Permalink
Fixes #1785
Browse files Browse the repository at this point in the history
  • Loading branch information
jfarcand committed Nov 21, 2014
1 parent ae43e56 commit 9371be0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2977,7 +2977,14 @@ public AtmosphereResourceFactory atmosphereFactory() {
}

private AtmosphereFramework configureAtmosphereResourceFactory() {
arFactory = new AtmosphereResourceFactory(broadcasterFactory);
try {
arFactory = newClassInstance(AtmosphereResourceFactory.class, AtmosphereResourceFactory.class);
} catch (InstantiationException e) {
logger.error("", e);
} catch (IllegalAccessException e) {
logger.error("", e);
}
arFactory.configure(config);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package org.atmosphere.cpr;

import org.atmosphere.handler.AbstractReflectorAtmosphereHandler;
import org.atmosphere.util.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -67,14 +66,17 @@ public void onRequest(AtmosphereResource resource) throws IOException {
public void destroy() {
}
};
private final BroadcasterFactory broadcasterFactory;
private BroadcasterFactory broadcasterFactory;

public AtmosphereResourceFactory(BroadcasterFactory broadcasterFactory){
this.broadcasterFactory = broadcasterFactory;
public AtmosphereResourceFactory(){
// This is quite ugly, but here for legacy reason.
factory = this;
}

public void configure(AtmosphereConfig config) {
this.broadcasterFactory = config.getBroadcasterFactory();
}

private final ConcurrentHashMap<String, AtmosphereResource> resources = new ConcurrentHashMap<String, AtmosphereResource>();

/**
Expand Down Expand Up @@ -335,4 +337,5 @@ private void setDefaultSerializer(AtmosphereConfig config, AtmosphereResource r)
r.setSerializer(serializer);
}
}

}

0 comments on commit 9371be0

Please sign in to comment.