| 40 | } |
| 41 | |
| 42 | @Override |
| 43 | public void run() { |
| 44 | try { |
| 45 | while(true) { |
| 46 | String seq = inputQueue.poll(); |
| 47 | |
| 48 | if (seq == null) { |
| 49 | if (terminateWhenInputExhausts) { |
| 50 | break; |
| 51 | } |
| 52 | sleep(100); |
| 53 | continue; |
| 54 | } |
| 55 | |
| 56 | String header = seqPrefix + ++numSeq + " l=" + Integer.toString(seq.length()); |
| 57 | |
| 58 | writer.write(header, seq); |
| 59 | } |
| 60 | |
| 61 | successful = true; |
| 62 | |
| 63 | } catch (Exception ex) { |
| 64 | System.out.println(ex.getMessage()); |
| 65 | exception = ex; |
| 66 | successful = false; |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | public void terminateWhenInputExhausts() { |
| 71 | terminateWhenInputExhausts = true; |