Skip to content

Commit

Permalink
Merge pull request ArcBees#281 from 5inGularity/master
Browse files Browse the repository at this point in the history
Non-thread-safe usage of map can result in infinite loop and 100% CPU usage


Former-commit-id: a802f81
  • Loading branch information
christiangoudreau committed Jul 4, 2013
2 parents 2f05188 + 529b752 commit 65d4976
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@

package com.gwtplatform.dispatch.server.guice.actionhandlervalidator;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import javax.inject.Inject;
import javax.inject.Singleton;

import com.google.inject.Injector;
import com.gwtplatform.dispatch.server.actionhandler.ActionHandler;
import com.gwtplatform.dispatch.server.actionhandlervalidator.ActionHandlerValidatorClass;
import com.gwtplatform.dispatch.server.actionhandlervalidator.ActionHandlerValidatorInstance;
import com.gwtplatform.dispatch.server.actionhandlervalidator.LazyActionHandlerValidatorRegistry;
Expand Down Expand Up @@ -50,10 +51,10 @@ public class LazyActionHandlerValidatorRegistryImpl implements
@Inject
LazyActionHandlerValidatorRegistryImpl(Injector injector) {
this.injector = injector;
actionHandlerValidatorClasses = new HashMap<Class<? extends Action<?>>, ActionHandlerValidatorClass<? extends
actionHandlerValidatorClasses = new ConcurrentHashMap<Class<? extends Action<?>>, ActionHandlerValidatorClass<? extends
Action<?>, ? extends Result>>();
actionHandlerValidatorInstances = new HashMap<Class<? extends Action<?>>, ActionHandlerValidatorInstance>();
validators = new HashMap<Class<? extends ActionValidator>, ActionValidator>();
actionHandlerValidatorInstances = new ConcurrentHashMap<Class<? extends Action<?>>, ActionHandlerValidatorInstance>();
validators = new ConcurrentHashMap<Class<? extends ActionValidator>, ActionValidator>();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

package com.gwtplatform.dispatch.server.spring.actionhandlervalidator;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
Expand Down Expand Up @@ -46,10 +46,10 @@ public class LazyActionHandlerValidatorRegistryImpl implements LazyActionHandler
private final Map<Class<? extends ActionValidator>, ActionValidator> validators;

public LazyActionHandlerValidatorRegistryImpl() {
actionHandlerValidatorClasses = new HashMap<Class<? extends Action<?>>, ActionHandlerValidatorClass<? extends
actionHandlerValidatorClasses = new ConcurrentHashMap<Class<? extends Action<?>>, ActionHandlerValidatorClass<? extends
Action<?>, ? extends Result>>();
actionHandlerValidatorInstances = new HashMap<Class<? extends Action<?>>, ActionHandlerValidatorInstance>();
validators = new HashMap<Class<? extends ActionValidator>, ActionValidator>();
actionHandlerValidatorInstances = new ConcurrentHashMap<Class<? extends Action<?>>, ActionHandlerValidatorInstance>();
validators = new ConcurrentHashMap<Class<? extends ActionValidator>, ActionValidator>();
}

@Override
Expand Down

0 comments on commit 65d4976

Please sign in to comment.