Code example for ArrayBlockingQueue

Methods: adddrainTosize

            // Add m to the mAccBuffer one by one. 
            try { 
               // Log.d("m", String.valueOf(m)); 
                mAccBuffer.add(new Double(m));
            } catch (IllegalStateException e) {
                // Exception happens when reach the capacity. 
                // Doubling the buffer. ListBlockingQueue has no such issue, 
                // But generally has worse performance 
                ArrayBlockingQueue<Double> newBuf = new ArrayBlockingQueue<Double>(
                        mAccBuffer.size() * 2);
                Log.d("m", "new buff");
                mAccBuffer = newBuf;
                mAccBuffer.add(new Double(m));
Stop searching for code, let great code find you!  Add Codota to your java IDE