OW2 Consortium
Search OW2 Mail Archive: 

Advanced Search - Powered by Google


Mail Archive Home | gotm-commits List | May 2005 Index

<--  Date Index  --> <--  Thread Index  -->

CVS update of fractal-pool (5 files)


    Date: Monday, May 23, 2005 @ 13:20:57
  Author: rouvoy
    Path: /cvsroot/gotm/fractal-pool

Modified: 
examples/helloworld/src/java/org/objectweb/fractal/example/HelloWorld.java
          
          examples/pool/src/java/org/objectweb/fractal/example/Client.java
          examples/pool/src/java/org/objectweb/fractal/example/ServerImpl.java
           src/java/org/objectweb/fractal/pool/lib/BasicPool.java
          src/java/org/objectweb/fractal/pool/lib/PoolWithTemplate.java

* Logging improved,
* Performance improved,
* Cosmetic Updates.


----------------------------------------------------------------------------+
 examples/helloworld/src/java/org/objectweb/fractal/example/HelloWorld.java | 
  19 ++----
 examples/pool/src/java/org/objectweb/fractal/example/Client.java           | 
  26 +++-----
 examples/pool/src/java/org/objectweb/fractal/example/ServerImpl.java       | 
  30 +++++-----
 src/java/org/objectweb/fractal/pool/lib/BasicPool.java                     | 
  24 ++++----
 src/java/org/objectweb/fractal/pool/lib/PoolWithTemplate.java              | 
   7 +-
 5 files changed, 47 insertions(+), 59 deletions(-)


Index: 
fractal-pool/examples/helloworld/src/java/org/objectweb/fractal/example/HelloWorld.java
diff -u 
fractal-pool/examples/helloworld/src/java/org/objectweb/fractal/example/HelloWorld.java:1.3
 
fractal-pool/examples/helloworld/src/java/org/objectweb/fractal/example/HelloWorld.java:1.4
--- 
fractal-pool/examples/helloworld/src/java/org/objectweb/fractal/example/HelloWorld.java:1.3
 Mon Mar 14 13:42:22 2005
+++ 
fractal-pool/examples/helloworld/src/java/org/objectweb/fractal/example/HelloWorld.java
     Mon May 23 13:20:57 2005
@@ -23,7 +23,7 @@
 Contributor(s): .
 
 ---------------------------------------------------------------------
-$Id: HelloWorld.java,v 1.3 2005/03/14 12:42:22 rouvoy Exp $
+$Id: HelloWorld.java,v 1.4 2005/05/23 11:20:57 rouvoy Exp $
 ====================================================================*/
 package org.objectweb.fractal.example;
 
@@ -36,8 +36,8 @@
 /**
  * @author <a href="mailto:Romain.Rouvoy@xxxxxxx";>Romain Rouvoy</a>
  * @created 20 janv. 2005
- * @modified $Date: 2005/03/14 12:42:22 $
- * @version $Revision: 1.3 $
+ * @modified $Date: 2005/05/23 11:20:57 $
+ * @version $Revision: 1.4 $
  * @fractal.itf name="r" signature="java.lang.Runnable"
  */
 public class HelloWorld
@@ -55,7 +55,7 @@
      * @see org.objectweb.fractal.api.control.CacheController#loadFc()
      */
     public void initFc() {
-        getTrace().info("Loading component state");
+        getLogger().log(INFO,"Loading component state");
         this.message="Hello World !";
     }
 
@@ -63,7 +63,7 @@
      * @see org.objectweb.fractal.api.control.CacheController#unloadFc()
      */
     public void clearFc() {
-        getTrace().info("Clearing component state");
+        getLogger().log(INFO,"Clearing component state");
         this.message= null;
     }
 
@@ -82,19 +82,14 @@
     }
     
     protected Component getComponent() {
-        try {
-            return (Component) lookupFc("component");
-        } catch (NoSuchInterfaceException e) {
-            e.printStackTrace();
-        }
-        return null;
+        return (Component) fcBindings.get("component");
     }
     
     protected CacheController getLoadingController(){
         try {
             return (CacheController) 
getComponent().getFcInterface("cache-controller");
         } catch (NoSuchInterfaceException e) {
-            e.printStackTrace();
+            getLogger().log(ERROR, "getLoadingController()", e);
         }
         return null;
     }
Index: 
fractal-pool/examples/pool/src/java/org/objectweb/fractal/example/Client.java
diff -u 
fractal-pool/examples/pool/src/java/org/objectweb/fractal/example/Client.java:1.3
 
fractal-pool/examples/pool/src/java/org/objectweb/fractal/example/Client.java:1.4
--- 
fractal-pool/examples/pool/src/java/org/objectweb/fractal/example/Client.java:1.3
   Mon Mar 14 13:42:22 2005
+++ 
fractal-pool/examples/pool/src/java/org/objectweb/fractal/example/Client.java 
      Mon May 23 13:20:56 2005
@@ -23,7 +23,7 @@
 Contributor(s): .
 
 ---------------------------------------------------------------------
-$Id: Client.java,v 1.3 2005/03/14 12:42:22 rouvoy Exp $
+$Id: Client.java,v 1.4 2005/05/23 11:20:56 rouvoy Exp $
 ====================================================================*/
 package org.objectweb.fractal.example;
 
@@ -35,8 +35,8 @@
 /**
  * @author <a href="mailto:Romain.Rouvoy@xxxxxxx";>Romain Rouvoy</a>
  * @created 20 janv. 2005
- * @modified $Date: 2005/03/14 12:42:22 $
- * @version $Revision: 1.3 $
+ * @modified $Date: 2005/05/23 11:20:56 $
+ * @version $Revision: 1.4 $
  * @fractal.itf name="r" signature="java.lang.Runnable"
  * @fractal.itf name="fc-pool" role="client" 
signature="org.objectweb.fractal.pool.api.Pool"
  */
@@ -55,32 +55,26 @@
      * @return the reference of the pool component.
      */
     protected Pool getFcPool() {
-        try {
-            return (Pool) lookupFc(Pool.POOL);
-        } catch (NoSuchInterfaceException e) {
-            getTrace().error(e.getMessage());
-            return null;
-        }
+        return (Pool) fcBindings.get(Pool.POOL);
     }
     
     /* (non-Javadoc)
      * @see java.lang.Runnable#run()
      */
     public void run() {
-        getTrace().info("Running the pool example");
-        getTrace().info("Retrieving Server instance");
+        getLogger().log(INFO,"Retrieving Server instance");
         Component c = getFcPool().getFcInstance();
         try {
-            getTrace().info("Looking for the s interface");
+            getLogger().log(INFO,"Looking for the s interface");
             Server s = (Server) c.getFcInterface("s");
-            getTrace().info("Calling method print()");
+            getLogger().log(INFO,"Calling method print()");
             s.print();
         } catch (NoSuchInterfaceException e) {
-            getTrace().error(e.getMessage());       
+            getLogger().log(ERROR,e.getMessage());       
         }
-        getTrace().info("Putting Server intance back to the pool");
+        getLogger().log(INFO,"Putting Server intance back to the pool");
         getFcPool().putFcInstance(c);
-        getTrace().info("Flushing the pool");
+        getLogger().log(INFO,"Flushing the pool");
         getFcPool().flushFcInstance();
     }
 }
Index: 
fractal-pool/examples/pool/src/java/org/objectweb/fractal/example/ServerImpl.java
diff -u 
fractal-pool/examples/pool/src/java/org/objectweb/fractal/example/ServerImpl.java:1.2
 
fractal-pool/examples/pool/src/java/org/objectweb/fractal/example/ServerImpl.java:1.3
--- 
fractal-pool/examples/pool/src/java/org/objectweb/fractal/example/ServerImpl.java:1.2
       Mon Mar 14 13:42:22 2005
+++ 
fractal-pool/examples/pool/src/java/org/objectweb/fractal/example/ServerImpl.java
   Mon May 23 13:20:56 2005
@@ -23,7 +23,7 @@
 Contributor(s): .
 
 ---------------------------------------------------------------------
-$Id: ServerImpl.java,v 1.2 2005/03/14 12:42:22 rouvoy Exp $
+$Id: ServerImpl.java,v 1.3 2005/05/23 11:20:56 rouvoy Exp $
 ====================================================================*/
 package org.objectweb.fractal.example;
 
@@ -37,8 +37,8 @@
 /**
  * @author <a href="mailto:Romain.Rouvoy@xxxxxxx";>Romain Rouvoy</a>
  * @created 20 janv. 2005
- * @modified $Date: 2005/03/14 12:42:22 $
- * @version $Revision: 1.2 $
+ * @modified $Date: 2005/05/23 11:20:56 $
+ * @version $Revision: 1.3 $
  * @fractal.itf
  */
 public class ServerImpl
@@ -63,11 +63,11 @@
     public void startFc() {
         try {
             LifeCycleController lcc = 
Fractal.getLifeCycleController((Component)lookupFc("component"));
-            getTrace().debug("Server is "+lcc.getFcState());
+            getLogger().log(DEBUG,"Server is "+lcc.getFcState());
         } catch (NoSuchInterfaceException e) {
-            getTrace().error("LifeCycle controller not available!");
+            getLogger().log(ERROR,"LifeCycle controller not available!");
         }
-        getTrace().info("Starting the server component ("+this+")");
+        getLogger().log(INFO,"Starting the server component ("+this+")");
     }
 
     /* (non-Javadoc)
@@ -76,11 +76,11 @@
     public void stopFc() {
         try {
             LifeCycleController lcc = 
Fractal.getLifeCycleController((Component)lookupFc("component"));
-            getTrace().debug("Server is "+lcc.getFcState());
+            getLogger().log(DEBUG,"Server is "+lcc.getFcState());
         } catch (NoSuchInterfaceException e) {
-            getTrace().error("LifeCycle controller not available!");
+            getLogger().log(ERROR,"LifeCycle controller not available!");
         }
-        getTrace().info("Stopping the server component ("+this+")");
+        getLogger().log(INFO,"Stopping the server component ("+this+")");
     }
     /* (non-Javadoc)
      * @see org.objectweb.fractal.api.control.CacheController#loadFc()
@@ -88,11 +88,11 @@
     public void initFc() {
         try {
             LifeCycleController lcc = 
Fractal.getLifeCycleController((Component)lookupFc("component"));
-            getTrace().debug("Server is "+lcc.getFcState());
+            getLogger().log(DEBUG,"Server is "+lcc.getFcState());
         } catch (NoSuchInterfaceException e) {
-            getTrace().error("LifeCycle controller not available!");
+            getLogger().log(ERROR,"LifeCycle controller not available!");
         }
-        getTrace().info("Loading server component state ("+this+")");
+        getLogger().log(INFO,"Loading server component state ("+this+")");
         this.message="Hello World !";
     }
 
@@ -102,11 +102,11 @@
     public void clearFc() {
         try {
             LifeCycleController lcc = 
Fractal.getLifeCycleController((Component)lookupFc("component"));
-            getTrace().debug("Server is "+lcc.getFcState());
+            getLogger().log(DEBUG,"Server is "+lcc.getFcState());
         } catch (NoSuchInterfaceException e) {
-            getTrace().error("LifeCycle controller not available!");
+            getLogger().log(ERROR,"LifeCycle controller not available!");
         }
-        getTrace().info("Clearing server component state ("+this+")");
+        getLogger().log(INFO,"Clearing server component state ("+this+")");
         this.message=null;
     }
 
Index: fractal-pool/src/java/org/objectweb/fractal/pool/lib/BasicPool.java
diff -u 
fractal-pool/src/java/org/objectweb/fractal/pool/lib/BasicPool.java:1.2 
fractal-pool/src/java/org/objectweb/fractal/pool/lib/BasicPool.java:1.3
--- fractal-pool/src/java/org/objectweb/fractal/pool/lib/BasicPool.java:1.2   
  Mon Mar 14 13:42:22 2005
+++ fractal-pool/src/java/org/objectweb/fractal/pool/lib/BasicPool.java Mon 
May 23 13:20:57 2005
@@ -23,7 +23,7 @@
 Contributor(s): .
 
 ---------------------------------------------------------------------
-$Id: BasicPool.java,v 1.2 2005/03/14 12:42:22 rouvoy Exp $
+$Id: BasicPool.java,v 1.3 2005/05/23 11:20:57 rouvoy Exp $
 ====================================================================*/
 package org.objectweb.fractal.pool.lib;
 
@@ -44,8 +44,8 @@
 /**
  * Basic Implementation of a component pool.
  * @author <a href="mailto:Romain.Rouvoy@xxxxxxx";>Romain Rouvoy</a>
- * @version $Revision: 1.2 $
- * @modified $Date: 2005/03/14 12:42:22 $
+ * @version $Revision: 1.3 $
+ * @modified $Date: 2005/05/23 11:20:57 $
  * @fractal.itf
  */
 public abstract class BasicPool
@@ -100,7 +100,7 @@
      * @see org.objectweb.fractal.api.control.LifeCycleController#startFc()
      */
     public void startFc() throws IllegalLifeCycleException {
-        getTrace().debug("Starting the pool component...");
+        getLogger().log(DEBUG,"Starting the pool component...");
         if (getMax() == 0)
             throw new IllegalLifeCycleException("Maximal pool size can't be 
equals to 0");
         if (getMin() > getMax()) 
@@ -113,7 +113,7 @@
      * @see org.objectweb.fractal.api.control.LifeCycleController#stopFc()
      */
     public void stopFc() {
-        getTrace().debug("Stopping the pool component...");
+        getLogger().log(DEBUG,"Stopping the pool component...");
         this.inactive = null ;
         this.active = null ;
     }
@@ -122,7 +122,7 @@
      * @see org.objectweb.fractal.api.control.CacheController#loadFc()
      */
     public void initFc() {
-        getTrace().debug("Loading the pool with "+getMin()+" components...");
+        getLogger().log(DEBUG,"Loading the pool with "+getMin()+" 
components...");
         for (int i=0 ; i< getMin() ; i++) {
             try {
                 this.inactive.push(create());
@@ -136,7 +136,7 @@
      * @see org.objectweb.fractal.api.control.CacheController#unloadFc()
      */
     public void clearFc() {
-        getTrace().debug("Clearing the pool...");
+        getLogger().log(DEBUG,"Clearing the pool...");
 //        while(!this.active.isEmpty()) {
 //            synchronized(this.active) {
 //                try {
@@ -163,14 +163,14 @@
      */
     protected Component retrieveFcInstance() throws InstantiationException {
         if (!this.inactive.isEmpty()) {
-            getTrace().debug("Using existing instance.");
+            getLogger().log(DEBUG,"Using existing instance.");
             return (Component) this.inactive.pop();
         }
         if (this.active.size() < getMax()) {
-            getTrace().debug("Creating new instance.");
+            getLogger().log(DEBUG,"Creating new instance.");
             return create();
         }
-        getTrace().debug("Waiting for existing instance.");
+        getLogger().log(DEBUG,"Waiting for existing instance.");
         synchronized(this.inactive) {
             while(this.inactive.isEmpty()) {
                 try {
@@ -190,7 +190,7 @@
             c = retrieveFcInstance();
             Fractal.getLifeCycleController(c).startFc();
         } catch (Exception e) {
-            getTrace().error(e.getMessage());
+            getLogger().log(ERROR,e.getMessage());
             return null;
         }
         this.active.add(c);
@@ -207,7 +207,7 @@
         try {
             Fractal.getLifeCycleController(c).stopFc();
         } catch (Exception e) {
-            getTrace().error(e.getMessage());
+            getLogger().log(ERROR,e.getMessage());
         }
         synchronized (this.active) {
             this.active.notifyAll();
Index: 
fractal-pool/src/java/org/objectweb/fractal/pool/lib/PoolWithTemplate.java
diff -u 
fractal-pool/src/java/org/objectweb/fractal/pool/lib/PoolWithTemplate.java:1.2
 
fractal-pool/src/java/org/objectweb/fractal/pool/lib/PoolWithTemplate.java:1.3
--- 
fractal-pool/src/java/org/objectweb/fractal/pool/lib/PoolWithTemplate.java:1.2
      Mon Mar 14 13:42:22 2005
+++ 
fractal-pool/src/java/org/objectweb/fractal/pool/lib/PoolWithTemplate.java  
Mon May 23 13:20:57 2005
@@ -23,7 +23,7 @@
  Contributor(s): .
 
  ---------------------------------------------------------------------
- $Id: PoolWithTemplate.java,v 1.2 2005/03/14 12:42:22 rouvoy Exp $
+ $Id: PoolWithTemplate.java,v 1.3 2005/05/23 11:20:57 rouvoy Exp $
  ====================================================================*/
 package org.objectweb.fractal.pool.lib;
 
@@ -36,8 +36,8 @@
 /**
  * @author <a href="mailto:Romain.Rouvoy@xxxxxxx";>Romain Rouvoy</a>
  * @created 25 janv. 2005
- * @modified $Date: 2005/03/14 12:42:22 $
- * @version $Revision: 1.2 $
+ * @modified $Date: 2005/05/23 11:20:57 $
+ * @version $Revision: 1.3 $
  * @fractal.itf name="factory" 
signature="org.objectweb.fractal.api.factory.Factory"
  * @fractal.itf name="fc-template" role="client" 
signature="org.objectweb.fractal.api.Component"
  */
@@ -63,7 +63,6 @@
             Component cpt = (Component) lookupFc(FC_TEMPLATE);
             return (Factory) cpt.getFcInterface("factory");
         } catch (NoSuchInterfaceException e) {
-            getTrace().error(e.getMessage());
             return null;
         }
     }



<--  Date Index  --> <--  Thread Index  -->

Reply via email to:

Powered by MHonArc.

Copyright © 2006-2007, OW2 Consortium | contact | webmaster.