Debian Codegraph @

current/stream/MultiCros4.java

raw symbols SCIP
1 package stream;
2
3 import java.util.ArrayDeque;
4 import java.util.ArrayList;
5 import java.util.LinkedHashMap;
6 import java.util.Map.Entry;
7 import java.util.Set;
8 import java.util.concurrent.ArrayBlockingQueue;
9
10 import cardinality.CardinalityTracker;
11 import fileIO.FileFormat;
12 import fileIO.ReadWrite;
13 import shared.KillSwitch;
14 import shared.Shared;
15 import shared.Tools;
16 import structures.ByteBuilder;
17 import structures.ListNum;
18
19 /**
20 * Uses a retire queue with independent threads.
21 *
22 * @author Brian Bushnell
23 * @date April 5, 2024
24 *
25 */
26 public class MultiCros4 extends BufferedMultiCros {
27
28 /**
29 * For testing.<br>
30 * args should be:
31 * {input file, output pattern, names...}
32 */
33 public static void main(String[] args){
34
35 //Do some basic parsing
36 String in=args[0];
37 String pattern=args[1];
38 ArrayList<String> names=new ArrayList<String>();
39 for(int i=2; i<args.length; i++){names.add(args[i]);}
40
41 //Create an mcros for this pattern
42 MultiCros4 mcros=new MultiCros4(pattern, null, false, false, false, false, FileFormat.FASTQ, false, 4);
43
44 //Create the input stream
45 ConcurrentReadInputStream cris=ConcurrentReadInputStream.getReadInputStream(-1, true, false, in);
46 cris.start();
47
48 //Fetch the first list
49 ListNum<Read> ln=cris.nextList();
50 ArrayList<Read> reads=(ln!=null ? ln.list : null);
51
52 //Process all remaining lists
53 while(ln!=null && reads!=null && reads.size()>0){//ln!=null prevents a compiler potential null access warning
54
55 //Add the reads by barcode
56 for(Read r1 : reads){
57 mcros.add(r1, r1.barcode(true));
58 }
59
60 //Return the old list and get a new one
61 cris.returnList(ln);
62 ln=cris.nextList();
63 reads=(ln!=null ? ln.list : null);
64 }
65
66 //Close the streams
67 cris.returnList(ln);
68 ReadWrite.closeStreams(cris);
69 mcros.close();
70 }
71
72 /*--------------------------------------------------------------*/
73 /*---------------- Initialization ----------------*/
74 /*--------------------------------------------------------------*/
75
76 /** @See Details in superclass constructor */
77 public MultiCros4(String pattern1_, String pattern2_,
78 boolean overwrite_, boolean append_, boolean allowSubprocess_,
79 boolean useSharedHeader_, int defaultFormat_, boolean threaded_, int maxStreams_){
80 super(pattern1_, pattern2_, overwrite_, append_, allowSubprocess_,
81 useSharedHeader_, defaultFormat_, threaded_, maxStreams_);
82
83 bufferMap=new LinkedHashMap<String, Buffer>();
84 streamQueue=new ArrayDeque<String>(maxStreams);
85 freeTokens=new ArrayBlockingQueue<Token>(maxStreams);
86 for(int i=0; i<maxStreams; i++) {freeTokens.add(new Token(i));}
87 maxRetireThreads=Tools.max(1, (int)(maxStreams*0.25f));
88 retireQueue=new ArrayBlockingQueue<Buffer>(maxRetireThreads);
89 retireThreads=new ArrayList<RetireThread>(maxRetireThreads);
90 maxOpenStreams=Tools.max(1, maxStreams-maxRetireThreads);
91 for(int i=0; i<8 && i<maxRetireThreads; i++) {
92 RetireThread rt=new RetireThread();
93 rt.start();
94 retireThreads.add(rt);
95 }
96 System.err.println("maxStreams="+maxStreams+", maxRetireThreads="+
97 maxRetireThreads+", maxOpenStreams="+maxOpenStreams);
98 }
99
100 /*--------------------------------------------------------------*/
101 /*---------------- Outer Methods ----------------*/
102 /*--------------------------------------------------------------*/
103
104 @Override
105 public boolean finishedSuccessfully(){
106 return !errorState;
107 }
108
109 @Override
110 public void add(Read r, String name){
111 Buffer b=bufferMap.get(name);
112 if(b==null){
113 b=new Buffer(name);
114 bufferMap.put(name, b);
115 //Note: I could adjust bytesPerBuffer threshold here in response to the number of buffers.
116 }
117 b.add(r);
118 }
119
120 @Override
121 public long dumpResidual(ConcurrentReadOutputStream rosu){
122 //For each Buffer, check if it contains residual reads
123 //If so, dump it into the stream
124 for(Entry<String, Buffer> e : bufferMap.entrySet()){
125 Buffer b=e.getValue();
126 assert((b.readsIn<minReadsToDump) == (b.list!=null && !b.list.isEmpty()));
127 if(b.readsIn>0 && b.readsIn<minReadsToDump){
128 assert(b.list!=null && !b.list.isEmpty());
129 residualReads+=b.readsIn;
130 residualBases+=b.basesIn;
131 if(rosu!=null){rosu.add(b.list, 0);}
132 }
133 b.list=null;
134 }
135 return residualReads;
136 }
137
138 @Override
139 public ByteBuilder report(){
140 ByteBuilder bb=new ByteBuilder(1024);
141
142 //Add a line for residual reads dumped
143 if(minReadsToDump>0){
144 bb.append("Residual").tab().append(residualReads).tab().append(residualBases).nl();
145 }
146
147 //Add a line for each Buffer
148 for(Entry<String, Buffer> e : bufferMap.entrySet()){
149 Buffer buffer=e.getValue();
150 if(buffer.numDumps>0){//Only add a line if this Buffer actually created a file
151 buffer.appendTo(bb);
152 }
153 }
154 return bb;
155 }
156
157 @Override
158 public Set<String> getKeys(){return bufferMap.keySet();}
159
160 /*--------------------------------------------------------------*/
161 /*---------------- Inner Methods ----------------*/
162 /*--------------------------------------------------------------*/
163
164 @Override
165 long closeInner() {
166 //First dump everything
167 final long x=dumpAll();
168 //Then, retire any active streams
169 while(!streamQueue.isEmpty()){retire(1);}
170 try {
171 for(boolean success=false; !success;) {
172 retireQueue.put(POISON_BUFFER);
173 success=true;
174 }
175 } catch (InterruptedException e) {
176 // TODO Auto-generated catch block
177 e.printStackTrace();
178 }
179 waitForFinishInner();
180 return x;
181 }
182
183 /** Wait for this object's thread to terminate */
184 public final void waitForFinishInner(){
185 if(verbose){System.err.println("Waiting for finish.");}
186 for(RetireThread rt : retireThreads) {
187 synchronized(rt) {
188 while(rt.getState()!=Thread.State.TERMINATED){
189 if(verbose){System.err.println("Attempting join: state="+rt.getState());}
190 try {
191 rt.join(1000);
192 } catch (InterruptedException e) {
193 e.printStackTrace();
194 }
195 }
196 }
197 }
198 }
199
200 @Override
201 long dumpAll(){
202 if(verbose) {
203 System.err.println("before dumpAll: bytesInFlight="+bytesInFlight+
204 ", limit="+memLimitUpper+", readsInFlight="+readsInFlight);
205 }else {
206 // System.err.println("dumpAll triggered due to memory pressure.");//Also happens at the end
207 }
208 long dumped=0;
209 for(Entry<String, Buffer> e : bufferMap.entrySet()){
210 dumped+=e.getValue().dump();
211 }
212 if(verbose) {
213 System.err.println("after dumpAll: bytesInFlight="+bytesInFlight+
214 ", limit="+memLimitUpper+", readsInFlight="+readsInFlight+", dumped="+dumped);
215 }
216 return dumped;
217 }
218
219 /** Close the least-recently-used stream */
220 private void retire(int retCount){
221 if(verbose){System.err.println("Enter retire(); streamQueue="+streamQueue);}
222 assert(retCount==1); //For now
223 final long time0=System.nanoTime(), time1, time2, time3, time4;
224
225 //Select the first name in the queue, which is the least-recently-used.
226 String name=streamQueue.removeFirst();
227 Buffer b=bufferMap.get(name);
228
229 if(verbose){
230 System.err.println("retire("+name+"); state="+b.getState()+", streamQueue="+streamQueue);
231 }
232 assert(b!=null);
233 assert(b.getState()==OPEN) : name+", "+b.getState()+"\n"+streamQueue+"\n";
234 b.dump();
235 b.setState(RETIRING);
236 time1=System.nanoTime();
237
238 // if(retireThreads.size()<maxRetireThreads && retireQueue.size()>0) {
239 // RetireThread rt=new RetireThread();
240 // rt.start();
241 // retireThreads.add(rt);
242 // }
243
244 try {
245 for(boolean success=false; !success; ) {
246 retireQueue.put(b);
247 success=true;
248 }
249 } catch (InterruptedException e) {
250 // TODO Auto-generated catch block
251 e.printStackTrace();
252 }
253 time2=System.nanoTime();
254 if(verbose) {System.err.println("Added "+name+" to retire queue.");}
255 retireTime1+=(time1-time0);
256 retireTime2+=(time2-time1);
257 // retireTime3+=(time3-time2);
258 // retireTime4+=(time4-time3);
259 retireCount+=retCount;
260 retireCalls++;
261 }
262
263 /*--------------------------------------------------------------*/
264 /*---------------- Profiling ----------------*/
265 /*--------------------------------------------------------------*/
266
267 public String printRetireTime() {
268 ByteBuilder bb=new ByteBuilder();
269 float mult=0.001f/retireCount;
270 bb.append("Max Streams:\t").append(maxStreams).nl();
271 bb.append("Retire Count:\t").append(retireCount).nl();
272 bb.append("Retires Per Call:\t").append(retireCount/(float)retireCalls, 2).nl();
273 bb.append("streamsToRetire:\t").append(streamsToRetire).nl();
274 bb.append("Retire Time 1:\t").append(retireTime1*mult, 2).append(" us").nl();
275 bb.append("Retire Time 2:\t").append(retireTime2*mult, 2).append(" us").nl();
276 // bb.append("Retire Time 3:\t").append(retireTime3*mult, 2).append(" us").nl();
277 // bb.append("Retire Time 4:\t").append(retireTime4*mult, 2).append(" us").nl();
278 bb.append("Total: \t").append((retireTime1+retireTime2+retireTime3+retireTime4)/1000000000.0, 3).append(" s").nl();
279 return bb.toString();
280 }
281
282 private long retireTime1=0;
283 private long retireTime2=0;
284 private long retireTime3=0;
285 private long retireTime4=0;
286 private long retireCount=0;
287 private long retireCalls=0;
288
289 public String printCreateTime() {
290 ByteBuilder bb=new ByteBuilder();
291 float mult=0.001f/retireCount;
292 bb.append("Create Time 1:\t").append(createTime1*mult, 2).append(" us").nl();
293 bb.append("Create Time 2:\t").append(createTime2*mult, 2).append(" us").nl();
294 bb.append("Create Time 3:\t").append(createTime3*mult, 2).append(" us").nl();
295 bb.append("Create Time 4:\t").append(createTime4*mult, 2).append(" us").nl();
296 bb.append("Create Time 5:\t").append(createTime5*mult, 2).append(" us").nl();
297 bb.append("Total: \t").append((createTime2+createTime3+createTime4+createTime5)/1000000000.0, 3).append(" s").nl();
298 return bb.toString();
299 }
300
301 private long createTime1=0;
302 private long createTime2=0;
303 private long createTime3=0;
304 private long createTime4=0;
305 private long createTime5=0;
306
307 /*--------------------------------------------------------------*/
308 /*---------------- Inner Classes ----------------*/
309 /*--------------------------------------------------------------*/
310
311 /**
312 * A Buffer holds reads destined for to a specific file.
313 * When sufficient reads are present, it opens a stream and writes them.
314 * If too many streams are open, it closes another stream first.
315 */
316 private class Buffer {
317
318 Buffer(String name_){
319 name=name_;
320 String s1=pattern1.replaceFirst("%", name);
321 String s2=pattern2==null ? null : pattern2.replaceFirst("%", name);
322
323 //These are created with overwrite=false append=true because
324 //the files will be appended to if the stream gets prematurely retired.
325 //Therefore, files must be explicitly deleted first.
326 //Alternative would be to create a new FileFormat each time.
327 ff1=FileFormat.testOutput(s1, defaultFormat, null, allowSubprocess, false, true, false);
328 ff2=FileFormat.testOutput(s2, defaultFormat, null, allowSubprocess, false, true, false);
329
330 list=new ArrayList<Read>(readsPerBuffer);
331 if(trackCardinality){loglog=CardinalityTracker.makeTracker();}
332 // if(verbose){System.err.println("Made buffer for "+name);}
333 }
334
335 /**
336 * Add a read to this buffer, and update all the tracking variables.
337 * This may trigger a dump.
338 */
339 void add(Read r){
340 //Add the read
341 list.add(r);
342
343 //Gather statistics
344 long size=r.countPairBytes();
345 int count=r.pairCount();
346 currentBytes+=size;
347 bytesInFlight+=size;
348 basesIn+=r.pairLength();
349 readsInFlight+=count;
350 readsIn+=count;
351 if(trackCardinality){loglog.hash(r);}
352
353 //Decide whether to dump
354 handleLoad();
355 }
356
357 /**
358 * Determine whether to dump this buffer based on its current size.
359 * Then, determine whether to dump all buffers based on their combined size.
360 */
361 private void handleLoad(){
362 //3rd term allows preemptive dumping
363 //More generally, this triggers a dump if the reads in this buffer exceed
364 //the maximum allowed reads or bytes
365 final int size=list.size();
366 if(size>=readsPerBuffer || currentBytes>=bytesPerBuffer) {
367 if(verbose){
368 System.err.println("list.size="+list.size()+"/"+readsPerBuffer+
369 ", bytes="+currentBytes+"/"+bytesPerBuffer+", bytesInFlight="+bytesInFlight+"/"+memLimitUpper);
370 }
371 dump();
372 }else if((size>=200 || currentBytes>=400000) && state==OPEN) {
373 assert(getState()==OPEN);//Synchronization should not be needed here
374 if(verbose){
375 // System.err.println("list.size="+list.size()+"/"+readsPerBuffer+
376 // ", bytes="+currentBytes+"/"+bytesPerBuffer+", bytesInFlight="+bytesInFlight+"/"+memLimit);
377 }
378 dump();
379 }
380
381 //Too much buffered data in ALL buffers; dump everything.
382 if(bytesInFlight>=memLimitUpper){
383 long dumped=dumpAll();
384 if(dumped<1 && Shared.EA()){//Dump failed; exit
385 KillSwitch.kill("\nThis program ran out of memory."
386 + "\nTry increasing the -Xmx flag or get rid of the minreads flag,"
387 + "\nor disable assertions to skip this message and try anyway.");
388 }
389 }
390 }
391
392 /** Dump buffered reads, creating a stream if needed */
393 long dump(){
394 if(list.isEmpty() || readsIn<minReadsToDump){return 0;}
395 final int state=getState();
396 if(state==RETIRING) {return 0;}
397 ConcurrentReadOutputStream ros=getStream();
398 return dump(ros);
399 }
400
401 /**
402 * Dump buffered reads to the stream.
403 * If the buffer is empty, nothing happens. */
404 long dump(final ConcurrentReadOutputStream ros){
405 if(verbose && list.size()>400){System.err.println("Dumping "+name);}
406 if(list.isEmpty()){return 0;}
407 final long size0=list.size();
408
409 //Send the list to the output stream
410 //This part is async
411 ros.add(list, numDumps);
412
413 //Create a new list, since the old one is busy
414 list=new ArrayList<Read>(400);
415
416 //Manage statistics
417 bytesInFlight-=currentBytes;
418 readsInFlight-=size0;
419 readsWritten+=size0;
420 currentBytes=0;
421 numDumps++;
422 return size0;
423 }
424
425 /** Fetch the stream for this buffer, creating a new one if needed */
426 private synchronized ConcurrentReadOutputStream getStream(){
427 if(state==OPEN) {return currentRos;}
428 else if(state==CLOSED) {assert(currentRos==null);}
429 else {assert(false);}
430 if(verbose){System.err.println("Enter getStream("+name+"); ros="+(currentRos!=null)+", +streamQueue="+streamQueue);}
431
432 if(currentRos!=null){//The stream already exists
433 // assert(streamQueue.contains(name));//slow
434 if(streamQueue.peekLast()!=name){
435 //Move to end to prevent early retire
436 boolean b=streamQueue.remove(name);
437 assert(b) : "streamQueue did not contain "+name+", but the ros was open.";
438 streamQueue.addLast(name);
439 }
440 }else{//The stream does not exist, so create it
441 createStream();
442 }
443
444 assert(currentRos!=null) : "The stream for "+name+" was not created.";
445 assert(streamQueue.peekLast()==name) : "The stream for "+name+" was not placed in the queue.";
446 if(verbose){System.err.println("Exit getStream("+name+"); ros="+(currentRos!=null)+", +streamQueue="+streamQueue);}
447 return currentRos;
448 }
449
450 /** Create a stream for this buffer, and stick it in the queue */
451 private synchronized ConcurrentReadOutputStream createStream(){
452 assert(state==CLOSED);
453 assert(currentRos==null) : "This should never be called if there is an existing stream.";
454 if(numDumps==0 && overwrite){
455 //First time, an existing file must be deleted first, because the ff is set to append mode
456 if(verbose){System.err.println("Deleting "+name+" ; exists? "+ff1.exists());}
457 delete(ff1);
458 delete(ff2);
459 }
460 final long time0=System.nanoTime(), time1, time2, time3, time4, time5;
461
462 // assert(!streamQueue.contains(name));//slow
463
464 //Active streams should never exceed maxStreams
465 assert(streamQueue.size()<=maxOpenStreams) : "Too many streams: "+streamQueue+", "+maxStreams;
466 if(streamQueue.size()>=maxOpenStreams){
467 //Too many open streams; retire one.
468 retire(1);
469 }
470 time1=System.nanoTime();
471 //After retire, open streams must be less than maxStreams
472 assert(streamQueue.size()<maxOpenStreams) : "Too many streams: "+streamQueue+", "+maxStreams;
473 assert(token==null);
474 Token t=null;
475 if(verbose) {System.err.println("Fetching token for "+name);}
476 while(t==null) {
477 try {
478 t=freeTokens.take();
479 } catch (InterruptedException e) {
480 // TODO Auto-generated catch block
481 e.printStackTrace();
482 }
483 }
484 time2=System.nanoTime();
485 if(verbose) {System.err.println("Got token for "+name);}
486 giveToken(t);
487
488 //Create a stream
489 currentRos=ConcurrentReadOutputStream.getStream(ff1, ff2, rswBuffers, null, useSharedHeader && numDumps==0);
490 time3=System.nanoTime();
491 currentRos.start();
492 time4=System.nanoTime();
493
494 if(verbose){System.err.println("Created ros "+name+"; ow="+ff1.overwrite()+", append="+ff1.append());}
495 setState(OPEN);
496
497 //Add it to the queue
498 streamQueue.addLast(name);
499 time5=System.nanoTime();
500
501 createTime1+=(time1-time0);
502 createTime2+=(time2-time1);
503 createTime3+=(time3-time2);
504 createTime4+=(time4-time3);
505 createTime5+=(time5-time4);
506 return currentRos;
507 }
508
509 /** Delete this file if it exists */
510 private void delete(FileFormat ff){
511 if(ff==null){return;}
512 assert(overwrite || !ff.exists()) : "Trying to delete file "+ff.name()+", but overwrite=f. Please add the flag overwrite=t.";
513 ff.deleteIfPresent();
514 }
515
516 /**
517 * Format this buffer's summary as a line of text.
518 * @param bb ByteBuilder to append the text
519 * @return The modified ByteBuilder
520 */
521 ByteBuilder appendTo(ByteBuilder bb) {
522 bb.append(name).tab().append(readsIn).tab().append(basesIn);
523 if(trackCardinality){bb.tab().append(loglog.cardinality());}
524 return bb.nl();
525 }
526
527 @Override
528 public String toString(){
529 if(verbose) {return toString2();}
530 return appendTo(new ByteBuilder()).toString();
531 }
532
533 public String toString2(){
534 return name+" "+state+" "+(currentRos!=null);
535 }
536
537 synchronized void setState(int newState) {
538 if(verbose){
539 System.err.println("setState "+name+" "+state+" -> "+newState+"; ros="+(currentRos!=null));
540 }
541 assert(currentRos!=null);
542 assert(token!=null);
543
544 int x=(state+1)%3;
545 assert(state!=newState);
546 assert(x==newState);
547 state=newState;
548 if(state==CLOSED) {currentRos=null;}
549 else if(state==RETIRING) {assert(list.isEmpty());}
550 }
551
552 synchronized int getState() {
553 return state;
554 }
555
556 synchronized void giveToken(Token t) {
557 assert(token==null);
558 assert(state==CLOSED);
559 assert(t!=null);
560 token=t;
561 }
562
563 synchronized Token takeToken() {
564 assert(token!=null);
565 assert(state==CLOSED) : state;
566 Token t=token;
567 token=null;
568 return t;
569 }
570
571 /** Stream name, which is the variable part of the file pattern */
572 private final String name;
573 /** Output file 1 */
574 private final FileFormat ff1;
575 /** Output file 2 */
576 private final FileFormat ff2;
577
578 /** Once created, the stream sticks around to be re-used unless it is retired. */
579 private ConcurrentReadOutputStream currentRos;
580
581
582 private int state=CLOSED;
583 private Token token;
584
585 /** Current list of buffered reads */
586 private ArrayList<Read> list;
587 /** List of buffered reads to dump */
588 private ArrayList<Read> dumpList;
589
590 /** Number of reads entering the buffer */
591 private long readsIn=0;
592 /** Number of bases entering the buffer */
593 private long basesIn=0;
594 /** Number of reads written to disk */
595 @SuppressWarnings("unused")
596 private long readsWritten=0;//This does not count read2!
597 /** Number of bytes currently in this buffer (estimated) */
598 private long currentBytes=0;
599 /** Number of dumps executed */
600 private long numDumps=0;
601 /** Optional, for tracking cardinality */
602 private CardinalityTracker loglog;
603
604 }
605
606 private class RetireThread extends Thread {
607
608 @Override
609 public void run() {
610 while(true) {
611 Buffer b=null;
612 if(verbose) {System.err.println("Retire thread fetching buffer; retQueue="+retireQueue);}
613 while(b==null) {
614 try {
615 b=retireQueue.take();
616 } catch (InterruptedException e) {
617 // TODO Auto-generated catch block
618 e.printStackTrace();
619 }
620 }
621 if(verbose) {System.err.println("Retire thread fetched "+b.name+"; retQueue="+retireQueue);}
622 if(b==POISON_BUFFER) {
623 for(boolean success=false; success==false;) {
624 try {
625 retireQueue.put(b);
626 success=true;
627 } catch (InterruptedException e) {
628 // TODO Auto-generated catch block
629 e.printStackTrace();
630 }
631 }
632 if(verbose) {System.err.println("Retire thread terminated.");}
633 return;
634 }
635 retire(b);
636 }
637 }
638
639 void retire(Buffer b) {
640 if(verbose) {System.err.println("Retire thread retiring "+b.name+".");}
641
642 assert(b.currentRos!=null) : b.state+", "+b.name;
643 errorState=ReadWrite.closeStream(b.currentRos) | errorState;//Traditional synchronous close-and-wait
644
645 // ros.close();
646 // ros.join();
647 // errorState|=(ros.errorState() || !ros.finishedSuccessfully());
648 if(verbose){System.err.println("Exit retire("+b.name+"); ros="+(b.currentRos!=null)+
649 ", streamQueue="+streamQueue);}
650 b.setState(CLOSED);//Delete the pointer to output stream
651 Token t=b.takeToken();
652 freeTokens.add(t);
653
654 if(verbose) {System.err.println("Retire thread retired "+b.name+".");}
655 }
656
657 }
658
659 private static class Token {
660 Token(int id_){id=id_;}
661 final int id;
662 }
663
664 /*--------------------------------------------------------------*/
665 /*---------------- Fields ----------------*/
666 /*--------------------------------------------------------------*/
667
668 private final int maxRetireThreads;
669
670 /** Allow this many open streams */
671 public final int maxOpenStreams;
672
673 /** Open stream names */
674 private final ArrayDeque<String> streamQueue;
675
676 /** Tokens available for use */
677 private final ArrayBlockingQueue<Token> freeTokens;
678
679 /** Buffers waiting to retire */
680 private final ArrayBlockingQueue<Buffer> retireQueue;
681
682 /** Buffers waiting to retire */
683 private final ArrayList<RetireThread> retireThreads;
684
685 /** Map of names to buffers */
686 public final LinkedHashMap<String, Buffer> bufferMap;
687
688 private final Buffer POISON_BUFFER=new Buffer("POISON_BUFFER_NOT_A_FILE");
689
690 /*--------------------------------------------------------------*/
691 /*---------------- Static Fields ----------------*/
692 /*--------------------------------------------------------------*/
693
694 private static final int CLOSED=0, OPEN=1, RETIRING=2;
695
696 }