OW2 Consortium
Search OW2 Mail Archive: 

Advanced Search - Powered by Google


Mail Archive Home | fractal-commits List | December 2006 Index

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

CVS update of julia/src/org/objectweb/fractal/juliak (Juliak.java)


    Date: Thursday, December 21, 2006 @ 17:25:07
  Author: seintur
    Path: /cvsroot/fractal/julia/src/org/objectweb/fractal/juliak

Modified: Juliak.java

Singleton pattern for the Fractal provider class Juliak.


-------------+
 Juliak.java |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)


Index: julia/src/org/objectweb/fractal/juliak/Juliak.java
diff -u julia/src/org/objectweb/fractal/juliak/Juliak.java:1.7 
julia/src/org/objectweb/fractal/juliak/Juliak.java:1.8
--- julia/src/org/objectweb/fractal/juliak/Juliak.java:1.7      Thu Dec 21 
11:46:57 2006
+++ julia/src/org/objectweb/fractal/juliak/Juliak.java  Thu Dec 21 17:25:07 
2006
@@ -50,9 +50,15 @@
     /**
      * Return an instance of the Fractal provider class.
      * This method is meant to allow subclassing Juliak.
-     * This method is thus more general than the default public constructor.
+     * This method is thus more general than the default public constructor 
for
+     * obtaining an instance of the provider class.
+     * This method returns a singleton instance.
      */
     public static Juliak get() {
+        
+        if( juliak != null ) {
+            return juliak;
+        }
 
         String bootTmplClassName = System.getProperty("fractal.provider");
         if (bootTmplClassName == null) {
@@ -63,7 +69,8 @@
         try {
             Class bootTmplClass = Class.forName(bootTmplClassName);
             Object o = bootTmplClass.newInstance();
-            return (Juliak) o;
+            juliak = (Juliak) o;
+            return juliak;
         }
         catch (Exception e) {
             throw new RuntimeException(
@@ -72,6 +79,9 @@
         }
     }
     
+    /** The singleton instance of the provider class. */
+    private static Juliak juliak = null;
+    
     /**
      * Property name for dumping run-time generated code.
      * 



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

Reply via email to:

Powered by MHonArc.

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