private void bufferQueue() {
    		if ( maxNumMessages <= 10 ) { // get directly if what we want can be get within one request
    			if (messages.size() == 0) {
		    		try {
		        		long getMessageQueueStat = perf.getStartTime();
		    			// receive the messages and store them in a class variable
		    			for (int f = 0; f < NUM_END_QUEUE_RETRIES && messages.size() == 0; f++) {
	 		    			ReceiveMessage request = new ReceiveMessage().withQueueName(name);
			    			ReceiveMessageResponse response = localservice.receiveMessage(request.withMaxNumberOfMessages(maxNumMessages));
			    			insertMessages(response.getReceiveMessageResult().getMessage());
		    			}
		        		perf.stopTimer("getMessageQueueStat", getMessageQueueStat);
		        	}
		        	catch (AmazonSQSException ex) {
		    			logger.warn("Fail buffer SQS queue: " + ex.getMessage());
		        	}
    			}
    		}
    		else {
    			if ( messages.size() + requestsOutstanding*10 < maxNumMessages ) {
    				// use a variable so that it does not loop endlessly threads are clearing at the same time
    				int threadsToLaunch = (maxNumMessages-messages.size()-requestsOutstanding*10 + 10)/10;
    				for ( int i=0 ; i<threadsToLaunch ; i++) {
    					workers.push(new PopRunnable(this, getSQSService()));
		    			synchronized(this) {
		    				requestsOutstanding ++ ;
		    			}
    				}
	    		}
    		}
    	}