1 21 22 package org.apache.derby.impl.sql.catalog; 23 24 import org.apache.derby.iapi.services.cache.Cacheable; 25 import org.apache.derby.iapi.services.cache.CacheManager; 26 27 import org.apache.derby.iapi.services.monitor.Monitor; 28 29 import org.apache.derby.iapi.services.sanity.SanityManager; 30 31 import org.apache.derby.iapi.services.stream.HeaderPrintWriter; 32 33 import org.apache.derby.iapi.error.StandardException; 34 35 import org.apache.derby.iapi.sql.dictionary.TableDescriptor; 36 37 56 abstract class TDCacheable implements Cacheable 57 { 58 protected TableDescriptor td; 59 protected final DataDictionaryImpl dd; 60 61 TDCacheable(DataDictionaryImpl dd) { 62 this.dd = dd; 63 } 64 65 66 67 68 public void clean(boolean forRemove) 69 { 70 return; 71 } 72 73 74 public boolean isDirty() 75 { 76 return false; 77 } 78 79 82 public TableDescriptor getTableDescriptor() 83 { 84 return td; 85 } 86 87 99 protected boolean checkConsistency(TableDescriptor uncachedTD, 100 Object identity, 101 HeaderPrintWriter reportInconsistent) 102 throws StandardException 103 { 104 boolean retval = true; 105 106 if (SanityManager.DEBUG) 107 { 108 if (uncachedTD == null) 109 { 110 reportInconsistent.println( 111 "Inconsistent NameTDCacheable: identity = " + identity + 112 ", uncached table descriptor not found."); 113 retval = false; 114 } 115 else 116 { 117 if ( 118 (uncachedTD.getHeapConglomerateId() != 119 td.getHeapConglomerateId()) || 120 ( ! uncachedTD.getUUID().equals(td.getUUID())) || 121 ( ! uncachedTD.getSchemaName().equals(td.getSchemaName()))|| 122 ( ! uncachedTD.getName().equals(td.getName())) || 123 ( uncachedTD.getTableType() != td.getTableType()) 124 ) 125 { 126 reportInconsistent.println( 127 "Inconsistent NameTDCacheable: identity = " + identity + 128 ", cached TD = " + 129 td + 130 ", uncached TD = " + 131 uncachedTD); 132 133 retval = false; 134 } 135 } 136 } 137 138 return retval; 139 } 140 } 141 | Popular Tags |