Skip to content

Commit

Permalink
Merge pull request #380 from survivant/master
Browse files Browse the repository at this point in the history
avoid duplicate InterceptorService to be added
  • Loading branch information
jfarcand committed May 25, 2012
2 parents e6d8d65 + de24792 commit 8a305cc
Showing 1 changed file with 12 additions and 2 deletions.
Expand Up @@ -477,7 +477,7 @@ protected void configureAtmosphereInterceptor(ServletConfig sc) {
AtmosphereInterceptor ai = (AtmosphereInterceptor) Thread.currentThread().getContextClassLoader()
.loadClass(a.trim()).newInstance();
ai.configure(config);
interceptors.add(ai);
interceptor(ai);
} catch (InstantiationException e) {
logger.warn("", e);
} catch (IllegalAccessException e) {
Expand Down Expand Up @@ -1347,7 +1347,17 @@ public AtmosphereFramework setHandlersPath(String handlersPath) {
* @return this
*/
public AtmosphereFramework interceptor(AtmosphereInterceptor c) {
interceptors.addLast(c);
boolean found = false;
for (AtmosphereInterceptor interceptor : interceptors) {
if(interceptor.getClass().equals(c.getClass())){
found = true;
break;
}
}

if(!found){
interceptors.addLast(c);
}
return this;
}

Expand Down

0 comments on commit 8a305cc

Please sign in to comment.