/** * {@inheritDoc} */ protected Map<String, AttributeValue> getRequestItem(WriteRequest writeRequest) { return writeRequest.getPutRequest().getItem(); }
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getPutRequest() != null) sb.append("PutRequest: ").append(getPutRequest()).append(","); if (getDeleteRequest() != null) sb.append("DeleteRequest: ").append(getDeleteRequest()); sb.append("}"); return sb.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof WriteRequest == false) return false; WriteRequest other = (WriteRequest) obj; if (other.getPutRequest() == null ^ this.getPutRequest() == null) return false; if (other.getPutRequest() != null && other.getPutRequest().equals(this.getPutRequest()) == false) return false; if (other.getDeleteRequest() == null ^ this.getDeleteRequest() == null) return false; if (other.getDeleteRequest() != null && other.getDeleteRequest().equals(this.getDeleteRequest()) == false) return false; return true; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getPutRequest() == null) ? 0 : getPutRequest().hashCode()); hashCode = prime * hashCode + ((getDeleteRequest() == null) ? 0 : getDeleteRequest().hashCode()); return hashCode; }
/** * Marshall the given parameter object. */ public void marshall(WriteRequest writeRequest, ProtocolMarshaller protocolMarshaller) { if (writeRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(writeRequest.getPutRequest(), PUTREQUEST_BINDING); protocolMarshaller.marshall(writeRequest.getDeleteRequest(), DELETEREQUEST_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } }
/** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getPutRequest() != null) sb.append("PutRequest: " + getPutRequest() + ","); if (getDeleteRequest() != null) sb.append("DeleteRequest: " + getDeleteRequest()); sb.append("}"); return sb.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof WriteRequest == false) return false; WriteRequest other = (WriteRequest) obj; if (other.getPutRequest() == null ^ this.getPutRequest() == null) return false; if (other.getPutRequest() != null && other.getPutRequest().equals(this.getPutRequest()) == false) return false; if (other.getDeleteRequest() == null ^ this.getDeleteRequest() == null) return false; if (other.getDeleteRequest() != null && other.getDeleteRequest().equals(this.getDeleteRequest()) == false) return false; return true; } }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getPutRequest() == null) ? 0 : getPutRequest().hashCode()); hashCode = prime * hashCode + ((getDeleteRequest() == null) ? 0 : getDeleteRequest().hashCode()); return hashCode; }
public void marshall(WriteRequest writeRequest, AwsJsonWriter jsonWriter) throws Exception { jsonWriter.beginObject(); if (writeRequest.getPutRequest() != null) { PutRequest putRequest = writeRequest.getPutRequest(); jsonWriter.name("PutRequest"); PutRequestJsonMarshaller.getInstance().marshall(putRequest, jsonWriter); } if (writeRequest.getDeleteRequest() != null) { DeleteRequest deleteRequest = writeRequest.getDeleteRequest(); jsonWriter.name("DeleteRequest"); DeleteRequestJsonMarshaller.getInstance().marshall(deleteRequest, jsonWriter); } jsonWriter.endObject(); }
/** * {@inheritDoc} */ protected Map<String, AttributeValue> getRequestItem(WriteRequest writeRequest) { return writeRequest.getPutRequest().getItem(); }
private void retry(final Map<String, List<WriteRequest>> map) { for (final Entry<String, List<WriteRequest>> requests : map.entrySet()) { for (final WriteRequest r : requests.getValue()) { if (r.getPutRequest() != null) { client.putItem(requests.getKey(), r.getPutRequest().getItem()); } } } }
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getPutRequest() != null) sb.append("PutRequest: ").append(getPutRequest()).append(","); if (getDeleteRequest() != null) sb.append("DeleteRequest: ").append(getDeleteRequest()); sb.append("}"); return sb.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof WriteRequest == false) return false; WriteRequest other = (WriteRequest) obj; if (other.getPutRequest() == null ^ this.getPutRequest() == null) return false; if (other.getPutRequest() != null && other.getPutRequest().equals(this.getPutRequest()) == false) return false; if (other.getDeleteRequest() == null ^ this.getDeleteRequest() == null) return false; if (other.getDeleteRequest() != null && other.getDeleteRequest().equals(this.getDeleteRequest()) == false) return false; return true; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getPutRequest() == null) ? 0 : getPutRequest().hashCode()); hashCode = prime * hashCode + ((getDeleteRequest() == null) ? 0 : getDeleteRequest().hashCode()); return hashCode; }
/** * Marshall the given parameter object. */ public void marshall(WriteRequest writeRequest, ProtocolMarshaller protocolMarshaller) { if (writeRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(writeRequest.getPutRequest(), PUTREQUEST_BINDING); protocolMarshaller.marshall(writeRequest.getDeleteRequest(), DELETEREQUEST_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } }
private void retryAsync(final Map<String, List<WriteRequest>> map) { for (final Entry<String, List<WriteRequest>> requests : map.entrySet()) { for (final WriteRequest r : requests.getValue()) { if (r.getPutRequest() != null) { /** * The code is pretty similar to retry. The only difference is retryAsync uses * putItemAsync instead of putItem */ final PutItemRequest putRequest = new PutItemRequest(requests.getKey(), r.getPutRequest().getItem()); final Future<PutItemResult> future = client.putItemAsync(putRequest, new AsyncHandler<PutItemRequest, PutItemResult>() { @Override public void onError(final Exception exception) { LOGGER.warn("Putitem Async failed in Dynamo"); futureMap.remove(putRequest); } @Override public void onSuccess(final PutItemRequest request, final PutItemResult result) { if (futureMap.remove(request) == null) { LOGGER.warn("Unable to delete PutItemRequest from futuresMap "); } return; } }); futureMap.put(putRequest, future); } } } }
for (WriteRequest request : unprocessedWriteRequests) { batchSizeBytes += DynamoDBUtil.getItemSizeBytes( request.getPutRequest().getItem());
for (WriteRequest request : unprocessedWriteRequests) { batchSizeBytes += DynamoDBUtil.getItemSizeBytes( request.getPutRequest().getItem());
if ((request.getPutRequest() != null) == (request.getDeleteRequest() != null)) { throw new IllegalArgumentException("Exactly one of PutRequest or DeleteRequest must be set in each WriteRequest in a batch write operation"); if (request.getPutRequest() != null) { apiName = PUT_ITEM; final int bytes = calculateItemSizeInBytes(request.getPutRequest().getItem()); wcu = computeWcu(bytes); } else { //deleterequest
List<WriteRequest> requests = entry.getValue(); for (WriteRequest request : requests) { writeBatchMapSizeBytes += DynamoDBUtil.getItemSizeBytes(request.getPutRequest().getItem());