Skip to content

Commit

Permalink
set core pool size to 20 and a couple of test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
purplefox committed Apr 16, 2012
1 parent 0f2f8bb commit e4841dc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
21 changes: 10 additions & 11 deletions src/main/java/org/vertx/java/core/impl/DefaultVertx.java
Expand Up @@ -63,11 +63,10 @@ public class DefaultVertx extends VertxInternal {
private final EventBus eventBus;
private final SharedData sharedData = new SharedData();

private int backgroundPoolSize = 1;
private int backgroundPoolSize = 20;
private int corePoolSize = Runtime.getRuntime().availableProcessors();
private ExecutorService backgroundPool;
private OrderedExecutorFactory orderedFact;
private ExecutorService corePool;
private NioWorkerPool workerPool;
private ExecutorService acceptorPool;
private final Map<ServerID, DefaultHttpServer> sharedHttpServers = new HashMap<>();
Expand Down Expand Up @@ -139,14 +138,6 @@ public Context startInBackground(final Runnable runnable) {
return context;
}

private void runOnContext(final Context context, final Runnable runnable) {
context.execute(new Runnable() {
public void run() {
runnable.run();
}
});
}

public boolean isEventLoop() {
Context context = Context.getContext();
if (context != null) {
Expand Down Expand Up @@ -203,7 +194,7 @@ public NioWorkerPool getWorkerPool() {
synchronized (this) {
result = workerPool;
if (result == null) {
corePool = Executors.newFixedThreadPool(corePoolSize, new VertxThreadFactory("vert.x-core-thread-"));
ExecutorService corePool = Executors.newFixedThreadPool(corePoolSize, new VertxThreadFactory("vert.x-core-thread-"));
workerPool = result = new NioWorkerPool(corePool, corePoolSize, false);
}
}
Expand Down Expand Up @@ -254,6 +245,14 @@ public Map<ServerID, DefaultNetServer> sharedNetServers() {
return sharedNetServers;
}

private void runOnContext(final Context context, final Runnable runnable) {
context.execute(new Runnable() {
public void run() {
runnable.run();
}
});
}

private long setTimeout(final long delay, boolean periodic, final Handler<Long> handler) {
final Context context = getOrAssignContext();

Expand Down
1 change: 0 additions & 1 deletion src/tests/javascript/busmods/worker/test_worker.js
Expand Up @@ -61,6 +61,5 @@ tu.appReady();

function vertxStop() {
vertx.eventBus.unregisterHandler('testWorker', handler);
tu.checkContext();
tu.appStopped();
}
1 change: 0 additions & 1 deletion src/tests/javascript/busmods/workqueue/order_processor.js
Expand Up @@ -46,7 +46,6 @@ function vertxStop() {
processor: id
});
eb.unregisterHandler(id, handler);
tu.checkContext();
if (!dontsendAppLifeCycle) {
tu.appStopped();
}
Expand Down

0 comments on commit e4841dc

Please sign in to comment.