Index: java/engine/org/apache/derby/impl/jdbc/LOBStoredProcedure.java
===================================================================
--- java/engine/org/apache/derby/impl/jdbc/LOBStoredProcedure.java	(revision 642701)
+++ java/engine/org/apache/derby/impl/jdbc/LOBStoredProcedure.java	(working copy)
@@ -26,8 +26,7 @@
 import java.sql.DriverManager;
 import java.sql.SQLException;
 
-import org.apache.derby.iapi.jdbc.EngineBlob;
-import org.apache.derby.iapi.jdbc.EngineClob;
+import org.apache.derby.iapi.jdbc.EngineLOB;
 import org.apache.derby.iapi.reference.SQLState;
 
 /**
@@ -43,7 +42,7 @@
      * @throws SQLException
      */
     public static int CLOBCREATELOCATOR() throws SQLException {
-        EngineClob clob = (EngineClob) getEmbedConnection().createClob();
+        EngineLOB clob = (EngineLOB)getEmbedConnection().createClob();
         return clob.getLocator();
     }
 
@@ -203,7 +202,7 @@
      * @throws SQLException
      */
     public static int BLOBCREATELOCATOR() throws SQLException {
-        EngineBlob blob = (EngineBlob) getEmbedConnection().createBlob();
+        EngineLOB blob = (EngineLOB)getEmbedConnection().createBlob();
         return blob.getLocator();
     }
 
Index: java/engine/org/apache/derby/impl/jdbc/EmbedBlob.java
===================================================================
--- java/engine/org/apache/derby/impl/jdbc/EmbedBlob.java	(revision 642701)
+++ java/engine/org/apache/derby/impl/jdbc/EmbedBlob.java	(working copy)
@@ -24,7 +24,7 @@
 
 import org.apache.derby.iapi.reference.SQLState;
 import org.apache.derby.iapi.error.StandardException;
-import org.apache.derby.iapi.jdbc.EngineBlob;
+import org.apache.derby.iapi.jdbc.EngineLOB;
 import org.apache.derby.iapi.services.monitor.Monitor;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.types.DataValueDescriptor;
@@ -68,7 +68,7 @@
 
  */
 
-final class EmbedBlob extends ConnectionChild implements Blob, EngineBlob
+final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB
 {
     // blob is either materialized or still in stream
     private boolean         materialized;
Index: java/engine/org/apache/derby/impl/jdbc/EmbedClob.java
===================================================================
--- java/engine/org/apache/derby/impl/jdbc/EmbedClob.java	(revision 642701)
+++ java/engine/org/apache/derby/impl/jdbc/EmbedClob.java	(working copy)
@@ -24,7 +24,7 @@
 
 import org.apache.derby.iapi.reference.SQLState;
 import org.apache.derby.iapi.error.StandardException;
-import org.apache.derby.iapi.jdbc.EngineClob;
+import org.apache.derby.iapi.jdbc.EngineLOB;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.types.DataValueDescriptor;
 import org.apache.derby.iapi.types.Resetable;
@@ -67,7 +67,7 @@
         new update methods can safely be added into implementation.
    </UL>
  */
-final class EmbedClob extends ConnectionChild implements Clob, EngineClob
+final class EmbedClob extends ConnectionChild implements Clob, EngineLOB
 {
 
     /**
Index: java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
===================================================================
--- java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java	(revision 642701)
+++ java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java	(working copy)
@@ -69,6 +69,7 @@
 import java.util.Properties;
 import java.util.Iterator;
 
+import org.apache.derby.iapi.jdbc.EngineLOB;
 import org.apache.derby.impl.jdbc.authentication.NoneAuthenticationServiceImpl;
 
 /**
@@ -2902,15 +2903,9 @@
 		//the hash table object to null.
 		HashMap map = rootConnection.lobHashMap;
 		if (map != null) {
-			for (Iterator it = map.values().iterator(); it.hasNext(); ) {
-				Object obj = it.next();
-				if (obj instanceof EmbedClob) {
-					((EmbedClob) obj).free();
-				} else if (obj instanceof EmbedBlob) {
-					((EmbedBlob) obj).free();
-				} else if (SanityManager.DEBUG) {
-					SanityManager.THROWASSERT("Unexpected value: " + obj);
-				}
+            Iterator it = map.values().iterator();
+            while (it.hasNext()) {
+                ((EngineLOB)it.next()).free();
 			}
 			map.clear();
 		}
Index: java/engine/org/apache/derby/iapi/jdbc/EngineLOB.java
===================================================================
--- java/engine/org/apache/derby/iapi/jdbc/EngineLOB.java	(revision 0)
+++ java/engine/org/apache/derby/iapi/jdbc/EngineLOB.java	(revision 0)
@@ -0,0 +1,54 @@
+/*
+
+   Derby - Class org.apache.derby.iapi.jdbc.EngineLOB
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to you under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+
+package org.apache.derby.iapi.jdbc;
+
+import java.sql.SQLException;
+
+/**
+ * Additional methods the embedded engine exposes on all of its large object
+ * (LOB) implementations.
+ * <p>
+ * An internal API only, mainly for the network server.
+ * <p>
+ * <b>Implementation note</b>: If a new method is needed, that only applies to
+ * one specific large object type (for instance a Blob), one should consider
+ * creating a new interface that extends from this one.
+ */
+public interface EngineLOB {
+
+    /**
+     * Returns LOB locator key.
+     * <p>
+     * The key can be used with {@link EmbedConnection#getLobMapping} to
+     * retrieve this LOB at a later time.
+     *
+     * @return Locator key for this LOB
+     */
+    public int getLocator();
+
+    /**
+     * Frees all resources assoicated with this LOB.
+     *
+     * @throws SQLException if an error occurs during cleanup
+     */
+    public void free() throws SQLException;
+}

Property changes on: java/engine/org/apache/derby/iapi/jdbc/EngineLOB.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: java/engine/org/apache/derby/iapi/jdbc/EngineBlob.java
===================================================================
--- java/engine/org/apache/derby/iapi/jdbc/EngineBlob.java	(revision 642701)
+++ java/engine/org/apache/derby/iapi/jdbc/EngineBlob.java	(working copy)
@@ -1,19 +0,0 @@
-package org.apache.derby.iapi.jdbc;
-
-/**
- * Additional methods the embedded engine exposes on its Blob object
- * implementations. An internal api only, mainly for the network
- * server.  
- * 
- */
-
-public interface EngineBlob {
-
-    /**
-     * Return lob locator key that can be used with 
-     * EmbedConnection.getLobMapping(int) to retrieve this Blob.
-     * 
-     * @return lob locator for this Blob
-     */
-    public int getLocator();
-}
Index: java/engine/org/apache/derby/iapi/jdbc/EngineClob.java
===================================================================
--- java/engine/org/apache/derby/iapi/jdbc/EngineClob.java	(revision 642701)
+++ java/engine/org/apache/derby/iapi/jdbc/EngineClob.java	(working copy)
@@ -1,18 +0,0 @@
-package org.apache.derby.iapi.jdbc;
-
-/**
- * Additional methods the embedded engine exposes on its Blob object
- * implementations. An internal api only, mainly for the network
- * server.  
- * 
- */
-
-public interface EngineClob {
-    /**
-     * Return lob locator key that can be used with 
-     * EmbedConnection.getLobMapping(int) to retrieve this Clob.
-     * 
-     * @return lob locator for this Clob
-     */
-    public int getLocator();
-}
Index: java/drda/org/apache/derby/impl/drda/DRDAConnThread.java
===================================================================
--- java/drda/org/apache/derby/impl/drda/DRDAConnThread.java	(revision 642701)
+++ java/drda/org/apache/derby/impl/drda/DRDAConnThread.java	(working copy)
@@ -57,8 +57,7 @@
 import org.apache.derby.iapi.services.stream.HeaderPrintWriter;
 import org.apache.derby.iapi.tools.i18n.LocalizedResource;
 import org.apache.derby.iapi.jdbc.AuthenticationService;
-import org.apache.derby.iapi.jdbc.EngineBlob;
-import org.apache.derby.iapi.jdbc.EngineClob;
+import org.apache.derby.iapi.jdbc.EngineLOB;
 import org.apache.derby.iapi.jdbc.EngineResultSet;
 import org.apache.derby.impl.jdbc.EmbedSQLException;
 import org.apache.derby.impl.jdbc.Util;
@@ -7574,10 +7573,8 @@
 						writer.writeLDBytes((byte[]) val, index);
 					break;
 				case DRDAConstants.DRDA_TYPE_NLOBLOC:
-					writer.writeInt(((EngineBlob) val).getLocator());
-					break;
 				case DRDAConstants.DRDA_TYPE_NCLOBLOC:
-					writer.writeInt(((EngineClob) val).getLocator());
+					writer.writeInt(((EngineLOB)val).getLocator());
 					break;
 				default:
 					if (SanityManager.DEBUG) 
