* @return list of messages or empty list
*/
public synchronized List<SQSMessage> receiveMessage(int numberofMaximumMessages,
long visibilityTimeout,
Map<String, String> attributes) {
SQSMessage SQSMessage;
List<SQSMessage> SQSMessageList = new ArrayList<SQSMessage>();
if (SQSMessageQueue.size() < numberofMaximumMessages) {
numberofMaximumMessages = SQSMessageQueue.size();
}
for (int messageCount = 0; messageCount < numberofMaximumMessages; messageCount++) {
SQSMessage = SQSMessageQueue.pollFirst();
SQSMessage.setFirstReceivedTimestamp();
SQSMessage.setReceiveCount();
SQSMessage.setReceivedTimeStamp(System.currentTimeMillis());
SQSMessage.setDefaultVisibilityTimeout(visibilityTimeout);
String receiptHandler = UUID.randomUUID().toString();
SQSMessage.setReceiptHandle(receiptHandler);
SQSMessageList.add(SQSMessage);
receivedMessages.put(receiptHandler, SQSMessage);
}
setLastModifiedTimestamp();
return SQSMessageList;