Changeset 3747
- Timestamp:
- Sep 18, 2007, 8:59:23 AM (16 years ago)
- Location:
- branches/2.4-stable
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.4-stable/src/core/net/sf/basedb/core/AbstractBatcher.java
r3679 r3747 75 75 76 76 /** 77 Constructor that initiate everything. 78 79 @param dc The <code>DbControl</code> to get database access 77 Constructor for a batcher. 80 78 @throws BaseException If there is an error 81 79 */ 82 AbstractBatcher(DbControl dc) 83 { 84 assert dc != null : "dc == null"; 85 this.dc = new WeakReference<DbControl>(dc); 86 this.sc = dc.getSessionControl(); 80 AbstractBatcher() 81 { 87 82 this.batchSize = Config.getInt("db.batch-size", 50); 88 dc.addBatcher(this);89 83 } 90 84 … … 133 127 { 134 128 sc.updateLastAccess(); 129 } 130 131 /** 132 Set the DbControl that is controlling this batcher. This 133 method MUST be called by all subclasses after successful construction 134 of a batcher. This method also registers the batcher with the DbControl 135 using {@link DbControl#addBatcher(Batcher)} 136 @since 2.4.2 137 */ 138 protected final void setDbControl(DbControl dc) 139 { 140 assert dc != null : "dc == null"; 141 this.dc = new WeakReference<DbControl>(dc); 142 this.sc = dc.getSessionControl(); 143 dc.addBatcher(this); 135 144 } 136 145 -
branches/2.4-stable/src/core/net/sf/basedb/core/BasicBatcher.java
r3679 r3747 131 131 Constructor that initiate everything. 132 132 133 @param dc DbControl to get database access134 133 @param dataClass The class of the data objects that are accepted by this batcher 135 134 @param entityName The entity name of the data as known by Hibernate, use null … … 137 136 @throws BaseException If there is an error 138 137 */ 139 BasicBatcher( DbControl dc, Class<D> dataClass, String entityName)140 throws BaseException 141 { 142 super( dc);138 BasicBatcher(org.hibernate.Session session, Class<D> dataClass, String entityName) 139 throws BaseException 140 { 141 super(); 143 142 assert dataClass != null : "dataClass == null"; 144 143 … … 159 158 try 160 159 { 161 java.sql.Connection c = HibernateUtil.getConnection( dc.getHibernateSession());160 java.sql.Connection c = HibernateUtil.getConnection(session); 162 161 insertStatement = c.prepareStatement(insertSql); 163 162 updateStatement = c.prepareStatement(updateSql); -
branches/2.4-stable/src/core/net/sf/basedb/core/DbControl.java
r3679 r3747 269 269 batcher.close(); 270 270 } 271 catch ( BaseExceptionex)271 catch (Throwable ex) 272 272 { 273 273 log.warn("Exception during rollback in batcher.close()", ex); … … 281 281 if (hStatelessSession != null) HibernateUtil.close(hStatelessSession); 282 282 } 283 catch ( BaseExceptionex)283 catch (Throwable ex) 284 284 { 285 285 log.warn("Exception during rollback in Hibernate", ex); -
branches/2.4-stable/src/core/net/sf/basedb/core/FeatureBatcher.java
r3679 r3747 91 91 throws BaseException 92 92 { 93 super(dc , FeatureData.class, null);93 super(dc.getHibernateSession(), FeatureData.class, null); 94 94 this.arrayDesign = arrayDesign; 95 95 this.arrayDesignData = arrayDesign.getData(); 96 96 this.isAffy = arrayDesign.isAffyChip(); 97 setDbControl(dc); 97 98 } 98 99 -
branches/2.4-stable/src/core/net/sf/basedb/core/FilterBatcher.java
r3679 r3747 142 142 FilterBatcher(DbControl dc, BioAssaySet bioAssaySet) 143 143 { 144 super( dc);144 super(); 145 145 this.bioAssaySet = bioAssaySet; 146 146 this.bytesPerRow = VirtualTable.FILTER.getBytesPerRow(bioAssaySet.getRawDataType()); 147 setDbControl(dc); 147 148 } 148 149 -
branches/2.4-stable/src/core/net/sf/basedb/core/MappingBatcher.java
r3679 r3747 106 106 MappingBatcher(DbControl dc, DataCube dataCube) 107 107 { 108 super( dc);108 super(); 109 109 this.dataCube = dataCube; 110 110 this.noRawMapping = dataCube.isInDatabase(); 111 111 this.bytesPerRow = VirtualTable.RAWPARENTS.getBytesPerRow(dataCube.getRawDataType()); 112 setDbControl(dc); 112 113 } 113 114 -
branches/2.4-stable/src/core/net/sf/basedb/core/PositionBatcher.java
r3679 r3747 106 106 PositionBatcher(DbControl dc, DataCube dataCube) 107 107 { 108 super( dc);108 super(); 109 109 this.dataCube = dataCube; 110 110 this.bytesPerRow = VirtualTable.POSITION.getBytesPerRow(dataCube.getRawDataType()); 111 setDbControl(dc); 111 112 } 112 113 -
branches/2.4-stable/src/core/net/sf/basedb/core/PositionExtraValueBatcher.java
r3679 r3747 154 154 PositionExtraValueBatcher(DbControl dc, ExtraValue extraValue) 155 155 { 156 super( dc);156 super(); 157 157 this.extraValue = extraValue; 158 158 this.bytesPerRow = extraValue.getVirtualTable().getBytesPerRow(extraValue.getRawDataType()); 159 159 this.valueType = extraValue.getExtraValueType().getValueType(); 160 160 this.sqlType = valueType.getSQLType(); 161 setDbControl(dc); 161 162 } 162 163 -
branches/2.4-stable/src/core/net/sf/basedb/core/RawDataBatcher.java
r3679 r3747 161 161 throws BaseException 162 162 { 163 super(dc , RawData.class, rawBioAssay.getRawDataType().getEntityName());163 super(dc.getHibernateSession(), RawData.class, rawBioAssay.getRawDataType().getEntityName()); 164 164 this.rawBioAssay = rawBioAssay; 165 165 this.rawBioAssayData = rawBioAssay.getData(); … … 205 205 this.preloaded = null; 206 206 } 207 setDbControl(dc); 207 208 } 208 209 -
branches/2.4-stable/src/core/net/sf/basedb/core/ReporterBatcher.java
r3679 r3747 77 77 throws BaseException 78 78 { 79 super(dc , ReporterData.class, null);79 super(dc.getHibernateSession(), ReporterData.class, null); 80 80 extendedProperties = ExtendedProperties.getProperties("ReporterData"); 81 81 batchedExternalIds = HibernateUtil.getDbEngine().caseInsensitiveComparison() ? 82 82 new TreeSet<String>(String.CASE_INSENSITIVE_ORDER) : new HashSet<String>(); 83 setDbControl(dc); 83 84 } 84 85 -
branches/2.4-stable/src/core/net/sf/basedb/core/SpotBatcher.java
r3679 r3747 141 141 SpotBatcher(DbControl dc, BioAssaySet bioAssaySet) 142 142 { 143 super( dc);143 super(); 144 144 this.bioAssaySet = bioAssaySet; 145 145 this.numChannels = bioAssaySet.getRawDataType().getChannels(); 146 146 this.bytesPerRow = VirtualTable.SPOT.getBytesPerRow(bioAssaySet.getRawDataType()); 147 setDbControl(dc); 147 148 } 148 149 -
branches/2.4-stable/src/core/net/sf/basedb/core/SpotExtraValueBatcher.java
r3679 r3747 144 144 SpotExtraValueBatcher(DbControl dc, ExtraValue extraValue) 145 145 { 146 super( dc);146 super(); 147 147 this.extraValue = extraValue; 148 148 this.bytesPerRow = extraValue.getVirtualTable().getBytesPerRow(extraValue.getRawDataType()); 149 149 this.valueType = extraValue.getExtraValueType().getValueType(); 150 150 this.sqlType = valueType.getSQLType(); 151 setDbControl(dc); 151 152 } 152 153 -
branches/2.4-stable/www/exception/exception.jsp
r3711 r3747 204 204 StackTraceElement[] st = ex.getStackTrace(); 205 205 out.println("<pre>"); 206 out.println(exceptionClassName); 206 207 int i = 0; 207 208 for (i=0; i < st.length && i < 8; i++) 208 209 { 209 210 out.print("...at "); 210 out.println( st[i].toString().replaceAll("net.sf.basedb.core.", ""));211 out.println(HTML.encodeTags(st[i].toString().replaceAll("net.sf.basedb.core.", ""))); 211 212 } 212 213 out.println("</pre>"); … … 219 220 { 220 221 out.print("...at "); 221 out.println( st[j].toString().replaceAll("net.sf.basedb.core.", ""));222 out.println(HTML.encodeTags(st[j].toString().replaceAll("net.sf.basedb.core.", ""))); 222 223 } 223 224 ex = ex.getCause();
Note: See TracChangeset
for help on using the changeset viewer.