Permalink
Browse files

factory registration duplicates ignored

  • Loading branch information...
1 parent 195f515 commit dca57ce6ca1c5008a21b2f34840b1babf4e89013 @laforge49 committed Dec 15, 2012
Showing with 3 additions and 2 deletions.
  1. +1 −1 pom.xml
  2. +2 −1 src/main/java/org/agilewiki/jactor/factory/JAFactory.java
View
@@ -5,7 +5,7 @@
<groupId>org.agilewiki.jactor</groupId>
<artifactId>jactor</artifactId>
- <version>4.5.0</version>
+ <version>4.5.1</version>
<packaging>jar</packaging>
<name>JActor</name>
<description>Lock-free Java Actors</description>
@@ -194,7 +194,8 @@ public void defineActorType(String actorType, Class clazz)
public void registerActorFactory(ActorFactory actorFactory)
throws Exception {
String actorType = actorFactory.actorType;
- if (types.containsKey(actorType))
+ ActorFactory old = types.get(actorType);
+ if (old != null && !old.equals(actorFactory))
throw new IllegalArgumentException("Actor type is already defined: " + actorType);
types.put(actorType, actorFactory);
}

0 comments on commit dca57ce

Please sign in to comment.