AWS Java SDK-超时等待来自池的连接

时间:2019-04-10 14:20:53

标签: amazon-web-services connection-pooling amazon-sqs aws-java-sdk

我正在使用AmazonSQS。我正在使用线程从那里读取内容,过了一会儿,我收到了连接池错误

这是我的线程逻辑

ReceiveMessageRequest request = new ReceiveMessageRequest(#url);
request.setMaxNumberOfMessages(#getMaxMessagesPolled);
request.setWaitTimeSeconds(5);
while (true) {
  List<Message> messages = new ArrayList<>();
  try {
    messages = awsService.getMessages(parameters, request);
  } catch (Exception clientException) {
  continue;
  }
  for (Message message : messages) {
      //process
      awsService.removeMessage(parameters, message);
    } catch (Exception e) {
      continue;
    }
  }
}

错误:

com.amazonaws.SdkClientException: Unable to execute HTTP request: Timeout waiting for connection from pool

我知道默认的连接池大小是50。我没有> 50个线程。

谢谢

0 个答案:

没有答案