- Timestamp:
- 07/06/13 03:51:11 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
java/main/src/main/java/com/framsticks/dumping/SaveStream.java
r96 r97 1 1 package com.framsticks.dumping; 2 2 3 import static com.framsticks.core. InstanceUtils.*;3 import static com.framsticks.core.TreeOperations.*; 4 4 import com.framsticks.core.Node; 5 5 import com.framsticks.core.Path; … … 10 10 import com.framsticks.params.SinkInterface; 11 11 import com.framsticks.parsers.Savers; 12 import com.framsticks.core. Instance;12 import com.framsticks.core.Tree; 13 13 import com.framsticks.util.*; 14 14 import com.framsticks.util.dispatching.Dispatching; 15 import com.framsticks.util.dispatching.Future; 16 import com.framsticks.util.dispatching.ThrowExceptionHandler; 17 15 18 import org.apache.log4j.Logger; 16 19 import com.framsticks.util.dispatching.RunAt; … … 28 31 29 32 protected final SinkInterface sink; 30 protected final Instance instance;31 protected final StateFunctor stateFunctor;33 protected final Tree tree; 34 protected final Future<Void> future; 32 35 protected final Stopwatch stopwatch = new Stopwatch(); 33 36 protected final Set<FramsClass> storedInfo = new HashSet<FramsClass>(); … … 35 38 private int dispatched = 0; 36 39 37 public SaveStream(SinkInterface sink, Instance instance, Path root, StateFunctor stateFunctor) {40 public SaveStream(SinkInterface sink, Tree tree, Path root, Future<Void> future) { 38 41 assert Dispatching.isThreadSafe(); 39 42 this.sink = sink; 40 this. instance = instance;41 this. stateFunctor = stateFunctor;43 this.tree = tree; 44 this.future = future; 42 45 dispatchWrite(root); 43 46 } … … 45 48 protected void dispatchWrite(final Path path) { 46 49 ++dispatched; 47 instance.dispatch(new RunAt<Instance>() { 50 //TODO TEH 51 tree.dispatch(new RunAt<Tree>(ThrowExceptionHandler.getInstance()) { 48 52 @Override 49 p ublic void run() {53 protected void runAt() { 50 54 write(path); 51 55 } … … 54 58 55 59 protected void finished() { 56 assert instance.isActive();60 assert tree.isActive(); 57 61 log.info("stored in " + stopwatch); 58 stateFunctor.call();62 future.pass(null); 59 63 } 60 64 61 65 public void write(final Path path) { 62 assert instance.isActive();66 assert tree.isActive(); 63 67 if (!path.isResolved()) { 64 68 log.debug("path " + path + " is not resolved - skipping");
Note: See TracChangeset
for help on using the changeset viewer.