Mail Archive Home | gotm-commits List | March 2005 Index
| <-- Date Index --> | <-- Thread Index --> |
Date: Monday, March 14, 2005 @ 13:42:23
Author: rouvoy
Path: /cvsroot/gotm/fractal-pool
Added: .settings/org.eclipse.core.resources.prefs
examples/pool/src/fractal/org/objectweb/fractal/example/TpServer.fractal
src/java/org/objectweb/fractal/julia/control/lifecycle/ClearCacheLifeCycleMixin.java
src/java/org/objectweb/fractal/julia/control/lifecycle/InitCacheLifeCycleMixin.java
Modified: examples/helloworld/build.xml
examples/helloworld/src/java/org/objectweb/fractal/example/HelloWorld.java
examples/pool/build.xml
examples/pool/src/fractal/org/objectweb/fractal/example/FcPoolExample.fractal
examples/pool/src/java/org/objectweb/fractal/example/Client.java
examples/pool/src/java/org/objectweb/fractal/example/ServerImpl.java
src/cfg/cache.cfg
src/java/org/objectweb/fractal/pool/lib/BasicPool.java
src/java/org/objectweb/fractal/pool/lib/PoolWithTemplate.java
Removed:
src/java/org/objectweb/fractal/julia/control/lifecycle/CacheLifeCycleMixin.java
* Integrating JacORB with Fractal to provide CORBA-based support for Fractal
components.
* Adding new Xdoclet tag @julia.controller desc="" to specify a particular
controller descriptor to use.
* Updating the cache-controller to be supported correctly by composite
components.
* Adding fractal-corba module helloworld example.
* Fractal-explorer library moved from gotm-explorer to fractal-import module.
--------------------------------------------------------------------------------------+
.settings/org.eclipse.core.resources.prefs
| 4
examples/helloworld/build.xml
| 4
examples/helloworld/src/java/org/objectweb/fractal/example/HelloWorld.java
| 25 --
examples/pool/build.xml
| 4
examples/pool/src/fractal/org/objectweb/fractal/example/FcPoolExample.fractal
| 10
examples/pool/src/fractal/org/objectweb/fractal/example/TpServer.fractal
| 13 +
examples/pool/src/java/org/objectweb/fractal/example/Client.java
| 32 --
examples/pool/src/java/org/objectweb/fractal/example/ServerImpl.java
| 52 +++-
src/cfg/cache.cfg
| 107 ++++++++-
src/java/org/objectweb/fractal/julia/control/lifecycle/CacheLifeCycleMixin.java
| 113 ----------
src/java/org/objectweb/fractal/julia/control/lifecycle/ClearCacheLifeCycleMixin.java
| 112 +++++++++
src/java/org/objectweb/fractal/julia/control/lifecycle/InitCacheLifeCycleMixin.java
| 112 +++++++++
src/java/org/objectweb/fractal/pool/lib/BasicPool.java
| 79 ++----
src/java/org/objectweb/fractal/pool/lib/PoolWithTemplate.java
| 15 -
14 files changed, 441 insertions(+), 241 deletions(-)
Index: fractal-pool/.settings/org.eclipse.core.resources.prefs
diff -u /dev/null fractal-pool/.settings/org.eclipse.core.resources.prefs:1.1
--- /dev/null Mon Mar 14 13:42:23 2005
+++ fractal-pool/.settings/org.eclipse.core.resources.prefs Mon Mar 14
13:42:22 2005
@@ -0,0 +1,4 @@
+#Wed Mar 09 14:32:49 CET 2005
+encoding//examples/pool/src/fractal/org/objectweb/fractal/example/TpServer.fractal=ISO-8859-1
+eclipse.preferences.version=1
+encoding//examples/pool/src/fractal/org/objectweb/fractal/example/FcPoolExample.fractal=ISO-8859-1
Index: fractal-pool/examples/helloworld/build.xml
diff -u fractal-pool/examples/helloworld/build.xml:1.3
fractal-pool/examples/helloworld/build.xml:1.4
--- fractal-pool/examples/helloworld/build.xml:1.3 Wed Mar 2 16:25:15
2005
+++ fractal-pool/examples/helloworld/build.xml Mon Mar 14 13:42:23 2005
@@ -21,7 +21,7 @@
<!-- Initial developer(s): Romain Rouvoy. -->
<!-- Contributor(s): ______________________________________. -->
-<!-- $Id: build.xml,v 1.3 2005/03/02 15:25:15 rouvoy Exp $ -->
+<!-- $Id: build.xml,v 1.4 2005/03/14 12:42:23 rouvoy Exp $ -->
<!-- ==================================================================== -->
<project name="Hello World" default="all">
@@ -59,6 +59,8 @@
<target name="example-build" depends="example-compile,fractal-adl"
description="Builds Fractal framework.">
+ <copy todir="${build.dir}/${class.dir}"
+ file="${build.dir}/${cfg.dir}/monolog.properties"/>
<jar destfile="${build.dir}/${lib.dir}/${helloworld.jar}">
<fileset dir="${build.dir}/${class.dir}"
includes="**/*"/>
</jar>
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.2
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.2
Fri Feb 4 17:13:09 2005
+++
fractal-pool/examples/helloworld/src/java/org/objectweb/fractal/example/HelloWorld.java
Mon Mar 14 13:42:22 2005
@@ -23,22 +23,21 @@
Contributor(s): .
---------------------------------------------------------------------
-$Id: HelloWorld.java,v 1.2 2005/02/04 16:13:09 rouvoy Exp $
+$Id: HelloWorld.java,v 1.3 2005/03/14 12:42:22 rouvoy Exp $
====================================================================*/
package org.objectweb.fractal.example;
import org.objectweb.fractal.api.Component;
import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.fractal.api.control.CacheController;
-import org.objectweb.fractal.api.control.IllegalCacheException;
import org.objectweb.fractal.lib.BindablePrimitive;
/**
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 20 janv. 2005
- * @modified $Date: 2005/02/04 16:13:09 $
- * @version $Revision: 1.2 $
+ * @modified $Date: 2005/03/14 12:42:22 $
+ * @version $Revision: 1.3 $
* @fractal.itf name="r" signature="java.lang.Runnable"
*/
public class HelloWorld
@@ -56,7 +55,7 @@
* @see org.objectweb.fractal.api.control.CacheController#loadFc()
*/
public void initFc() {
- System.out.println("Loading component state");
+ getTrace().info("Loading component state");
this.message="Hello World !";
}
@@ -64,7 +63,7 @@
* @see org.objectweb.fractal.api.control.CacheController#unloadFc()
*/
public void clearFc() {
- System.out.println("Clearing component state");
+ getTrace().info("Clearing component state");
this.message= null;
}
@@ -72,20 +71,6 @@
* @see java.lang.Runnable#run()
*/
public void run() {
- System.out.println(">>"+this.message);
- try {
- getLoadingController().initFc();
- } catch (IllegalCacheException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- System.out.println(">>"+this.message);
- try {
- getLoadingController().clearFc();
- } catch (IllegalCacheException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
System.out.println(">>"+this.message);
}
Index: fractal-pool/examples/pool/build.xml
diff -u fractal-pool/examples/pool/build.xml:1.2
fractal-pool/examples/pool/build.xml:1.3
--- fractal-pool/examples/pool/build.xml:1.2 Wed Mar 2 16:25:15 2005
+++ fractal-pool/examples/pool/build.xml Mon Mar 14 13:42:22 2005
@@ -21,7 +21,7 @@
<!-- Initial developer(s): Romain Rouvoy. -->
<!-- Contributor(s): ______________________________________. -->
-<!-- $Id: build.xml,v 1.2 2005/03/02 15:25:15 rouvoy Exp $ -->
+<!-- $Id: build.xml,v 1.3 2005/03/14 12:42:22 rouvoy Exp $ -->
<!-- ==================================================================== -->
<project name="Fractal Pool example" default="all">
@@ -57,6 +57,8 @@
<target name="example-build" depends="example-compile,fractal-adl"
description="Builds Fractal framework.">
+ <copy todir="${build.dir}/${class.dir}"
+ file="${build.dir}/${cfg.dir}/monolog.properties"/>
<jar destfile="${build.dir}/${lib.dir}/${project.jar}">
<fileset dir="${build.dir}/${class.dir}"
includes="**/*"/>
</jar>
Index:
fractal-pool/examples/pool/src/fractal/org/objectweb/fractal/example/FcPoolExample.fractal
diff -u
fractal-pool/examples/pool/src/fractal/org/objectweb/fractal/example/FcPoolExample.fractal:1.1
fractal-pool/examples/pool/src/fractal/org/objectweb/fractal/example/FcPoolExample.fractal:1.2
---
fractal-pool/examples/pool/src/fractal/org/objectweb/fractal/example/FcPoolExample.fractal:1.1
Fri Feb 4 17:13:10 2005
+++
fractal-pool/examples/pool/src/fractal/org/objectweb/fractal/example/FcPoolExample.fractal
Mon Mar 14 13:42:22 2005
@@ -5,17 +5,17 @@
<interface name="r" role="server"
signature="java.lang.Runnable" />
- <component name="FcServer"
- definition="org.objectweb.fractal.example.TpServerImpl"/>
- <component name="FcPool"
- definition="org.objectweb.fractal.pool.lib.FcPoolWithTemplate"/>
<component name="FcClient"
definition="org.objectweb.fractal.example.FcClient"/>
+ <component name="FcPool"
+ definition="org.objectweb.fractal.pool.lib.FcPoolWithTemplate"/>
+ <component name="FcServer"
+ definition="org.objectweb.fractal.example.TpServerImpl"/>
<binding client="this.r"
server="FcClient.r"/>
<binding client="FcClient.fc-pool"
server="FcPool.fc-pool"/>
<binding client="FcPool.fc-template"
- server="FcServer.component"/>
+ server="FcServer.component"/>
</definition>
Index:
fractal-pool/examples/pool/src/fractal/org/objectweb/fractal/example/TpServer.fractal
diff -u /dev/null
fractal-pool/examples/pool/src/fractal/org/objectweb/fractal/example/TpServer.fractal:1.1
--- /dev/null Mon Mar 14 13:42:23 2005
+++
fractal-pool/examples/pool/src/fractal/org/objectweb/fractal/example/TpServer.fractal
Mon Mar 14 13:42:22 2005
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE definition PUBLIC "-//objectweb.org//DTD Fractal ADL 2.0//EN"
"classpath://org/objectweb/fractal/adl/xml/standard.dtd">
+
+<definition name="org.objectweb.fractal.example.TpServer"
+ extends="org.objectweb.fractal.example.FcServer">
+
+ <component name="server"
+ definition="org.objectweb.fractal.example.TpServerImpl"/>
+
+ <binding client="this.s" server="server.s"/>
+
+ <template-controller desc="compositeTemplate" />
+</definition>
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.2
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.2
Fri Feb 4 17:27:32 2005
+++
fractal-pool/examples/pool/src/java/org/objectweb/fractal/example/Client.java
Mon Mar 14 13:42:22 2005
@@ -23,23 +23,20 @@
Contributor(s): .
---------------------------------------------------------------------
-$Id: Client.java,v 1.2 2005/02/04 16:27:32 rouvoy Exp $
+$Id: Client.java,v 1.3 2005/03/14 12:42:22 rouvoy Exp $
====================================================================*/
package org.objectweb.fractal.example;
import org.objectweb.fractal.api.Component;
-import org.objectweb.fractal.api.Interface;
import org.objectweb.fractal.api.NoSuchInterfaceException;
-import org.objectweb.fractal.api.control.IllegalCacheException;
import org.objectweb.fractal.lib.BindablePrimitive;
import org.objectweb.fractal.pool.api.Pool;
-import org.objectweb.fractal.pool.util.FcCache;
/**
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 20 janv. 2005
- * @modified $Date: 2005/02/04 16:27:32 $
- * @version $Revision: 1.2 $
+ * @modified $Date: 2005/03/14 12:42:22 $
+ * @version $Revision: 1.3 $
* @fractal.itf name="r" signature="java.lang.Runnable"
* @fractal.itf name="fc-pool" role="client"
signature="org.objectweb.fractal.pool.api.Pool"
*/
@@ -70,29 +67,20 @@
* @see java.lang.Runnable#run()
*/
public void run() {
- try {
-
FcCache.getCacheController(((Interface)getFcPool()).getFcItfOwner()).initFc();
- } catch (IllegalCacheException e1) {
- getTrace().error(e1.getMessage());
- } catch (NoSuchInterfaceException e1) {
- getTrace().error(e1.getMessage());
- }
+ getTrace().info("Running the pool example");
+ getTrace().info("Retrieving Server instance");
Component c = getFcPool().getFcInstance();
try {
+ getTrace().info("Looking for the s interface");
Server s = (Server) c.getFcInterface("s");
- System.out.println("Calling method print()");
+ getTrace().info("Calling method print()");
s.print();
} catch (NoSuchInterfaceException e) {
getTrace().error(e.getMessage());
}
+ getTrace().info("Putting Server intance back to the pool");
getFcPool().putFcInstance(c);
-
- try {
-
FcCache.getCacheController(((Interface)getFcPool()).getFcItfOwner()).clearFc();
- } catch (IllegalCacheException e1) {
- getTrace().error(e1.getMessage());
- } catch (NoSuchInterfaceException e1) {
- getTrace().error(e1.getMessage());
- }
+ getTrace().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.1
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.1
Fri Feb 4 17:13:09 2005
+++
fractal-pool/examples/pool/src/java/org/objectweb/fractal/example/ServerImpl.java
Mon Mar 14 13:42:22 2005
@@ -23,23 +23,26 @@
Contributor(s): .
---------------------------------------------------------------------
-$Id: ServerImpl.java,v 1.1 2005/02/04 16:13:09 rouvoy Exp $
+$Id: ServerImpl.java,v 1.2 2005/03/14 12:42:22 rouvoy Exp $
====================================================================*/
package org.objectweb.fractal.example;
+import org.objectweb.fractal.api.Component;
+import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.fractal.api.control.CacheController;
import org.objectweb.fractal.api.control.LifeCycleController;
-import org.objectweb.fractal.lib.LoggablePrimitive;
+import org.objectweb.fractal.lib.BindablePrimitive;
+import org.objectweb.fractal.util.Fractal;
/**
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 20 janv. 2005
- * @modified $Date: 2005/02/04 16:13:09 $
- * @version $Revision: 1.1 $
+ * @modified $Date: 2005/03/14 12:42:22 $
+ * @version $Revision: 1.2 $
* @fractal.itf
*/
public class ServerImpl
-extends LoggablePrimitive
+extends BindablePrimitive
implements LifeCycleController, CacheController, Server
{
private String message ;
@@ -58,20 +61,38 @@
* @see org.objectweb.fractal.api.control.LifeCycleController#startFc()
*/
public void startFc() {
- System.out.println("Starting the server component ("+this+")");
+ try {
+ LifeCycleController lcc =
Fractal.getLifeCycleController((Component)lookupFc("component"));
+ getTrace().debug("Server is "+lcc.getFcState());
+ } catch (NoSuchInterfaceException e) {
+ getTrace().error("LifeCycle controller not available!");
+ }
+ getTrace().info("Starting the server component ("+this+")");
}
/* (non-Javadoc)
* @see org.objectweb.fractal.api.control.LifeCycleController#stopFc()
*/
public void stopFc() {
- System.out.println("Stopping the server component ("+this+")");
+ try {
+ LifeCycleController lcc =
Fractal.getLifeCycleController((Component)lookupFc("component"));
+ getTrace().debug("Server is "+lcc.getFcState());
+ } catch (NoSuchInterfaceException e) {
+ getTrace().error("LifeCycle controller not available!");
+ }
+ getTrace().info("Stopping the server component ("+this+")");
}
/* (non-Javadoc)
* @see org.objectweb.fractal.api.control.CacheController#loadFc()
*/
public void initFc() {
- System.out.println("Loading server component state ("+this+")");
+ try {
+ LifeCycleController lcc =
Fractal.getLifeCycleController((Component)lookupFc("component"));
+ getTrace().debug("Server is "+lcc.getFcState());
+ } catch (NoSuchInterfaceException e) {
+ getTrace().error("LifeCycle controller not available!");
+ }
+ getTrace().info("Loading server component state ("+this+")");
this.message="Hello World !";
}
@@ -79,7 +100,13 @@
* @see org.objectweb.fractal.api.control.CacheController#unloadFc()
*/
public void clearFc() {
- System.out.println("Clearing server component state ("+this+")");
+ try {
+ LifeCycleController lcc =
Fractal.getLifeCycleController((Component)lookupFc("component"));
+ getTrace().debug("Server is "+lcc.getFcState());
+ } catch (NoSuchInterfaceException e) {
+ getTrace().error("LifeCycle controller not available!");
+ }
+ getTrace().info("Clearing server component state ("+this+")");
this.message=null;
}
@@ -88,5 +115,12 @@
*/
public void print() {
System.out.println(">> "+this.message);
+ }
+
+ /* (non-Javadoc)
+ * @see org.objectweb.fractal.lib.BindablePrimitive#clientFc()
+ */
+ protected String[] clientFc() {
+ return new String[] {"component"};
}
}
Index: fractal-pool/src/cfg/cache.cfg
diff -u fractal-pool/src/cfg/cache.cfg:1.1 fractal-pool/src/cfg/cache.cfg:1.2
--- fractal-pool/src/cfg/cache.cfg:1.1 Wed Mar 2 16:25:16 2005
+++ fractal-pool/src/cfg/cache.cfg Mon Mar 14 13:42:22 2005
@@ -23,7 +23,7 @@
# Contributor(s): .
#
-----------------------------------------------------------------------------
-# $Id: cache.cfg,v 1.1 2005/03/02 15:25:16 rouvoy Exp $
+# $Id: cache.cfg,v 1.2 2005/03/14 12:42:22 rouvoy Exp $
#
=============================================================================
@@ -33,8 +33,8 @@
(optimizationLevel
# choose one of the following optimization options:
- # none
- mergeControllers
+ none
+ # mergeControllers
# mergeControllersAndInterceptors
# mergeControllersAndContent
# mergeControllersInterceptorsAndContent
@@ -76,20 +76,41 @@
org.objectweb.fractal.julia.control.lifecycle.BasicLifeCycleControllerMixin
# to check that mandatory client interfaces are bound in startFc:
org.objectweb.fractal.julia.control.lifecycle.TypeLifeCycleMixin
- # to automatically clear the component before stopping:
- org.objectweb.fractal.julia.control.cache.UseCacheControllerMixin
- org.objectweb.fractal.julia.control.lifecycle.CacheLifeCycleMixin
# to automatically assign the logger and logger factory:
org.objectweb.fractal.julia.BasicInitializableMixin
org.objectweb.fractal.julia.logger.LoggerLifeCycleMixin
+ # to automatically clear the component before stopping:
+ org.objectweb.fractal.julia.control.cache.UseCacheControllerMixin
+ org.objectweb.fractal.julia.control.lifecycle.ClearCacheLifeCycleMixin
+ # to automatically init the component after starting:
+ org.objectweb.fractal.julia.control.lifecycle.InitCacheLifeCycleMixin
# to notify the encapsulated component (if present) when its state
changes:
org.objectweb.fractal.julia.control.lifecycle.ContainerLifeCycleMixin
)
# optional initialization parameter (monolog configuration file name):
- (monolog-conf-file fractal.properties)
+ (monolog-conf-file monolog.properties)
)
)
+# LifeCycleController implementation (for composite components only)
+
+(composite-lifecycle-controller-impl
+ ((org.objectweb.fractal.julia.asm.MixinClassGenerator
+ CompositeLifeCycleControllerImpl
+ org.objectweb.fractal.julia.BasicControllerMixin
+ org.objectweb.fractal.julia.UseComponentMixin
+
org.objectweb.fractal.julia.control.lifecycle.BasicLifeCycleCoordinatorMixin
+
org.objectweb.fractal.julia.control.lifecycle.OptimizedLifeCycleControllerMixin
+ # to check that mandatory client interfaces are bound in startFc:
+ org.objectweb.fractal.julia.control.lifecycle.TypeLifeCycleMixin
+ # to automatically clear the component before stopping:
+ org.objectweb.fractal.julia.control.cache.UseCacheControllerMixin
+ org.objectweb.fractal.julia.control.lifecycle.ClearCacheLifeCycleMixin
+ # to automatically init the component after starting:
+ org.objectweb.fractal.julia.control.lifecycle.InitCacheLifeCycleMixin
+ ))
+)
+
# CacheController implementation (for primitive or composite components)
(cache-controller-impl
((org.objectweb.fractal.julia.asm.MixinClassGenerator
@@ -222,3 +243,75 @@
)
)
+
+
+
+################################################################################
+#
#
+# Lazy Cache Controller implementation
#
+#
#
+################################################################################
+#
-----------------------------------------------------------------------------
+# CONTROLLER OBJECTS
+#
-----------------------------------------------------------------------------
+# LifeCycleController implementation (for primitive or composite components)
with implicit logger
+(lifecycle-lazy-controller-impl
+ ((org.objectweb.fractal.julia.asm.MixinClassGenerator
+ LifeCycleControllerImpl
+ org.objectweb.fractal.julia.BasicControllerMixin
+ org.objectweb.fractal.julia.UseComponentMixin
+
org.objectweb.fractal.julia.control.lifecycle.BasicLifeCycleCoordinatorMixin
+
org.objectweb.fractal.julia.control.lifecycle.BasicLifeCycleControllerMixin
+ # to check that mandatory client interfaces are bound in startFc:
+ org.objectweb.fractal.julia.control.lifecycle.TypeLifeCycleMixin
+ # to automatically clear the component before stopping:
+ org.objectweb.fractal.julia.control.cache.UseCacheControllerMixin
+ org.objectweb.fractal.julia.control.lifecycle.ClearCacheLifeCycleMixin
+ # to automatically assign the logger and logger factory:
+ org.objectweb.fractal.julia.BasicInitializableMixin
+ org.objectweb.fractal.julia.logger.LoggerLifeCycleMixin
+ # to notify the encapsulated component (if present) when its state
changes:
+ org.objectweb.fractal.julia.control.lifecycle.ContainerLifeCycleMixin
+ )
+ # optional initialization parameter (monolog configuration file name):
+ (monolog-conf-file monolog.properties)
+ )
+)
+
+#
-----------------------------------------------------------------------------
+# Component implementation
+#
-----------------------------------------------------------------------------
+(primitiveLazyCache
+ (
+ 'interface-class-generator
+ (
+ 'component-itf
+ 'binding-controller-itf
+ 'super-controller-itf
+ # only if super-controller-itf does not designate the Julia interface:
+ # 'julia-super-controller-itf
+ 'lifecycle-controller-itf
+ # only if lifecycle-controller-itf does not designate the Julia
interface:
+ # 'julia-lifecycle-controller-itf
+ 'name-controller-itf
+ 'cache-controller-itf
+ # only if cache-controller-itf does not designate the Julia interface:
+ # 'julia-cache-controller-itf
+ )
+ (
+ 'component-impl
+ 'container-binding-controller-impl
+ 'super-controller-impl
+ 'lifecycle-lazy-controller-impl
+ 'name-controller-impl
+ 'cache-controller-impl
+ )
+ (
+ (org.objectweb.fractal.julia.asm.InterceptorClassGenerator
+ org.objectweb.fractal.julia.asm.LifeCycleCodeGenerator
+ )
+ )
+ org.objectweb.fractal.julia.asm.MergeClassGenerator
+ 'optimizationLevel
+ )
+)
\ No newline at end of file
Index:
fractal-pool/src/java/org/objectweb/fractal/julia/control/lifecycle/CacheLifeCycleMixin.java
diff -u
fractal-pool/src/java/org/objectweb/fractal/julia/control/lifecycle/CacheLifeCycleMixin.java:1.1
fractal-pool/src/java/org/objectweb/fractal/julia/control/lifecycle/CacheLifeCycleMixin.java:removed
---
fractal-pool/src/java/org/objectweb/fractal/julia/control/lifecycle/CacheLifeCycleMixin.java:1.1
Fri Feb 4 17:13:10 2005
+++
fractal-pool/src/java/org/objectweb/fractal/julia/control/lifecycle/CacheLifeCycleMixin.java
Mon Mar 14 13:42:23 2005
@@ -1,113 +0,0 @@
-/*====================================================================
-
- GoTM: GoTM is an open Transaction Monitor
- Copyright (C) 2003-2005 INRIA - Jacquard & USTL - LIFL - GOAL
- Contact: gotm-team@xxxxxxxxxxxxx
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or any later version.
-
- This library 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA
-
- Initial developer(s): Romain Rouvoy.
- Contributor(s): .
-
- ---------------------------------------------------------------------
- $Id: CacheLifeCycleMixin.java,v 1.1 2005/02/04 16:13:10 rouvoy Exp $
- ====================================================================*/
-package org.objectweb.fractal.julia.control.lifecycle;
-
-import org.objectweb.fractal.api.Component;
-import org.objectweb.fractal.api.control.CacheController;
-import org.objectweb.fractal.api.control.IllegalCacheException;
-import org.objectweb.fractal.api.control.IllegalLifeCycleException;
-import org.objectweb.fractal.api.control.LifeCycleController;
-
-/**
- * Provides loading related checks to a {@link LifeCycleController}.<br>
- * <br>
- * <b>Requirements </b>
- * <ul>
- * <li>none (the component may provide a {@link CacheController}interface,
- * but this is not mandatory - in this case this mixin does nothing).</li>
- * </ul>
- *
- * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy </a>
- * @created 20 janv. 2005
- * @modified $Date: 2005/02/04 16:13:10 $
- * @version $Revision: 1.1 $
- */
-public abstract class CacheLifeCycleMixin
- implements LifeCycleController {
- //
-------------------------------------------------------------------------
- // Private constructor
- //
-------------------------------------------------------------------------
-
- /**
- *
- */
- private CacheLifeCycleMixin() {
- //Nothing to do
- }
-
- //
-------------------------------------------------------------------------
- // Fields and methods added and overriden by the mixin class
- //
-------------------------------------------------------------------------
- /*
- * (non-Javadoc)
- *
- * @see org.objectweb.fractal.api.control.LifeCycleController#stopFc()
- */
- public void stopFc() throws IllegalLifeCycleException {
- if (_this_weaveableOptPC != null) {
- String state = _this_weaveableOptPC.getCacheState();
- if (CacheController.INITIALIZED.equals(state)) {
- try {
- _this_weaveableOptPC.clearFc();
- } catch (IllegalCacheException e) {
- throw new ChainedIllegalLifeCycleException(e,
- _this_weaveableOptC,"The clear process has
failed");
- }
- }
- }
- _super_stopFc();
- }
-
- //
-------------------------------------------------------------------------
- // Fields and methods required by the mixin class in the base class
- //
-------------------------------------------------------------------------
- /**
- * The <tt>weaveableOptC</tt> field required by this mixin. This field is
- * supposed to reference the {@link Component}interface of the component
to
- * which this controller object belongs.
- */
- public Component _this_weaveableOptC;
-
- /**
- * The <tt>weaveableOptLC</tt> field required by this mixin. This field
is
- * supposed to reference the {@link LifeCycleController}interface of the
- * component to which this controller object belongs.
- */
- public CacheController _this_weaveableOptPC;
-
- /**
- * Stops the component to which this interface belongs.
- *
- * @throws IllegalLifeCycleException
- * if the transition from the current state to the
- * {@link #STOPPED STOPPED}state is not a valid transition of
- * the pooling automaton.
- */
- public abstract void _super_stopFc() throws IllegalLifeCycleException;
-
-}
\ No newline at end of file
Index:
fractal-pool/src/java/org/objectweb/fractal/julia/control/lifecycle/ClearCacheLifeCycleMixin.java
diff -u /dev/null
fractal-pool/src/java/org/objectweb/fractal/julia/control/lifecycle/ClearCacheLifeCycleMixin.java:1.1
--- /dev/null Mon Mar 14 13:42:23 2005
+++
fractal-pool/src/java/org/objectweb/fractal/julia/control/lifecycle/ClearCacheLifeCycleMixin.java
Mon Mar 14 13:42:22 2005
@@ -0,0 +1,112 @@
+/*====================================================================
+
+ GoTM: GoTM is an open Transaction Monitor
+ Copyright (C) 2003-2005 INRIA - Jacquard & USTL - LIFL - GOAL
+ Contact: gotm-team@xxxxxxxxxxxxx
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or any later version.
+
+ This library 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA
+
+ Initial developer(s): Romain Rouvoy.
+ Contributor(s): .
+
+ ---------------------------------------------------------------------
+ $Id: ClearCacheLifeCycleMixin.java,v 1.1 2005/03/14 12:42:22 rouvoy Exp $
+ ====================================================================*/
+package org.objectweb.fractal.julia.control.lifecycle;
+
+import org.objectweb.fractal.api.Component;
+import org.objectweb.fractal.api.control.CacheController;
+import org.objectweb.fractal.api.control.IllegalCacheException;
+import org.objectweb.fractal.api.control.IllegalLifeCycleException;
+import org.objectweb.fractal.api.control.LifeCycleController;
+
+/**
+ * Provides loading related checks to a {@link LifeCycleController}.<br>
+ * <br>
+ * <b>Requirements </b>
+ * <ul>
+ * <li>none (the component may provide a {@link CacheController}interface,
+ * but this is not mandatory - in this case this mixin does nothing).</li>
+ * </ul>
+ *
+ * @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.1 $
+ */
+public abstract class ClearCacheLifeCycleMixin
+ implements LifeCycleController {
+ //
-------------------------------------------------------------------------
+ // Private constructor
+ //
-------------------------------------------------------------------------
+
+ /**
+ *
+ */
+ private ClearCacheLifeCycleMixin() {
+ //Nothing to do
+ }
+
+ //
-------------------------------------------------------------------------
+ // Fields and methods added and overriden by the mixin class
+ //
-------------------------------------------------------------------------
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.objectweb.fractal.api.control.LifeCycleController#stopFc()
+ */
+ public void stopFc() throws IllegalLifeCycleException {
+ if (_this_weaveableOptPC != null) {
+ String state = _this_weaveableOptPC.getCacheState();
+ if (CacheController.INITIALIZED.equals(state)) {
+ try {
+ _this_weaveableOptPC.clearFc();
+ } catch (IllegalCacheException e) {
+ throw new ChainedIllegalLifeCycleException(e,
+ _this_weaveableOptC,"The clear process has
failed");
+ }
+ }
+ }
+ _super_stopFc();
+ }
+
+ //
-------------------------------------------------------------------------
+ // Fields and methods required by the mixin class in the base class
+ //
-------------------------------------------------------------------------
+ /**
+ * The <tt>weaveableOptC</tt> field required by this mixin. This field is
+ * supposed to reference the {@link Component}interface of the component
to
+ * which this controller object belongs.
+ */
+ public Component _this_weaveableOptC;
+
+ /**
+ * The <tt>weaveableOptLC</tt> field required by this mixin. This field
is
+ * supposed to reference the {@link LifeCycleController}interface of the
+ * component to which this controller object belongs.
+ */
+ public CacheController _this_weaveableOptPC;
+
+ /**
+ * Stops the component to which this interface belongs.
+ * @throws IllegalLifeCycleException
+ * if the transition from the current state to the
+ * {@link #STOPPED STOPPED}state is not a valid transition of
+ * the pooling automaton.
+ */
+ public abstract void _super_stopFc() throws IllegalLifeCycleException;
+
+}
\ No newline at end of file
Index:
fractal-pool/src/java/org/objectweb/fractal/julia/control/lifecycle/InitCacheLifeCycleMixin.java
diff -u /dev/null
fractal-pool/src/java/org/objectweb/fractal/julia/control/lifecycle/InitCacheLifeCycleMixin.java:1.1
--- /dev/null Mon Mar 14 13:42:23 2005
+++
fractal-pool/src/java/org/objectweb/fractal/julia/control/lifecycle/InitCacheLifeCycleMixin.java
Mon Mar 14 13:42:22 2005
@@ -0,0 +1,112 @@
+/*====================================================================
+
+ GoTM: GoTM is an open Transaction Monitor
+ Copyright (C) 2003-2005 INRIA - Jacquard & USTL - LIFL - GOAL
+ Contact: gotm-team@xxxxxxxxxxxxx
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or any later version.
+
+ This library 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA
+
+ Initial developer(s): Romain Rouvoy.
+ Contributor(s): .
+
+ ---------------------------------------------------------------------
+ $Id: InitCacheLifeCycleMixin.java,v 1.1 2005/03/14 12:42:22 rouvoy Exp $
+ ====================================================================*/
+package org.objectweb.fractal.julia.control.lifecycle;
+
+import org.objectweb.fractal.api.Component;
+import org.objectweb.fractal.api.control.CacheController;
+import org.objectweb.fractal.api.control.IllegalCacheException;
+import org.objectweb.fractal.api.control.IllegalLifeCycleException;
+import org.objectweb.fractal.api.control.LifeCycleController;
+
+/**
+ * Provides loading related checks to a {@link LifeCycleController}.<br>
+ * <br>
+ * <b>Requirements </b>
+ * <ul>
+ * <li>none (the component may provide a {@link CacheController}interface,
+ * but this is not mandatory - in this case this mixin does nothing).</li>
+ * </ul>
+ *
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy </a>
+ * @created 08 mar. 2005
+ * @modified $Date: 2005/03/14 12:42:22 $
+ * @version $Revision: 1.1 $
+ */
+public abstract class InitCacheLifeCycleMixin
+ implements LifeCycleController {
+ //
-------------------------------------------------------------------------
+ // Private constructor
+ //
-------------------------------------------------------------------------
+
+ /**
+ *
+ */
+ private InitCacheLifeCycleMixin() {
+ //Nothing to do
+ }
+
+ //
-------------------------------------------------------------------------
+ // Fields and methods added and overriden by the mixin class
+ //
-------------------------------------------------------------------------
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.objectweb.fractal.api.control.LifeCycleController#startFc()
+ */
+ public void startFc() throws IllegalLifeCycleException {
+ _super_startFc();
+ if (_this_weaveableOptPC != null) {
+ String state = _this_weaveableOptPC.getCacheState();
+ if (CacheController.CLEARED.equals(state)) {
+ try {
+ _this_weaveableOptPC.initFc();
+ } catch (IllegalCacheException e) {
+ throw new ChainedIllegalLifeCycleException(e,
+ _this_weaveableOptC,"The init process has
failed");
+ }
+ }
+ }
+ }
+
+ //
-------------------------------------------------------------------------
+ // Fields and methods required by the mixin class in the base class
+ //
-------------------------------------------------------------------------
+ /**
+ * The <tt>weaveableOptC</tt> field required by this mixin. This field is
+ * supposed to reference the {@link Component}interface of the component
to
+ * which this controller object belongs.
+ */
+ public Component _this_weaveableOptC;
+
+ /**
+ * The <tt>weaveableOptLC</tt> field required by this mixin. This field
is
+ * supposed to reference the {@link LifeCycleController}interface of the
+ * component to which this controller object belongs.
+ */
+ public CacheController _this_weaveableOptPC;
+
+ /**
+ * Starts the component to which this interface belongs.
+ * @throws IllegalLifeCycleException
+ * if the transition from the current state to the
+ * {@link #STARTED STARTED}state is not a valid transition of
+ * the pooling automaton.
+ */
+ public abstract void _super_startFc() throws IllegalLifeCycleException;
+
+}
\ No newline at end of file
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.1
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.1
Fri Feb 4 17:13:09 2005
+++ fractal-pool/src/java/org/objectweb/fractal/pool/lib/BasicPool.java Mon
Mar 14 13:42:22 2005
@@ -23,7 +23,7 @@
Contributor(s): .
---------------------------------------------------------------------
-$Id: BasicPool.java,v 1.1 2005/02/04 16:13:09 rouvoy Exp $
+$Id: BasicPool.java,v 1.2 2005/03/14 12:42:22 rouvoy Exp $
====================================================================*/
package org.objectweb.fractal.pool.lib;
@@ -32,23 +32,20 @@
import java.util.Stack;
import org.objectweb.fractal.api.Component;
-import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.fractal.api.control.CacheController;
-import org.objectweb.fractal.api.control.IllegalCacheException;
import org.objectweb.fractal.api.control.IllegalLifeCycleException;
import org.objectweb.fractal.api.control.LifeCycleController;
import org.objectweb.fractal.api.factory.InstantiationException;
import org.objectweb.fractal.lib.BindablePrimitive;
import org.objectweb.fractal.pool.api.Pool;
import org.objectweb.fractal.pool.api.PoolAttributeController;
-import org.objectweb.fractal.pool.util.FcCache;
import org.objectweb.fractal.util.Fractal;
/**
* Basic Implementation of a component pool.
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
- * @version $Revision: 1.1 $
- * @modified $Date: 2005/02/04 16:13:09 $
+ * @version $Revision: 1.2 $
+ * @modified $Date: 2005/03/14 12:42:22 $
* @fractal.itf
*/
public abstract class BasicPool
@@ -103,11 +100,11 @@
* @see org.objectweb.fractal.api.control.LifeCycleController#startFc()
*/
public void startFc() throws IllegalLifeCycleException {
- System.out.println("Starting the pool component ("+this+")");
+ getTrace().debug("Starting the pool component...");
if (getMax() == 0)
throw new IllegalLifeCycleException("Maximal pool size can't be
equals to 0");
if (getMin() > getMax())
- throw new IllegalLifeCycleException("Wrong configuration");
+ throw new IllegalLifeCycleException("Wrong configuration
(min>max)");
this.inactive = new Stack();
this.active = new HashSet();
}
@@ -116,31 +113,16 @@
* @see org.objectweb.fractal.api.control.LifeCycleController#stopFc()
*/
public void stopFc() {
- System.out.println("Stopping the pool component ("+this+")");
+ getTrace().debug("Stopping the pool component...");
this.inactive = null ;
this.active = null ;
}
- /**
- * @param list
- * @throws IllegalCacheException
- */
- protected void clearFcInstance(Stack list) throws IllegalCacheException {
- while (!list.isEmpty()) {
- Component c = (Component) list.pop() ;
- try {
- Fractal.getLifeCycleController(c).stopFc();
- } catch (Exception e) {
- throw new IllegalCacheException(e.getMessage());
- }
- }
- }
-
/* (non-Javadoc)
* @see org.objectweb.fractal.api.control.CacheController#loadFc()
*/
public void initFc() {
- System.out.println("Loading the pool component ("+this+") with
"+getMin()+" components");
+ getTrace().debug("Loading the pool with "+getMin()+" components...");
for (int i=0 ; i< getMin() ; i++) {
try {
this.inactive.push(create());
@@ -153,8 +135,8 @@
/* (non-Javadoc)
* @see org.objectweb.fractal.api.control.CacheController#unloadFc()
*/
- public void clearFc() throws IllegalCacheException {
- System.out.println("Clearing the pool component ("+this+")");
+ public void clearFc() {
+ getTrace().debug("Clearing the pool...");
// while(!this.active.isEmpty()) {
// synchronized(this.active) {
// try {
@@ -165,7 +147,7 @@
// }
// }
this.active.clear();
- clearFcInstance(this.inactive);
+ this.inactive.clear();
}
/**
@@ -180,17 +162,22 @@
* @throws InstantiationException
*/
protected Component retrieveFcInstance() throws InstantiationException {
- if (!this.inactive.isEmpty())
+ if (!this.inactive.isEmpty()) {
+ getTrace().debug("Using existing instance.");
return (Component) this.inactive.pop();
- if (this.active.size() < getMax())
+ }
+ if (this.active.size() < getMax()) {
+ getTrace().debug("Creating new instance.");
return create();
- synchronized(this.inactive) {
- while(this.inactive.isEmpty()) {
- try {
- this.inactive.wait();
- } catch (Exception e) {break;}
- }
+ }
+ getTrace().debug("Waiting for existing instance.");
+ synchronized(this.inactive) {
+ while(this.inactive.isEmpty()) {
+ try {
+ this.inactive.wait();
+ } catch (Exception e) {break;}
}
+ }
return (Component) this.inactive.pop();
}
@@ -201,17 +188,11 @@
Component c;
try {
c = retrieveFcInstance();
- } catch (InstantiationException e) {
+ Fractal.getLifeCycleController(c).startFc();
+ } catch (Exception e) {
getTrace().error(e.getMessage());
return null;
}
- try {
- FcCache.getCacheController(c).initFc();
- } catch (IllegalCacheException e) {
- getTrace().error(e.getMessage());
- } catch (NoSuchInterfaceException e) {
- getTrace().error(e.getMessage());
- }
this.active.add(c);
return c;
}
@@ -224,9 +205,9 @@
return;
this.active.remove(c);
try {
- FcCache.getCacheController(c).clearFc();
+ Fractal.getLifeCycleController(c).stopFc();
} catch (Exception e) {
- e.printStackTrace();
+ getTrace().error(e.getMessage());
}
synchronized (this.active) {
this.active.notifyAll();
@@ -241,11 +222,7 @@
* @see org.objectweb.fractal.pool.api.Pool#flushFcInstance()
*/
public void flushFcInstance() {
- try {
- clearFcInstance(this.inactive);
- } catch (IllegalCacheException e) {
- getTrace().error(e.getMessage());
- }
+ this.inactive.clear();
}
/* (non-Javadoc)
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.1
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.1
Fri Feb 4 17:13:09 2005
+++
fractal-pool/src/java/org/objectweb/fractal/pool/lib/PoolWithTemplate.java
Mon Mar 14 13:42:22 2005
@@ -23,23 +23,21 @@
Contributor(s): .
---------------------------------------------------------------------
- $Id: PoolWithTemplate.java,v 1.1 2005/02/04 16:13:09 rouvoy Exp $
+ $Id: PoolWithTemplate.java,v 1.2 2005/03/14 12:42:22 rouvoy Exp $
====================================================================*/
package org.objectweb.fractal.pool.lib;
import org.objectweb.fractal.api.Component;
import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.fractal.api.Type;
-import org.objectweb.fractal.api.control.IllegalLifeCycleException;
import org.objectweb.fractal.api.factory.Factory;
import org.objectweb.fractal.api.factory.InstantiationException;
-import org.objectweb.fractal.util.Fractal;
/**
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 25 janv. 2005
- * @modified $Date: 2005/02/04 16:13:09 $
- * @version $Revision: 1.1 $
+ * @modified $Date: 2005/03/14 12:42:22 $
+ * @version $Revision: 1.2 $
* @fractal.itf name="factory"
signature="org.objectweb.fractal.api.factory.Factory"
* @fractal.itf name="fc-template" role="client"
signature="org.objectweb.fractal.api.Component"
*/
@@ -75,13 +73,6 @@
*/
protected Component create() throws InstantiationException {
Component c = getTemplate().newFcInstance();
- try {
- Fractal.getLifeCycleController(c).startFc();
- } catch (IllegalLifeCycleException e) {
- throw new InstantiationException(e.getMessage());
- } catch (NoSuchInterfaceException e) {
- throw new InstantiationException(e.getMessage());
- }
return c;
}
| <-- Date Index --> | <-- Thread Index --> |
Powered by MHonArc.
Copyright © 2006-2007, OW2 Consortium | contact | webmaster.