Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

consolidated queue creation as static method

darcs-hash:20080102181053-e5a07-503d0c3a4a79c53dc2af59bad903cf8f1e821753.gz
  • Loading branch information...
commit 38fd793589565ad053027a5ccc474c40951f6eb6 1 parent db76a5f
@league authored
View
6 ConcurrentBufferOutputStream.java
@@ -17,6 +17,7 @@
{
protected ArrayBlockingQueue<byte[]> q;
static final int BUFSIZE = 16384;
+ static final int QUEUESIZE = 4096;
private static final PrintStream dbg = System.err;
private static final boolean DEBUG;
@@ -40,6 +41,11 @@ static OutputStream create( ArrayBlockingQueue<byte[]> q )
return out;
}
+ static ArrayBlockingQueue<byte[]> newQueue( )
+ {
+ return new ArrayBlockingQueue<byte[]>( QUEUESIZE );
+ }
+
protected void guarded_put( byte[] a ) throws IOException
{
try {
View
2  DecoderThread.java
@@ -33,7 +33,7 @@
DecoderThread( InputStream _in )
{
- q = new ArrayBlockingQueue<byte[]>( 4096 );
+ q = ConcurrentBufferOutputStream.newQueue( );
in = _in;
out = ConcurrentBufferOutputStream.create( q );
dec = new Decoder();
View
2  EncoderThread.java
@@ -33,7 +33,7 @@
EncoderThread( OutputStream _out )
{
- q = new ArrayBlockingQueue<byte[]> ( 4096 );
+ q = ConcurrentBufferOutputStream.newQueue();
in = ConcurrentBufferInputStream.create( q );
out = _out;
enc = new Encoder();
Please sign in to comment.
Something went wrong with that request. Please try again.