Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Default concurrency to available processors [IMMUTANT-360]
  • Loading branch information
jcrossley3 committed Apr 7, 2015
1 parent 2afe15c commit 2e59311
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Expand Up @@ -27,7 +27,7 @@ public interface Destination {

class ListenOption extends Option {
public static final ListenOption CONTEXT = opt("context", ListenOption.class);
public static final ListenOption CONCURRENCY = opt("concurrency", 1, ListenOption.class);
public static final ListenOption CONCURRENCY = opt("concurrency", Runtime.getRuntime().availableProcessors(), ListenOption.class);
public static final ListenOption SELECTOR = opt("selector", ListenOption.class);
public static final ListenOption MODE = opt("mode", Context.Mode.TRANSACTED, ListenOption.class);
}
Expand Down
Expand Up @@ -46,6 +46,7 @@ public MessageHandlerGroup(HQSpecificContext context,
public synchronized MessageHandlerGroup start() throws Exception {
if (!this.started) {
int concurrency = this.options.getInt(ListenOption.CONCURRENCY);
log.info("Starting listener for '" + this.destination.name() + "' concurrency=" + concurrency);
while(concurrency-- > 0) {
HQSpecificContext subContext =
this.context.createChildContext((Context.Mode)this.options.get(ListenOption.MODE));
Expand Down

0 comments on commit 2e59311

Please sign in to comment.