Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not possible to disable BROADCASTER_SHARABLE_THREAD_POOLS #2401

Open
saadgit opened this issue Feb 11, 2020 · 1 comment
Open

Not possible to disable BROADCASTER_SHARABLE_THREAD_POOLS #2401

saadgit opened this issue Feb 11, 2020 · 1 comment

Comments

@saadgit
Copy link

saadgit commented Feb 11, 2020

Setting "false" value of BROADCASTER_SHARABLE_THREAD_POOLS has no effect on Broadcaster Thread pools. I have 3 broadcasters and I dont want them to share the thread pool. The configuration value is either set from the default value of
sharedThreadPools=true; // in AtmosphereFramework.java
or checked too late in the init function.

    AtmosphereFramework init() {
            ...
            ...
            String s =         config.getInitParameter(ApplicationConfig.BROADCASTER_SHARABLE_THREAD_POOLS);
                    if (s != null) {
                            sharedThreadPools = Boolean.parseBoolean(s);
                     }
           ...
    }

when the shared thread pools are already setup at the start of the same function

Server config looks like this,

    ServletRegistrationBean registration = new ServletRegistrationBean(new AtmosphereServlet(), "/server/websocket/*");
    registration.addInitParameter(ApplicationConfig.SCAN_CLASSPATH, "false");
    registration.addInitParameter(ApplicationConfig.ANALYTICS, "false");
    registration.addInitParameter(ApplicationConfig.CLIENT_HEARTBEAT_INTERVAL_IN_SECONDS, "10");
    registration.addInitParameter(ApplicationConfig.WEBSOCKET_MAXTEXTSIZE, "10485760"); 
    registration.addInitParameter(ApplicationConfig.WEBSOCKET_BUFFER_SIZE, "131072"); 
    registration.addInitParameter(ApplicationConfig.HEARTBEAT_INTERVAL_IN_SECONDS, "10");
    registration.addInitParameter(ApplicationConfig.BROADCASTER_SHARABLE_THREAD_POOLS, "false");
@saadgit
Copy link
Author

saadgit commented Feb 12, 2020

Although the config doesnt work as expected, but I was able to set SharedThreadPools to false via some changes in servlet bean

   @Configuration
   public class WebsocketConfig { 
          @Bean 
           public ServletRegistrationBean atmosphereServlet() {
                   AtmosphereServlet servlet = new AtmosphereServlet();
                   AtmosphereFramework framework = servlet.framework();
                   framework.sharedThreadPools(false);
                   ServletRegistrationBean registration = new ServletRegistrationBean(servlet, "/server/websocket/*");
                  registration.setLoadOnStartup(0);
                   registration.setOrder(Ordered.HIGHEST_PRECEDENCE);
                  registration.setAsyncSupported(true);
                   return registration;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant