Rename toProtoMessageSynchronized to toPersistableMessage

Make PersistableEnvelope method name less confusing, as it is only
synchronised in ThreadedPersistableEnvelope.
This commit is contained in:
Steven Barclay 2020-03-10 10:36:52 +08:00
parent 6487f92d84
commit 9e9fc6ab57
No known key found for this signature in database
GPG Key ID: 9FED6BF1176D500B
3 changed files with 3 additions and 3 deletions

View File

@ -31,7 +31,7 @@ import java.util.concurrent.FutureTask;
*/
public interface PersistableEnvelope extends Envelope {
default Message toProtoMessageSynchronized() {
default Message toPersistableMessage() {
FutureTask<Message> toProtoOnUserThread = new FutureTask<>(this::toProtoMessage);
UserThread.execute(toProtoOnUserThread);
//noinspection UnstableApiUsage

View File

@ -30,7 +30,7 @@ import com.google.protobuf.Message;
public interface ThreadedPersistableEnvelope extends PersistableEnvelope {
@Override
default Message toProtoMessageSynchronized() {
default Message toPersistableMessage() {
synchronized (this) {
return toProtoMessage();
}

View File

@ -189,7 +189,7 @@ public class FileManager<T extends PersistableEnvelope> {
log.debug("Write to disc: {}", storageFile.getName());
protobuf.PersistableEnvelope protoPersistable;
try {
protoPersistable = (protobuf.PersistableEnvelope) persistable.toProtoMessageSynchronized();
protoPersistable = (protobuf.PersistableEnvelope) persistable.toPersistableMessage();
if (protoPersistable.toByteArray().length == 0)
log.error("protoPersistable is empty. persistable=" + persistable.getClass().getSimpleName());
} catch (Throwable e) {