- Timestamp:
- 07/14/13 23:20:04 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
java/main/src/main/java/com/framsticks/communication/Connection.java
r100 r101 1 1 package com.framsticks.communication; 2 2 3 import com.framsticks.params.Source; 3 4 import com.framsticks.params.annotations.AutoAppendAnnotation; 4 5 import com.framsticks.params.annotations.FramsClassAnnotation; … … 60 61 threads.add(senderThread); 61 62 threads.add(receiverThread); 62 63 63 } 64 64 … … 242 242 protected void runAt() { 243 243 receiverThreadRoutine(); 244 interrupt ();245 finish ();244 interruptJoinable(); 245 finishJoinable(); 246 246 } 247 247 }); … … 251 251 protected void joinableInterrupt() { 252 252 Dispatching.drop(threads, this); 253 finish ();253 finishJoinable(); 254 254 } 255 255 … … 331 331 332 332 333 protected static String idToString(Integer id) { 334 return id != null ? " " + id.toString() : ""; 335 } 336 337 protected final void putFile(File file, Integer outId) { 338 putLine("file" + idToString(outId)/* + " " + f.getPath()*/); 339 Source content = file.getContent(); 340 String line; 341 while ((line = content.readLine()) != null) { 342 putLine(line); 343 } 344 putLine("eof"); 345 } 346 347 public final void sendFile(final String header, final File file, final Integer id, ExceptionResultHandler handler) { 348 senderThread.dispatch(new RunAt<Connection>(handler) { 349 @Override 350 protected void runAt() { 351 if (header != null) { 352 putLine(header); 353 } 354 putFile(file, id); 355 flushOut(); 356 } 357 }); 358 } 359 333 360 }
Note: See TracChangeset
for help on using the changeset viewer.