Browse files

start of 5.0.0.0

  • Loading branch information...
1 parent 917ae27 commit be4ec9513729526e9adce2241aa449da744c479c @laforge49 committed Mar 3, 2013
Showing with 16 additions and 1,188 deletions.
  1. +1 −1 pom.xml
  2. +1 −1 release.xml
  3. +0 −15 src/main/java/org/agilewiki/jactor/Actor.java
  4. +0 −69 src/main/java/org/agilewiki/jactor/factory/ActorFactory.java
  5. +0 −89 src/main/java/org/agilewiki/jactor/factory/Factory.java
  6. +0 −203 src/main/java/org/agilewiki/jactor/factory/JAFactory.java
  7. +0 −57 src/main/java/org/agilewiki/jactor/factory/JAFactoryFactory.java
  8. +0 −52 src/main/java/org/agilewiki/jactor/factory/Requirement.java
  9. +0 −59 src/main/java/org/agilewiki/jactor/factory/_ActorFactory.java
  10. +8 −74 src/main/java/org/agilewiki/jactor/lpc/JLPCActor.java
  11. +4 −8 src/main/java/org/agilewiki/jactor/lpc/Request.java
  12. +0 −55 src/main/java/org/agilewiki/jactor/nbLock/JNBLockFactory.java
  13. +0 −56 src/main/java/org/agilewiki/jactor/properties/JAPropertiesFactory.java
  14. +0 −56 src/main/java/org/agilewiki/jactor/pubsub/actorName/JActorNameFactory.java
  15. +0 −56 src/main/java/org/agilewiki/jactor/pubsub/publisher/JAPublisherFactory.java
  16. +0 −56 src/main/java/org/agilewiki/jactor/pubsub/subscriber/JASubscriberFactory.java
  17. +0 −12 src/test/java/org/agilewiki/jactor/factory/Foo.java
  18. +0 −25 src/test/java/org/agilewiki/jactor/factory/JFactoryTest.java
  19. +0 −6 src/test/java/org/agilewiki/jactor/factory/timing/A.java
  20. +0 −16 src/test/java/org/agilewiki/jactor/factory/timing/AFactory.java
  21. +0 −30 src/test/java/org/agilewiki/jactor/factory/timing/test1/Creation1Test.java
  22. +0 −44 src/test/java/org/agilewiki/jactor/factory/timing/test2/Creation2Test.java
  23. +0 −45 src/test/java/org/agilewiki/jactor/factory/timing/test3/Creation3Test.java
  24. +0 −50 src/test/java/org/agilewiki/jactor/factory/timing/test4/Creation4Test.java
  25. +0 −50 src/test/java/org/agilewiki/jactor/factory/timing/test5/Creation5Test.java
  26. +2 −3 src/test/java/org/agilewiki/jactor/lpc/calculatorTest/PrintingCalculator.java
View
2 pom.xml
@@ -5,7 +5,7 @@
<groupId>org.agilewiki.jactor</groupId>
<artifactId>jactor</artifactId>
- <version>4.6.2.0</version>
+ <version>5.0.0.0</version>
<packaging>jar</packaging>
<name>JActor</name>
<description>Lock-free Java Actors</description>
View
2 release.xml
@@ -4,7 +4,7 @@
<groupId>org.agilewiki.jactor</groupId>
<artifactId>jactor</artifactId>
- <version>4.6.2.1-SNAPSHOT</version>
+ <version>5.0.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>JActor</name>
<description>Lock-free Java Actors</description>
View
15 src/main/java/org/agilewiki/jactor/Actor.java
@@ -24,7 +24,6 @@
package org.agilewiki.jactor;
import org.agilewiki.jactor.apc.APCRequestSource;
-import org.agilewiki.jactor.factory.ActorFactory;
import org.agilewiki.jactor.lpc.JLPCActor;
import org.agilewiki.jactor.lpc.Request;
@@ -95,20 +94,6 @@ public void acceptEvent(APCRequestSource requestSource,
public Mailbox getMailbox();
/**
- * Returns the actor type.
- *
- * @return The actor type, or null.
- */
- public String getActorType();
-
- /**
- * Returns the factory.
- *
- * @return The factory, or null.
- */
- public ActorFactory getFactory();
-
- /**
* Returns the actor's parent.
*
* @return The actor's parent, or null.
View
69 src/main/java/org/agilewiki/jactor/factory/ActorFactory.java
@@ -1,69 +0,0 @@
-/*
- * Copyright 2011 Bill La Forge
- *
- * This file is part of AgileWiki and is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License (LGPL) as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This code is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- * or navigate to the following url http://www.gnu.org/licenses/lgpl-2.1.txt
- *
- * Note however that only Scala, Java and JavaScript files are being covered by LGPL.
- * All other files are covered by the Common Public License (CPL).
- * A copy of this license is also included and can be
- * found as well at http://www.opensource.org/licenses/cpl1.0.txt
- */
-package org.agilewiki.jactor.factory;
-
-import org.agilewiki.jactor.Actor;
-import org.agilewiki.jactor.Mailbox;
-import org.agilewiki.jactor.lpc.JLPCActor;
-
-/**
- * Creates a JLPCActor.
- */
-abstract public class ActorFactory {
- /**
- * The actor type.
- */
- public final String actorType;
-
- /**
- * Create an ActorFactory.
- *
- * @param actorType The actor type.
- */
- public ActorFactory(String actorType) {
- this.actorType = actorType;
- }
-
- /**
- * Create a JLPCActor.
- *
- * @return The new actor.
- */
- abstract protected JLPCActor instantiateActor()
- throws Exception;
-
- /**
- * Create and configure an actor.
- *
- * @param mailbox The mailbox of the new actor.
- * @param parent The parent of the new actor.
- * @return The new actor.
- */
- public JLPCActor newActor(Mailbox mailbox, Actor parent)
- throws Exception {
- JLPCActor a = instantiateActor();
- a.initialize(mailbox, parent, this);
- return a;
- }
-}
View
89 src/main/java/org/agilewiki/jactor/factory/Factory.java
@@ -1,89 +0,0 @@
-/*
- * Copyright 2011 Bill La Forge
- *
- * This file is part of AgileWiki and is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License (LGPL) as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This code is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- * or navigate to the following url http://www.gnu.org/licenses/lgpl-2.1.txt
- *
- * Note however that only Scala, Java and JavaScript files are being covered by LGPL.
- * All other files are covered by the Common Public License (CPL).
- * A copy of this license is also included and can be
- * found as well at http://www.opensource.org/licenses/cpl1.0.txt
- */
-package org.agilewiki.jactor.factory;
-
-import org.agilewiki.jactor.Actor;
-import org.agilewiki.jactor.Mailbox;
-import org.agilewiki.jactor.lpc.TargetActor;
-
-/**
- * Defines actor types and instantiating
- */
-public interface Factory extends TargetActor {
- /**
- * Bind an actor type to a Class.
- *
- * @param actorType The actor type.
- * @param clazz The class of the actor.
- */
- public void defineActorType(String actorType, Class clazz)
- throws Exception;
-
- /**
- * Register an actor factory.
- *
- * @param actorFactory An actor factory.
- */
- public void registerActorFactory(ActorFactory actorFactory)
- throws Exception;
-
- /**
- * Returns the requested actor factory.
- *
- * @param actorType The actor type.
- * @return The registered actor factory.
- */
- public ActorFactory getActorFactory(String actorType)
- throws Exception;
-
- /**
- * Creates a new actor.
- *
- * @param actorType The actor type.
- * @return The new actor.
- */
- public Actor newActor(String actorType)
- throws Exception;
-
- /**
- * Creates a new actor.
- *
- * @param actorType The actor type.
- * @param mailbox A mailbox which may be shared with other actors, or null.
- * @return The new actor.
- */
- public Actor newActor(String actorType, Mailbox mailbox)
- throws Exception;
-
- /**
- * Creates a new actor.
- *
- * @param actorType The actor type.
- * @param mailbox A mailbox which may be shared with other actors, or null.
- * @param parent The parent actor to which unrecognized requests are forwarded, or null.
- * @return The new actor.
- */
- public Actor newActor(String actorType, Mailbox mailbox, Actor parent)
- throws Exception;
-}
View
203 src/main/java/org/agilewiki/jactor/factory/JAFactory.java
@@ -1,203 +0,0 @@
-/*
- * Copyright 2011 Bill La Forge
- *
- * This file is part of AgileWiki and is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License (LGPL) as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This code is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- * or navigate to the following url http://www.gnu.org/licenses/lgpl-2.1.txt
- *
- * Note however that only Scala, Java and JavaScript files are being covered by LGPL.
- * All other files are covered by the Common Public License (CPL).
- * A copy of this license is also included and can be
- * found as well at http://www.opensource.org/licenses/cpl1.0.txt
- */
-package org.agilewiki.jactor.factory;
-
-import org.agilewiki.jactor.Actor;
-import org.agilewiki.jactor.Mailbox;
-import org.agilewiki.jactor.lpc.JLPCActor;
-
-import java.lang.reflect.Constructor;
-import java.util.concurrent.ConcurrentSkipListMap;
-
-/**
- * An actor for defining actor types and creating instances.
- */
-public class JAFactory extends JLPCActor implements Factory {
- /**
- * Returns the requested actor factory.
- *
- * @param actor The actor which is the factory or which has a factory as an ancestor.
- * @param actorType The actor type.
- * @return The registered actor factory.
- */
- public static ActorFactory getActorFactory(Actor actor, String actorType)
- throws Exception {
- if (!(actor instanceof Factory))
- actor = actor.getAncestor(Factory.class);
- if (actor == null)
- throw new IllegalArgumentException("Unknown actor type: " + actorType);
- Factory factory = (Factory) actor;
- return factory.getActorFactory(actorType);
- }
-
- /**
- * Creates a new actor.
- *
- * @param actor The actor which is the factory or which has a factory as an ancestor.
- * @param actorType The actor type.
- * @return The new actor.
- */
- public static Actor newActor(Actor actor, String actorType)
- throws Exception {
- return newActor(actor, actorType, null, null);
- }
-
- /**
- * Creates a new actor.
- *
- * @param actor The actor which is the factory or which has a factory as an ancestor.
- * @param actorType The actor type.
- * @param mailbox A mailbox which may be shared with other actors, or null.
- * @return The new actor.
- */
- public static Actor newActor(Actor actor, String actorType, Mailbox mailbox)
- throws Exception {
- return newActor(actor, actorType, mailbox, null);
- }
-
- /**
- * Creates a new actor.
- *
- * @param actor The actor which is the factory or which has a factory as an ancestor.
- * @param actorType The actor type.
- * @param mailbox A mailbox which may be shared with other actors, or null.
- * @param parent The parent actor to which unrecognized requests are forwarded, or null.
- * @return The new actor.
- */
- public static Actor newActor(Actor actor, String actorType, Mailbox mailbox, Actor parent)
- throws Exception {
- if (!(actor instanceof Factory))
- actor = actor.getAncestor(Factory.class);
- if (actor == null)
- return null;
- Factory factory = (Factory) actor;
- return factory.newActor(actorType, mailbox, parent);
- }
-
- /**
- * A table which maps type names to actor factories.
- */
- private ConcurrentSkipListMap<String, ActorFactory> types = new ConcurrentSkipListMap<String, ActorFactory>();
-
- /**
- * Creates a new actor.
- *
- * @param actorType The actor type.
- * @return The new actor.
- */
- public Actor newActor(String actorType)
- throws Exception {
- return newActor(actorType, null, null);
- }
-
- /**
- * Creates a new actor.
- *
- * @param actorType The actor type.
- * @param mailbox A mailbox which may be shared with other actors, or null.
- * @return The new actor.
- */
- public Actor newActor(String actorType, Mailbox mailbox)
- throws Exception {
- return newActor(actorType, mailbox, null);
- }
-
- /**
- * Creates a new actor.
- *
- * @param actorType The actor type.
- * @param mailbox A mailbox which may be shared with other actors, or null.
- * @param parent The parent actor to which unrecognized requests are forwarded, or null.
- * @return The new actor.
- */
- public Actor newActor(String actorType, Mailbox mailbox, Actor parent)
- throws Exception {
- if (mailbox == null || parent == null) {
- if (mailbox == null) mailbox = getMailbox();
- if (parent == null) parent = this;
- }
- ActorFactory af = types.get(actorType);
- if (af == null) {
- Factory a = (Factory) getAncestor(Factory.class);
- if (a != null)
- return a.newActor(actorType, mailbox, parent);
- throw new IllegalArgumentException("Unknown actor type: " + actorType);
- }
- return af.newActor(mailbox, parent);
- }
-
- /**
- * Returns the requested actor factory.
- *
- * @param actorType The actor type.
- * @return The registered actor factory.
- */
- @Override
- public ActorFactory getActorFactory(String actorType)
- throws Exception {
- ActorFactory af = types.get(actorType);
- if (af == null) {
- Factory a = (Factory) getAncestor(Factory.class);
- if (a != null)
- return a.getActorFactory(actorType);
- throw new IllegalArgumentException("Unknown actor type: " + actorType);
- }
- return af;
- }
-
- /**
- * Bind an actor type to a Class.
- *
- * @param actorType The actor type.
- * @param clazz The class of the actor.
- */
- @Override
- public void defineActorType(String actorType, Class clazz)
- throws Exception {
- if (types.containsKey(actorType))
- throw new IllegalArgumentException("Actor type is already defined: " + actorType);
- if (Actor.class.isAssignableFrom(clazz)) {
- Constructor componentConstructor = clazz.getConstructor();
- types.put(actorType, new _ActorFactory(actorType, componentConstructor));
- return;
- }
- throw new IllegalArgumentException(clazz.getName());
- }
-
- /**
- * Register an actor factory.
- *
- * @param actorFactory An actor factory.
- */
- @Override
- public void registerActorFactory(ActorFactory actorFactory)
- throws Exception {
- String actorType = actorFactory.actorType;
- ActorFactory old = types.get(actorType);
- if (old == null)
- types.put(actorType, actorFactory);
- else if (!old.equals(actorFactory))
- throw new IllegalArgumentException("Actor type is already defined: " + actorType);
- }
-}
View
57 src/main/java/org/agilewiki/jactor/factory/JAFactoryFactory.java
@@ -1,57 +0,0 @@
-/*
- * Copyright 2011 Bill La Forge
- *
- * This file is part of AgileWiki and is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License (LGPL) as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This code is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- * or navigate to the following url http://www.gnu.org/licenses/lgpl-2.1.txt
- *
- * Note however that only Scala, Java and JavaScript files are being covered by LGPL.
- * All other files are covered by the Common Public License (CPL).
- * A copy of this license is also included and can be
- * found as well at http://www.opensource.org/licenses/cpl1.0.txt
- */
-package org.agilewiki.jactor.factory;
-
-import org.agilewiki.jactor.lpc.JLPCActor;
-
-/**
- * Creates a JAFactory.
- */
-public class JAFactoryFactory extends ActorFactory {
- /**
- * The default name of the JFactory actor.
- */
- public final static String TYPE = "JAFactory";
-
- /**
- * Create an ActorFactory.
- *
- * @param actorType The actor type.
- */
- public JAFactoryFactory(String actorType) {
- super(actorType);
- }
-
- /**
- * Create a JLPCActor.
- *
- * @return The new actor.
- */
- @Override
- protected JLPCActor instantiateActor()
- throws Exception {
- return new JAFactory();
- }
-}
-
View
52 src/main/java/org/agilewiki/jactor/factory/Requirement.java
@@ -1,52 +0,0 @@
-/*
- * Copyright 2011 Bill La Forge
- *
- * This file is part of AgileWiki and is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License (LGPL) as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This code is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- * or navigate to the following url http://www.gnu.org/licenses/lgpl-2.1.txt
- *
- * Note however that only Scala, Java and JavaScript files are being covered by LGPL.
- * All other files are covered by the Common Public License (CPL).
- * A copy of this license is also included and can be
- * found as well at http://www.opensource.org/licenses/cpl1.0.txt
- */
-package org.agilewiki.jactor.factory;
-
-import org.agilewiki.jactor.lpc.Request;
-
-/**
- * Provides a request which must be supported and the factory of an actor which.does.
- */
-final public class Requirement {
- /**
- * A request the must be supported.
- */
- public final Request request;
-
- /**
- * The factory of an actor which supports the request.
- */
- public final ActorFactory actorFactory;
-
- /**
- * Create a Requirement.
- *
- * @param request A request the must be supported.
- * @param actorFactory The factory of an actor which supports the request.
- */
- public Requirement(Request request, ActorFactory actorFactory) {
- this.request = request;
- this.actorFactory = actorFactory;
- }
-}
View
59 src/main/java/org/agilewiki/jactor/factory/_ActorFactory.java
@@ -1,59 +0,0 @@
-/*
- * Copyright 2011 Bill La Forge
- *
- * This file is part of AgileWiki and is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License (LGPL) as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This code is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- * or navigate to the following url http://www.gnu.org/licenses/lgpl-2.1.txt
- *
- * Note however that only Scala, Java and JavaScript files are being covered by LGPL.
- * All other files are covered by the Common Public License (CPL).
- * A copy of this license is also included and can be
- * found as well at http://www.opensource.org/licenses/cpl1.0.txt
- */
-package org.agilewiki.jactor.factory;
-
-import org.agilewiki.jactor.lpc.JLPCActor;
-
-import java.lang.reflect.Constructor;
-
-/**
- * Creates a JLPCActor using a Constructor.
- */
-final public class _ActorFactory extends ActorFactory {
- /**
- * The constructor used to create the actor.
- */
- private Constructor<JLPCActor> constructor;
-
- /**
- * Create an ActorFactory.
- *
- * @param actorType The actor type.
- * @param constructor The constructor used to create the actor.
- */
- public _ActorFactory(String actorType, Constructor<JLPCActor> constructor) {
- super(actorType);
- this.constructor = constructor;
- }
-
- /**
- * Create a JLPCActor.
- *
- * @return The new actor.
- */
- protected JLPCActor instantiateActor()
- throws Exception {
- return constructor.newInstance();
- }
-}
View
82 src/main/java/org/agilewiki/jactor/lpc/JLPCActor.java
@@ -28,8 +28,6 @@
import org.agilewiki.jactor.bufferedEvents.BufferedEventsDestination;
import org.agilewiki.jactor.bufferedEvents.BufferedEventsQueue;
import org.agilewiki.jactor.events.EventQueue;
-import org.agilewiki.jactor.factory.ActorFactory;
-import org.agilewiki.jactor.factory.Requirement;
import org.agilewiki.jactor.simpleMachine._SMBuilder;
import java.util.ArrayList;
@@ -62,11 +60,6 @@
*/
abstract public class JLPCActor implements TargetActor, RequestProcessor, RequestSource {
/**
- * The factory, or null.
- */
- private ActorFactory factory;
-
- /**
* The inbox and outbox of the actor.
*/
private Mailbox mailbox;
@@ -79,26 +72,26 @@
/**
* Initialize a degraded LiteActor
*/
- final public void initialize() throws Exception {
- initialize(null, null, null);
+ public void initialize() throws Exception {
+ initialize(null, null);
}
/**
* Initialize a degraded LiteActor
*
* @param parent The parent actor.
*/
- final public void initialize(Actor parent) throws Exception {
- initialize(null, parent, null);
+ public void initialize(Actor parent) throws Exception {
+ initialize(null, parent);
}
/**
* Initialize a LiteActor
*
* @param mailbox A mailbox which may be shared with other actors.
*/
- final public void initialize(final Mailbox mailbox) throws Exception {
- initialize(mailbox, null, null);
+ public void initialize(final Mailbox mailbox) throws Exception {
+ initialize(mailbox, null);
}
/**
@@ -107,37 +100,10 @@ final public void initialize(final Mailbox mailbox) throws Exception {
* @param mailbox A mailbox which may be shared with other actors.
* @param parent The parent actor.
*/
- final public void initialize(final Mailbox mailbox, Actor parent) throws Exception {
- initialize(mailbox, parent, null);
- }
-
- /**
- * Initialize a LiteActor
- *
- * @param mailbox A mailbox which may be shared with other actors.
- * @param parent The parent actor.
- * @param factory The factory.
- */
- public void initialize(final Mailbox mailbox, Actor parent, ActorFactory factory) throws Exception {
- if (this.mailbox != null || this.factory != null || this.parent != null)
+ public void initialize(final Mailbox mailbox, Actor parent) throws Exception {
+ if (this.mailbox != null || this.parent != null)
throw new IllegalStateException("already initialized");
this.mailbox = mailbox;
- this.factory = factory;
- Requirement[] requirements = requirements();
- if (requirements == null || requirements.length == 0) {
- this.parent = (JLPCActor) parent;
- return;
- }
- int i = 0;
- while (i < requirements.length) {
- Requirement requirement = requirements[i];
- Request request = requirement.request;
- if (parent == null || request.getTargetActor(parent) == null) {
- ActorFactory actorFactory = requirement.actorFactory;
- parent = actorFactory.newActor(mailbox, parent);
- }
- i += 1;
- }
this.parent = (JLPCActor) parent;
}
@@ -173,38 +139,6 @@ final public JLPCActor getAncestor(Class targetClass) {
}
/**
- * Returns the actor's requirements.
- *
- * @return The actor's requirents.
- */
- protected Requirement[] requirements()
- throws Exception {
- return null;
- }
-
- /**
- * Returns the actor type.
- *
- * @return The actor type, or null.
- */
- @Override
- final public String getActorType() {
- if (factory == null)
- return null;
- return factory.actorType;
- }
-
- /**
- * Returns the factory.
- *
- * @return The factory, or null.
- */
- @Override
- final public ActorFactory getFactory() {
- return factory;
- }
-
- /**
* Returns the exception handler.
*
* @return The exception handler.
View
12 src/main/java/org/agilewiki/jactor/lpc/Request.java
@@ -70,8 +70,7 @@ final public RESPONSE_TYPE send(JAFuture future, Actor targetActor)
return send(future, parent);
throw new UnsupportedOperationException(
"request: " + getClass().getName() +
- " target actor: " + targetActor.getClass().getName() +
- " target actor type: " + targetActor.getActorType());
+ " target actor: " + targetActor.getClass().getName());
}
/**
@@ -107,8 +106,7 @@ final public void send(APCRequestSource requestSource, Actor targetActor, RP<RES
}
throw new UnsupportedOperationException(
"request: " + getClass().getName() +
- " target actor: " + targetActor.getClass().getName() +
- " target actor type: " + targetActor.getActorType());
+ " target actor: " + targetActor.getClass().getName());
}
@@ -144,8 +142,7 @@ final public void sendEvent(Actor targetActor)
}
throw new UnsupportedOperationException(
"request: " + getClass().getName() +
- " target actor: " + targetActor.getClass().getName() +
- " target actor type: " + targetActor.getActorType());
+ " target actor: " + targetActor.getClass().getName());
}
/**
@@ -179,8 +176,7 @@ final public void sendEvent(APCRequestSource requestSource, Actor targetActor)
}
throw new UnsupportedOperationException(
"request: " + getClass().getName() +
- " target actor: " + targetActor.getClass().getName() +
- " target actor type: " + targetActor.getActorType());
+ " target actor: " + targetActor.getClass().getName());
}
/**
View
55 src/main/java/org/agilewiki/jactor/nbLock/JNBLockFactory.java
@@ -1,55 +0,0 @@
-/*
- * Copyright 2011 Bill La Forge
- *
- * This file is part of AgileWiki and is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License (LGPL) as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This code is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- * or navigate to the following url http://www.gnu.org/licenses/lgpl-2.1.txt
- *
- * Note however that only Scala, Java and JavaScript files are being covered by LGPL.
- * All other files are covered by the Common Public License (CPL).
- * A copy of this license is also included and can be
- * found as well at http://www.opensource.org/licenses/cpl1.0.txt
- */
-package org.agilewiki.jactor.nbLock;
-
-import org.agilewiki.jactor.factory.ActorFactory;
-
-/**
- * Creates a NBLock actor.
- */
-public class JNBLockFactory extends ActorFactory {
- /**
- * The default type of the NBLock actor.
- */
- public final static String TYPE = "JANBLock";
-
- /**
- * Create an ActorFactory.
- *
- * @param actorType The actor type.
- */
- public JNBLockFactory(String actorType) {
- super(actorType);
- }
-
- /**
- * Create a JLPCActor.
- *
- * @return The new actor.
- */
- @Override
- protected JANBLock instantiateActor() throws Exception {
- return new JANBLock();
- }
-}
View
56 src/main/java/org/agilewiki/jactor/properties/JAPropertiesFactory.java
@@ -1,56 +0,0 @@
-/*
- * Copyright 2011 Bill La Forge
- *
- * This file is part of AgileWiki and is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License (LGPL) as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This code is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- * or navigate to the following url http://www.gnu.org/licenses/lgpl-2.1.txt
- *
- * Note however that only Scala, Java and JavaScript files are being covered by LGPL.
- * All other files are covered by the Common Public License (CPL).
- * A copy of this license is also included and can be
- * found as well at http://www.opensource.org/licenses/cpl1.0.txt
- */
-package org.agilewiki.jactor.properties;
-
-import org.agilewiki.jactor.factory.ActorFactory;
-
-/**
- * Creates a Properties actor.
- */
-public class JAPropertiesFactory extends ActorFactory {
- /**
- * The default name of the JFactory actor.
- */
- public final static String TYPE = "JAProperties";
-
- /**
- * Create an ActorFactory.
- *
- * @param actorType The actor type.
- */
- public JAPropertiesFactory(String actorType) {
- super(actorType);
- }
-
- /**
- * Create a JLPCActor.
- *
- * @return The new actor.
- */
- @Override
- protected JAProperties instantiateActor()
- throws Exception {
- return new JAProperties();
- }
-}
View
56 src/main/java/org/agilewiki/jactor/pubsub/actorName/JActorNameFactory.java
@@ -1,56 +0,0 @@
-/*
- * Copyright 2011 Bill La Forge
- *
- * This file is part of AgileWiki and is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License (LGPL) as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This code is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- * or navigate to the following url http://www.gnu.org/licenses/lgpl-2.1.txt
- *
- * Note however that only Scala, Java and JavaScript files are being covered by LGPL.
- * All other files are covered by the Common Public License (CPL).
- * A copy of this license is also included and can be
- * found as well at http://www.opensource.org/licenses/cpl1.0.txt
- */
-package org.agilewiki.jactor.pubsub.actorName;
-
-import org.agilewiki.jactor.factory.ActorFactory;
-
-/**
- * Creates a Properties actor.
- */
-public class JActorNameFactory extends ActorFactory {
- /**
- * The default name of the JFactory actor.
- */
- public final static String TYPE = "JActorName";
-
- /**
- * Create an ActorFactory.
- *
- * @param actorType The actor type.
- */
- public JActorNameFactory(String actorType) {
- super(actorType);
- }
-
- /**
- * Create a JLPCActor.
- *
- * @return The new actor.
- */
- @Override
- protected JActorName instantiateActor()
- throws Exception {
- return new JActorName();
- }
-}
View
56 src/main/java/org/agilewiki/jactor/pubsub/publisher/JAPublisherFactory.java
@@ -1,56 +0,0 @@
-/*
- * Copyright 2011 Bill La Forge
- *
- * This file is part of AgileWiki and is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License (LGPL) as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This code is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- * or navigate to the following url http://www.gnu.org/licenses/lgpl-2.1.txt
- *
- * Note however that only Scala, Java and JavaScript files are being covered by LGPL.
- * All other files are covered by the Common Public License (CPL).
- * A copy of this license is also included and can be
- * found as well at http://www.opensource.org/licenses/cpl1.0.txt
- */
-package org.agilewiki.jactor.pubsub.publisher;
-
-import org.agilewiki.jactor.factory.ActorFactory;
-
-/**
- * Creates a JAPublisher actor.
- */
-public class JAPublisherFactory extends ActorFactory {
- /**
- * The default name of the JFactory actor.
- */
- public final static String TYPE = "JAPublisher";
-
- /**
- * Create an ActorFactory.
- *
- * @param actorType The actor type.
- */
- public JAPublisherFactory(String actorType) {
- super(actorType);
- }
-
- /**
- * Create a JLPCActor.
- *
- * @return The new actor.
- */
- @Override
- protected JAPublisher instantiateActor()
- throws Exception {
- return new JAPublisher();
- }
-}
View
56 src/main/java/org/agilewiki/jactor/pubsub/subscriber/JASubscriberFactory.java
@@ -1,56 +0,0 @@
-/*
- * Copyright 2011 Bill La Forge
- *
- * This file is part of AgileWiki and is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License (LGPL) as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This code is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- * or navigate to the following url http://www.gnu.org/licenses/lgpl-2.1.txt
- *
- * Note however that only Scala, Java and JavaScript files are being covered by LGPL.
- * All other files are covered by the Common Public License (CPL).
- * A copy of this license is also included and can be
- * found as well at http://www.opensource.org/licenses/cpl1.0.txt
- */
-package org.agilewiki.jactor.pubsub.subscriber;
-
-import org.agilewiki.jactor.factory.ActorFactory;
-
-/**
- * Creates a JASubscriber actor.
- */
-public class JASubscriberFactory extends ActorFactory {
- /**
- * The default name of the JFactory actor.
- */
- public final static String TYPE = "JASubscriber";
-
- /**
- * Create an ActorFactory.
- *
- * @param actorType The actor type.
- */
- public JASubscriberFactory(String actorType) {
- super(actorType);
- }
-
- /**
- * Create a JLPCActor.
- *
- * @return The new actor.
- */
- @Override
- protected JASubscriber instantiateActor()
- throws Exception {
- return new JASubscriber();
- }
-}
View
12 src/test/java/org/agilewiki/jactor/factory/Foo.java
@@ -1,12 +0,0 @@
-package org.agilewiki.jactor.factory;
-
-import org.agilewiki.jactor.lpc.JLPCActor;
-
-/**
- * Test code.
- */
-public class Foo extends JLPCActor {
- public void hi() {
- System.out.println("Hello world!");
- }
-}
View
25 src/test/java/org/agilewiki/jactor/factory/JFactoryTest.java
@@ -1,25 +0,0 @@
-package org.agilewiki.jactor.factory;
-
-import junit.framework.TestCase;
-import org.agilewiki.jactor.JAMailboxFactory;
-import org.agilewiki.jactor.MailboxFactory;
-
-/**
- * Test code.
- */
-public class JFactoryTest extends TestCase {
- public void test() {
- MailboxFactory mailboxFactory = JAMailboxFactory.newMailboxFactory(1);
- try {
- JAFactory f = new JAFactory();
- f.initialize(mailboxFactory.createMailbox());
- f.defineActorType("Foo", Foo.class);
- Foo foo = (Foo) JAFactory.newActor(f, "Foo");
- foo.hi();
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- mailboxFactory.close();
- }
- }
-}
View
6 src/test/java/org/agilewiki/jactor/factory/timing/A.java
@@ -1,6 +0,0 @@
-package org.agilewiki.jactor.factory.timing;
-
-import org.agilewiki.jactor.lpc.JLPCActor;
-
-public class A extends JLPCActor {
-}
View
16 src/test/java/org/agilewiki/jactor/factory/timing/AFactory.java
@@ -1,16 +0,0 @@
-package org.agilewiki.jactor.factory.timing;
-
-import org.agilewiki.jactor.factory.ActorFactory;
-import org.agilewiki.jactor.lpc.JLPCActor;
-
-public class AFactory extends ActorFactory {
-
- public AFactory(String actorType) {
- super(actorType);
- }
-
- @Override
- protected JLPCActor instantiateActor() throws Exception {
- return new A();
- }
-}
View
30 src/test/java/org/agilewiki/jactor/factory/timing/test1/Creation1Test.java
@@ -1,30 +0,0 @@
-package org.agilewiki.jactor.factory.timing.test1;
-
-import junit.framework.TestCase;
-
-public class Creation1Test extends TestCase {
- public void test() {
-
- long c = 1;
-
- //System.out.println("####################################################");
- //long c = 1000000000;
- //iterations per second = 2,816,901,408
-
- loop(c);
- loop(c);
- long t0 = System.currentTimeMillis();
- loop(c);
- long t1 = System.currentTimeMillis();
- long d = t1 - t0;
- if (d > 0)
- System.out.println(1000 * c / d);
- }
-
- void loop(long c) {
- int i = 0;
- while (i < c) {
- i += 1;
- }
- }
-}
View
44 src/test/java/org/agilewiki/jactor/factory/timing/test2/Creation2Test.java
@@ -1,44 +0,0 @@
-package org.agilewiki.jactor.factory.timing.test2;
-
-import junit.framework.TestCase;
-import org.agilewiki.jactor.JAMailboxFactory;
-import org.agilewiki.jactor.Mailbox;
-import org.agilewiki.jactor.MailboxFactory;
-import org.agilewiki.jactor.factory.timing.A;
-
-public class Creation2Test extends TestCase {
- public void test() {
-
- long c = 1;
-
- //System.out.println("####################################################");
- //long c = 1000000000;
- //iterations per second = 2,801,120,448
-
- MailboxFactory mailboxFactory = JAMailboxFactory.newMailboxFactory(1);
- try {
- Mailbox m = mailboxFactory.createMailbox();
- loop(c, m);
- loop(c, m);
- long t0 = System.currentTimeMillis();
- loop(c, m);
- long t1 = System.currentTimeMillis();
- long d = t1 - t0;
- if (d > 0)
- System.out.println(1000 * c / d);
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- mailboxFactory.close();
- }
- }
-
- void loop(long c, Mailbox m)
- throws Exception {
- int i = 0;
- while (i < c) {
- (new A()).initialize(m);
- i += 1;
- }
- }
-}
View
45 src/test/java/org/agilewiki/jactor/factory/timing/test3/Creation3Test.java
@@ -1,45 +0,0 @@
-package org.agilewiki.jactor.factory.timing.test3;
-
-import junit.framework.TestCase;
-import org.agilewiki.jactor.JAMailboxFactory;
-import org.agilewiki.jactor.MailboxFactory;
-import org.agilewiki.jactor.factory.JAFactory;
-import org.agilewiki.jactor.factory.timing.A;
-
-public class Creation3Test extends TestCase {
- public void test() {
-
- long c = 1;
-
- //System.out.println("####################################################");
- //long c = 10000000;
- //iterations per second = 49,261,083
-
- MailboxFactory mailboxFactory = JAMailboxFactory.newMailboxFactory(1);
- try {
- JAFactory f = new JAFactory();
- f.initialize(mailboxFactory.createMailbox());
- f.defineActorType("A", A.class);
- loop(c, f);
- loop(c, f);
- long t0 = System.currentTimeMillis();
- loop(c, f);
- long t1 = System.currentTimeMillis();
- long d = t1 - t0;
- if (d > 0)
- System.out.println(1000 * c / d);
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- mailboxFactory.close();
- }
- }
-
- void loop(long c, JAFactory f) throws Exception {
- int i = 0;
- while (i < c) {
- JAFactory.newActor(f, "A");
- i += 1;
- }
- }
-}
View
50 src/test/java/org/agilewiki/jactor/factory/timing/test4/Creation4Test.java
@@ -1,50 +0,0 @@
-package org.agilewiki.jactor.factory.timing.test4;
-
-import junit.framework.TestCase;
-import org.agilewiki.jactor.JAMailboxFactory;
-import org.agilewiki.jactor.Mailbox;
-import org.agilewiki.jactor.MailboxFactory;
-import org.agilewiki.jactor.factory.ActorFactory;
-import org.agilewiki.jactor.factory.JAFactory;
-import org.agilewiki.jactor.factory.timing.A;
-
-public class Creation4Test extends TestCase {
- public void test() {
-
- long c = 1;
-
- //System.out.println("####################################################");
- //long c = 100000000;
- //iterations per second = 323,624,595
-
- MailboxFactory mailboxFactory = JAMailboxFactory.newMailboxFactory(1);
- try {
- JAFactory f = new JAFactory();
- f.initialize(mailboxFactory.createMailbox());
- f.defineActorType("A", A.class);
- loop(c, f);
- loop(c, f);
- long t0 = System.currentTimeMillis();
- loop(c, f);
- long t1 = System.currentTimeMillis();
- long d = t1 - t0;
- if (d > 0)
- System.out.println(1000 * c / d);
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- mailboxFactory.close();
- }
- }
-
- void loop(long c, JAFactory f) throws Exception {
- ActorFactory af = JAFactory.getActorFactory(f, "A");
- MailboxFactory mailboxFactory = f.getMailboxFactory();
- Mailbox m = mailboxFactory.createMailbox();
- int i = 0;
- while (i < c) {
- af.newActor(m, f);
- i += 1;
- }
- }
-}
View
50 src/test/java/org/agilewiki/jactor/factory/timing/test5/Creation5Test.java
@@ -1,50 +0,0 @@
-package org.agilewiki.jactor.factory.timing.test5;
-
-import junit.framework.TestCase;
-import org.agilewiki.jactor.JAMailboxFactory;
-import org.agilewiki.jactor.Mailbox;
-import org.agilewiki.jactor.MailboxFactory;
-import org.agilewiki.jactor.factory.ActorFactory;
-import org.agilewiki.jactor.factory.JAFactory;
-import org.agilewiki.jactor.factory.timing.AFactory;
-
-public class Creation5Test extends TestCase {
- public void test() {
-
- long c = 1;
-
- //System.out.println("####################################################");
- //long c = 1000000000;
- //iterations per second = 2,777,777,777
-
- MailboxFactory mailboxFactory = JAMailboxFactory.newMailboxFactory(1);
- try {
- JAFactory f = new JAFactory();
- f.initialize(mailboxFactory.createMailbox());
- f.registerActorFactory(new AFactory("A"));
- loop(c, f);
- loop(c, f);
- long t0 = System.currentTimeMillis();
- loop(c, f);
- long t1 = System.currentTimeMillis();
- long d = t1 - t0;
- if (d > 0)
- System.out.println(1000 * c / d);
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- mailboxFactory.close();
- }
- }
-
- void loop(long c, JAFactory f) throws Exception {
- ActorFactory af = JAFactory.getActorFactory(f, "A");
- MailboxFactory mailboxFactory = f.getMailboxFactory();
- Mailbox m = mailboxFactory.createMailbox();
- int i = 0;
- while (i < c) {
- af.newActor(m, f);
- i += 1;
- }
- }
-}
View
5 src/test/java/org/agilewiki/jactor/lpc/calculatorTest/PrintingCalculator.java
@@ -4,7 +4,6 @@
import org.agilewiki.jactor.ExceptionHandler;
import org.agilewiki.jactor.Mailbox;
import org.agilewiki.jactor.RP;
-import org.agilewiki.jactor.factory.ActorFactory;
import org.agilewiki.jactor.lpc.JLPCActor;
/**
@@ -14,9 +13,9 @@
private Calculator calculator;
@Override
- public void initialize(Mailbox mailbox, Actor parent, ActorFactory actorFactory)
+ public void initialize(Mailbox mailbox, Actor parent)
throws Exception {
- super.initialize(mailbox, parent, actorFactory);
+ super.initialize(mailbox, parent);
calculator = new Calculator();
calculator.initialize(mailbox, parent);
}

0 comments on commit be4ec95

Please sign in to comment.