db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1390342 - in /db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect: DatabaseClasses.java GCInstanceFactory.java ReflectClassesJava2.java ReflectGeneratedClass.java ReflectLoaderJava2.java
Date Wed, 26 Sep 2012 09:18:13 GMT
Author: kahatlen
Date: Wed Sep 26 09:18:13 2012
New Revision: 1390342

URL: http://svn.apache.org/viewvc?rev=1390342&view=rev
Log:
DERBY-5935: Remove unused code for factory classes in the reflection service

Removed:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/GCInstanceFactory.java
Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/DatabaseClasses.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/ReflectClassesJava2.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/ReflectGeneratedClass.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/ReflectLoaderJava2.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/DatabaseClasses.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/DatabaseClasses.java?rev=1390342&r1=1390341&r2=1390342&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/DatabaseClasses.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/DatabaseClasses.java
Wed Sep 26 09:18:13 2012
@@ -21,45 +21,28 @@
 
 package org.apache.derby.impl.services.reflect;
 
-import org.apache.derby.iapi.services.sanity.SanityManager;
-
-import org.apache.derby.iapi.services.loader.ClassFactory;
-import org.apache.derby.iapi.services.loader.GeneratedClass;
-import org.apache.derby.iapi.services.loader.ClassInspector;
-
-import org.apache.derby.iapi.services.monitor.ModuleControl;
-import org.apache.derby.iapi.services.monitor.ModuleSupportable;
-import org.apache.derby.iapi.services.monitor.Monitor;
-
-import org.apache.derby.iapi.error.StandardException;
-import org.apache.derby.iapi.services.property.PropertyUtil;
-
-import org.apache.derby.iapi.services.stream.HeaderPrintWriter;
-import org.apache.derby.iapi.services.monitor.Monitor;
-
-import org.apache.derby.iapi.services.compiler.*;
-import java.lang.reflect.Modifier;
-import org.apache.derby.iapi.sql.compile.CodeGeneration;
-
-import org.apache.derby.iapi.util.ByteArray;
-import org.apache.derby.iapi.services.io.FileUtil;
-import org.apache.derby.iapi.services.i18n.MessageService;
-import org.apache.derby.iapi.reference.Property;
-import org.apache.derby.iapi.reference.SQLState;
-import org.apache.derby.iapi.reference.MessageId;
-import org.apache.derby.iapi.reference.ClassName;
-
-import java.util.Properties;
-import java.util.Hashtable;
-
-import java.io.ObjectStreamClass;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
-import java.io.Serializable;
+import java.io.ObjectStreamClass;
 import java.security.AccessController;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
+import java.util.Properties;
+import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.reference.MessageId;
+import org.apache.derby.iapi.reference.Property;
+import org.apache.derby.iapi.reference.SQLState;
+import org.apache.derby.iapi.services.i18n.MessageService;
+import org.apache.derby.iapi.services.io.FileUtil;
+import org.apache.derby.iapi.services.loader.ClassFactory;
+import org.apache.derby.iapi.services.loader.ClassInspector;
+import org.apache.derby.iapi.services.loader.GeneratedClass;
+import org.apache.derby.iapi.services.monitor.ModuleControl;
+import org.apache.derby.iapi.services.monitor.Monitor;
+import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.services.stream.HeaderPrintWriter;
+import org.apache.derby.iapi.util.ByteArray;
 
 /**
 
@@ -88,7 +71,6 @@ abstract class DatabaseClasses
 	*/
 
 	private	ClassInspector	classInspector;
-	private JavaFactory		javaFactory;
 
 	private UpdateLoader		applicationLoader;
 
@@ -125,8 +107,6 @@ abstract class DatabaseClasses
 			applicationLoader = new UpdateLoader(classpath, this, true,
                                                  true);
 		}
-
-		javaFactory = (JavaFactory) org.apache.derby.iapi.services.monitor.Monitor.startSystemModule(org.apache.derby.iapi.reference.Module.JavaFactory);
 	}
 
 
@@ -317,29 +297,6 @@ abstract class DatabaseClasses
 		return -1;
 	}
 
-	public ByteArray buildSpecificFactory(String className, String factoryName)
-		throws StandardException {
-
-		ClassBuilder cb = javaFactory.newClassBuilder(this, CodeGeneration.GENERATED_PACKAGE_PREFIX,
-			Modifier.PUBLIC | Modifier.FINAL, factoryName, "org.apache.derby.impl.services.reflect.GCInstanceFactory");
-
-		MethodBuilder constructor = cb.newConstructorBuilder(Modifier.PUBLIC);
-
-		constructor.callSuper();
-		constructor.methodReturn();
-		constructor.complete();
-		constructor = null;
-
-		MethodBuilder noArg = cb.newMethodBuilder(Modifier.PUBLIC, ClassName.GeneratedByteCode,
"getNewInstance");
-		noArg.pushNewStart(className);
-		noArg.pushNewComplete(0);
-		noArg.methodReturn();
-		noArg.complete();
-		noArg = null;
-
-		return cb.getClassBytecode();
-	}
-
 	/*
 	** Class specific methods
 	*/

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/ReflectClassesJava2.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/ReflectClassesJava2.java?rev=1390342&r1=1390341&r2=1390342&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/ReflectClassesJava2.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/ReflectClassesJava2.java
Wed Sep 26 09:18:13 2012
@@ -50,7 +50,7 @@ public class ReflectClassesJava2 extends
 			// not a generated class, just load the class directly.
 			try {
 				Class jvmClass = Class.forName(fullyQualifiedName);
-				ReflectGeneratedClass gc = new ReflectGeneratedClass(this, jvmClass, null);
+				ReflectGeneratedClass gc = new ReflectGeneratedClass(this, jvmClass);
 				preCompiled.put(fullyQualifiedName, gc);
 				return gc;
 			} catch (ClassNotFoundException cnfe) {

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/ReflectGeneratedClass.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/ReflectGeneratedClass.java?rev=1390342&r1=1390341&r2=1390342&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/ReflectGeneratedClass.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/ReflectGeneratedClass.java
Wed Sep 26 09:18:13 2012
@@ -28,8 +28,6 @@ import org.apache.derby.iapi.services.lo
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.reference.SQLState;
 
-import org.apache.derby.iapi.services.context.Context;
-
 import java.lang.reflect.Method;
 import java.util.Hashtable;
 
@@ -38,10 +36,6 @@ public final class ReflectGeneratedClass
 	private final Hashtable methodCache;
 	private static final GeneratedMethod[] directs;
 
-
-	private final Class	factoryClass;
-	private GCInstanceFactory factory;
-
 	static {
 		directs = new GeneratedMethod[10];
 		for (int i = 0; i < directs.length; i++) {
@@ -49,41 +43,9 @@ public final class ReflectGeneratedClass
 		}
 	}
 
-	public ReflectGeneratedClass(ClassFactory cf, Class jvmClass, Class factoryClass) {
+	public ReflectGeneratedClass(ClassFactory cf, Class jvmClass) {
 		super(cf, jvmClass);
 		methodCache = new Hashtable();
-		this.factoryClass = factoryClass;
-	}
-
-	public Object newInstance(Context context) throws StandardException	{
-		if (factoryClass == null) {
-			return super.newInstance(context);
-		}
-
-		if (factory == null) {
-
-			Throwable t;
-			try {
-				factory =  (GCInstanceFactory) factoryClass.newInstance();
-				t = null;
-			} catch (InstantiationException ie) {
-				t = ie;
-			} catch (IllegalAccessException iae) {
-				t = iae;
-			} catch (LinkageError le) {
-				t = le;
-			}
-
-			if (t != null)
-				throw StandardException.newException(SQLState.GENERATED_CLASS_INSTANCE_ERROR, t, getName());
-		}
-
-		GeneratedByteCode ni = factory.getNewInstance();
-		ni.initFromContext(context);
-		ni.setGC(this);
-		ni.postConstructor();
-		return ni;
-
 	}
 
 	public GeneratedMethod getMethod(String simpleName)

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/ReflectLoaderJava2.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/ReflectLoaderJava2.java?rev=1390342&r1=1390341&r2=1390342&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/ReflectLoaderJava2.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/ReflectLoaderJava2.java
Wed Sep 26 09:18:13 2012
@@ -62,23 +62,6 @@ final class ReflectLoaderJava2 extends C
 
 		resolveClass(jvmClass);
 
-		/*
-			DJD - not enabling this yet, need more memory testing, may only
-			create a factory instance when a number of instances are created.
-			This would avoid a factory instance for DDL
-
-		// now generate a factory class that loads instances
-		int lastDot = name.lastIndexOf('.');
-		String factoryName = name.substring(lastDot + 1, name.length()).concat("_F");
-
-		classData = cf.buildSpecificFactory(name, factoryName);
-		Class factoryClass = defineClass(CodeGeneration.GENERATED_PACKAGE_PREFIX.concat(factoryName),
-			classData.getArray(), classData.getOffset(), classData.getLength());
-		resolveClass(factoryClass);
-		
-		  */
-		Class factoryClass = null;
-
-		return new ReflectGeneratedClass(cf, jvmClass, factoryClass);
+        return new ReflectGeneratedClass(cf, jvmClass);
 	}
 }



Mime
View raw message