Code example for BlockingQueue

Methods: put

0
    done.set( true );
  } 
   
  public void addToQueue( final Request request ) {
    try { 
      queue.put( request );
    } 
    catch ( InterruptedException ex ) {
      ListActivity.info( getName() + " interrupted" );
    } 
  } 
   
  public void run() { 
    while ( ! done.get() ) {
      try { 
        final Request request = queue.take();
        // if(true) throw new DBException("meh", new SQLiteException("meat puppets")); 
        if ( request != null ) {
          final SQLiteDatabase db = dbHelper.getDB();
          if ( db != null ) {
            final Cursor cursor = db.rawQuery( request.sql, null );