- Timestamp:
- 05/17/11 10:59:06 (14 years ago)
- Location:
- branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/Xml
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/Xml/XmlGenerator.cs
r5445 r6211 257 257 {"typeName", lastTypeToken.TypeName }, 258 258 {"serializer", lastTypeToken.Serializer }}); 259 } 260 finally { 259 } finally { 261 260 lastTypeToken = null; 262 261 } … … 333 332 zipStream.PutNextEntry(new ZipEntry("data.xml") { DateTime = DateTime.MinValue }); 334 333 StreamWriter writer = new StreamWriter(zipStream); 335 foreach (ISerializationToken token in serializer) { 336 string line = generator.Format(token); 337 writer.Write(line); 334 foreach (ISerializationToken token in new AsyncBuffer<ISerializationToken>(serializer)) { 335 writer.Write(generator.Format(token)); 338 336 } 339 337 writer.Flush(); 340 338 zipStream.PutNextEntry(new ZipEntry("typecache.xml") { DateTime = DateTime.MinValue }); 341 foreach (string line in generator.Format(serializer.TypeCache)) {339 foreach (string line in new AsyncBuffer<string>(generator.Format(serializer.TypeCache))) { 342 340 writer.Write(line); 343 341 } … … 368 366 File.Copy(tempfile, filename, true); 369 367 File.Delete(tempfile); 370 } 371 catch (Exception) { 368 } catch (Exception) { 372 369 Logger.Warn("Exception caught, no data has been written."); 373 370 throw; … … 438 435 serializer.InterleaveTypeInformation = true; 439 436 XmlGenerator generator = new XmlGenerator(); 440 foreach (ISerializationToken token in serializer) {437 foreach (ISerializationToken token in new AsyncBuffer<ISerializationToken>(serializer)) { 441 438 string line = generator.Format(token); 442 439 writer.Write(line); -
branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/Xml/XmlParser.cs
r5445 r6211 75 75 try { 76 76 iterator = handlers[reader.Name].Invoke(); 77 } 78 catch (KeyNotFoundException) { 77 } catch (KeyNotFoundException) { 79 78 throw new PersistenceException(String.Format( 80 79 "Invalid XML tag \"{0}\" in persistence file.", … … 176 175 } 177 176 return typeCache; 178 } 179 catch (PersistenceException) { 177 } catch (PersistenceException) { 180 178 throw; 181 } 182 catch (Exception e) { 179 } catch (Exception e) { 183 180 throw new PersistenceException("Unexpected exception during type cache parsing.", e); 184 181 } … … 196 193 return Deserialize(file); 197 194 } 198 } 199 finally { 195 } finally { 200 196 TimeSpan end = System.Diagnostics.Process.GetCurrentProcess().TotalProcessorTime; 201 197 Tracing.Logger.Info(string.Format( … … 226 222 XmlParser parser = new XmlParser(reader); 227 223 Deserializer deserializer = new Deserializer(new TypeMapping[] { }); 228 return deserializer.Deserialize(parser); 229 } 230 } 231 catch (PersistenceException) { 224 return deserializer.Deserialize(new AsyncBuffer<ISerializationToken>(parser)); 225 } 226 } catch (PersistenceException) { 232 227 throw; 233 } 234 catch (Exception x) { 228 } catch (Exception x) { 235 229 throw new PersistenceException("Unexpected exception during deserialization", x); 236 230 } … … 258 252 XmlParser parser = new XmlParser( 259 253 new StreamReader(zipFile.GetInputStream(data))); 260 object result = deSerializer.Deserialize( parser);254 object result = deSerializer.Deserialize(new AsyncBuffer<ISerializationToken>(parser)); 261 255 zipFile.Close(); 262 256 return result; 263 } 264 catch (PersistenceException) { 257 } catch (PersistenceException) { 265 258 throw; 266 } 267 catch (Exception e) { 259 } catch (Exception e) { 268 260 throw new PersistenceException("Unexpected exception during deserialization", e); 269 261 }
Note: See TracChangeset
for help on using the changeset viewer.