Skip to content

Commit

Permalink
fix resume token class cache (#789)
Browse files Browse the repository at this point in the history
  • Loading branch information
TingDaoK authored May 24, 2024
1 parent 3629745 commit 1bbacc9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/main/java/software/amazon/awssdk/crt/s3/ResumeToken.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public PutResumeTokenBuilder withUploadId(String uploadId) {

public ResumeToken build() {
return new ResumeToken(this);
}
}
};

private int nativeType;
Expand All @@ -71,6 +71,10 @@ public ResumeToken(PutResumeTokenBuilder builder) {
this.numPartsCompleted = builder.numPartsCompleted;
this.uploadId = builder.uploadId;
}
/**
* Default constructor
*/
private ResumeToken() {}

/******
* Common Fields.
Expand Down Expand Up @@ -106,7 +110,7 @@ public long getNumPartsCompleted() {
}

/******
* Upload Specific fields.
* Upload Specific fields.
******/
/**
* @return upload Id
Expand Down
9 changes: 7 additions & 2 deletions src/native/java_class_ids.c
Original file line number Diff line number Diff line change
Expand Up @@ -967,18 +967,23 @@ static void s_cache_s3_meta_request_resume_token(JNIEnv *env) {
AWS_FATAL_ASSERT(cls);
s3_meta_request_resume_token_properties.s3_meta_request_resume_token_class = (*env)->NewGlobalRef(env, cls);

s3_meta_request_resume_token_properties.s3_meta_request_resume_token_constructor_method_id =
(*env)->GetMethodID(env, s3_meta_request_progress_properties.s3_meta_request_progress_class, "<init>", "()V");
s3_meta_request_resume_token_properties.s3_meta_request_resume_token_constructor_method_id = (*env)->GetMethodID(
env, s3_meta_request_resume_token_properties.s3_meta_request_resume_token_class, "<init>", "()V");
AWS_FATAL_ASSERT(s3_meta_request_resume_token_properties.s3_meta_request_resume_token_constructor_method_id);

s3_meta_request_resume_token_properties.native_type_field_id = (*env)->GetFieldID(env, cls, "nativeType", "I");
AWS_FATAL_ASSERT(s3_meta_request_resume_token_properties.native_type_field_id);
s3_meta_request_resume_token_properties.part_size_field_id = (*env)->GetFieldID(env, cls, "partSize", "J");
AWS_FATAL_ASSERT(s3_meta_request_resume_token_properties.part_size_field_id);
s3_meta_request_resume_token_properties.total_num_parts_field_id =
(*env)->GetFieldID(env, cls, "totalNumParts", "J");
AWS_FATAL_ASSERT(s3_meta_request_resume_token_properties.total_num_parts_field_id);
s3_meta_request_resume_token_properties.num_parts_completed_field_id =
(*env)->GetFieldID(env, cls, "numPartsCompleted", "J");
AWS_FATAL_ASSERT(s3_meta_request_resume_token_properties.num_parts_completed_field_id);
s3_meta_request_resume_token_properties.upload_id_field_id =
(*env)->GetFieldID(env, cls, "uploadId", "Ljava/lang/String;");
AWS_FATAL_ASSERT(s3_meta_request_resume_token_properties.upload_id_field_id);
}

struct java_aws_mqtt5_connack_packet_properties mqtt5_connack_packet_properties;
Expand Down

0 comments on commit 1bbacc9

Please sign in to comment.