mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-11 15:17:43 +00:00
refactor: performance improvements in batch message processing, synchronized cache access and audible message notifications.
Increase audible timeout on DefaultMessageNotifier.java, don't send in-thread notification based on last audible notification. Create a batch message receive job to handle up to 20 chunked messages at a time per job instead of singular or open group poll amount Remove synchronized access to recipient cache and replace with a concurrent cache that's lock free from perf tracing monitor contention
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
|
||||
all:
|
||||
protoc25 --java_out=../src/main/java/ SignalService.proto WebSocketResources.proto
|
||||
protoc25 --java_out=../src/main/java/ SignalService.proto WebSocketResources.proto Utils.proto
|
||||
|
10
libsignal/protobuf/Utils.proto
Normal file
10
libsignal/protobuf/Utils.proto
Normal file
@@ -0,0 +1,10 @@
|
||||
syntax = "proto2";
|
||||
|
||||
package signalservice;
|
||||
|
||||
option java_package = "org.session.libsignal.protos";
|
||||
option java_outer_classname = "UtilProtos";
|
||||
|
||||
message ByteArrayList {
|
||||
repeated bytes content = 1;
|
||||
}
|
@@ -0,0 +1,512 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: Utils.proto
|
||||
|
||||
package org.session.libsignal.protos;
|
||||
|
||||
public final class UtilProtos {
|
||||
private UtilProtos() {}
|
||||
public static void registerAllExtensions(
|
||||
com.google.protobuf.ExtensionRegistry registry) {
|
||||
}
|
||||
public interface ByteArrayListOrBuilder
|
||||
extends com.google.protobuf.MessageOrBuilder {
|
||||
|
||||
// repeated bytes content = 1;
|
||||
/**
|
||||
* <code>repeated bytes content = 1;</code>
|
||||
*/
|
||||
java.util.List<com.google.protobuf.ByteString> getContentList();
|
||||
/**
|
||||
* <code>repeated bytes content = 1;</code>
|
||||
*/
|
||||
int getContentCount();
|
||||
/**
|
||||
* <code>repeated bytes content = 1;</code>
|
||||
*/
|
||||
com.google.protobuf.ByteString getContent(int index);
|
||||
}
|
||||
/**
|
||||
* Protobuf type {@code signalservice.ByteArrayList}
|
||||
*/
|
||||
public static final class ByteArrayList extends
|
||||
com.google.protobuf.GeneratedMessage
|
||||
implements ByteArrayListOrBuilder {
|
||||
// Use ByteArrayList.newBuilder() to construct.
|
||||
private ByteArrayList(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
|
||||
super(builder);
|
||||
this.unknownFields = builder.getUnknownFields();
|
||||
}
|
||||
private ByteArrayList(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
|
||||
|
||||
private static final ByteArrayList defaultInstance;
|
||||
public static ByteArrayList getDefaultInstance() {
|
||||
return defaultInstance;
|
||||
}
|
||||
|
||||
public ByteArrayList getDefaultInstanceForType() {
|
||||
return defaultInstance;
|
||||
}
|
||||
|
||||
private final com.google.protobuf.UnknownFieldSet unknownFields;
|
||||
@java.lang.Override
|
||||
public final com.google.protobuf.UnknownFieldSet
|
||||
getUnknownFields() {
|
||||
return this.unknownFields;
|
||||
}
|
||||
private ByteArrayList(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
initFields();
|
||||
int mutable_bitField0_ = 0;
|
||||
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
|
||||
com.google.protobuf.UnknownFieldSet.newBuilder();
|
||||
try {
|
||||
boolean done = false;
|
||||
while (!done) {
|
||||
int tag = input.readTag();
|
||||
switch (tag) {
|
||||
case 0:
|
||||
done = true;
|
||||
break;
|
||||
default: {
|
||||
if (!parseUnknownField(input, unknownFields,
|
||||
extensionRegistry, tag)) {
|
||||
done = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 10: {
|
||||
if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
|
||||
content_ = new java.util.ArrayList<com.google.protobuf.ByteString>();
|
||||
mutable_bitField0_ |= 0x00000001;
|
||||
}
|
||||
content_.add(input.readBytes());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
|
||||
throw e.setUnfinishedMessage(this);
|
||||
} catch (java.io.IOException e) {
|
||||
throw new com.google.protobuf.InvalidProtocolBufferException(
|
||||
e.getMessage()).setUnfinishedMessage(this);
|
||||
} finally {
|
||||
if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
|
||||
content_ = java.util.Collections.unmodifiableList(content_);
|
||||
}
|
||||
this.unknownFields = unknownFields.build();
|
||||
makeExtensionsImmutable();
|
||||
}
|
||||
}
|
||||
public static final com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptor() {
|
||||
return org.session.libsignal.protos.UtilProtos.internal_static_signalservice_ByteArrayList_descriptor;
|
||||
}
|
||||
|
||||
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
|
||||
internalGetFieldAccessorTable() {
|
||||
return org.session.libsignal.protos.UtilProtos.internal_static_signalservice_ByteArrayList_fieldAccessorTable
|
||||
.ensureFieldAccessorsInitialized(
|
||||
org.session.libsignal.protos.UtilProtos.ByteArrayList.class, org.session.libsignal.protos.UtilProtos.ByteArrayList.Builder.class);
|
||||
}
|
||||
|
||||
public static com.google.protobuf.Parser<ByteArrayList> PARSER =
|
||||
new com.google.protobuf.AbstractParser<ByteArrayList>() {
|
||||
public ByteArrayList parsePartialFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return new ByteArrayList(input, extensionRegistry);
|
||||
}
|
||||
};
|
||||
|
||||
@java.lang.Override
|
||||
public com.google.protobuf.Parser<ByteArrayList> getParserForType() {
|
||||
return PARSER;
|
||||
}
|
||||
|
||||
// repeated bytes content = 1;
|
||||
public static final int CONTENT_FIELD_NUMBER = 1;
|
||||
private java.util.List<com.google.protobuf.ByteString> content_;
|
||||
/**
|
||||
* <code>repeated bytes content = 1;</code>
|
||||
*/
|
||||
public java.util.List<com.google.protobuf.ByteString>
|
||||
getContentList() {
|
||||
return content_;
|
||||
}
|
||||
/**
|
||||
* <code>repeated bytes content = 1;</code>
|
||||
*/
|
||||
public int getContentCount() {
|
||||
return content_.size();
|
||||
}
|
||||
/**
|
||||
* <code>repeated bytes content = 1;</code>
|
||||
*/
|
||||
public com.google.protobuf.ByteString getContent(int index) {
|
||||
return content_.get(index);
|
||||
}
|
||||
|
||||
private void initFields() {
|
||||
content_ = java.util.Collections.emptyList();
|
||||
}
|
||||
private byte memoizedIsInitialized = -1;
|
||||
public final boolean isInitialized() {
|
||||
byte isInitialized = memoizedIsInitialized;
|
||||
if (isInitialized != -1) return isInitialized == 1;
|
||||
|
||||
memoizedIsInitialized = 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void writeTo(com.google.protobuf.CodedOutputStream output)
|
||||
throws java.io.IOException {
|
||||
getSerializedSize();
|
||||
for (int i = 0; i < content_.size(); i++) {
|
||||
output.writeBytes(1, content_.get(i));
|
||||
}
|
||||
getUnknownFields().writeTo(output);
|
||||
}
|
||||
|
||||
private int memoizedSerializedSize = -1;
|
||||
public int getSerializedSize() {
|
||||
int size = memoizedSerializedSize;
|
||||
if (size != -1) return size;
|
||||
|
||||
size = 0;
|
||||
{
|
||||
int dataSize = 0;
|
||||
for (int i = 0; i < content_.size(); i++) {
|
||||
dataSize += com.google.protobuf.CodedOutputStream
|
||||
.computeBytesSizeNoTag(content_.get(i));
|
||||
}
|
||||
size += dataSize;
|
||||
size += 1 * getContentList().size();
|
||||
}
|
||||
size += getUnknownFields().getSerializedSize();
|
||||
memoizedSerializedSize = size;
|
||||
return size;
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 0L;
|
||||
@java.lang.Override
|
||||
protected java.lang.Object writeReplace()
|
||||
throws java.io.ObjectStreamException {
|
||||
return super.writeReplace();
|
||||
}
|
||||
|
||||
public static org.session.libsignal.protos.UtilProtos.ByteArrayList parseFrom(
|
||||
com.google.protobuf.ByteString data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data);
|
||||
}
|
||||
public static org.session.libsignal.protos.UtilProtos.ByteArrayList parseFrom(
|
||||
com.google.protobuf.ByteString data,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data, extensionRegistry);
|
||||
}
|
||||
public static org.session.libsignal.protos.UtilProtos.ByteArrayList parseFrom(byte[] data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data);
|
||||
}
|
||||
public static org.session.libsignal.protos.UtilProtos.ByteArrayList parseFrom(
|
||||
byte[] data,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data, extensionRegistry);
|
||||
}
|
||||
public static org.session.libsignal.protos.UtilProtos.ByteArrayList parseFrom(java.io.InputStream input)
|
||||
throws java.io.IOException {
|
||||
return PARSER.parseFrom(input);
|
||||
}
|
||||
public static org.session.libsignal.protos.UtilProtos.ByteArrayList parseFrom(
|
||||
java.io.InputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
return PARSER.parseFrom(input, extensionRegistry);
|
||||
}
|
||||
public static org.session.libsignal.protos.UtilProtos.ByteArrayList parseDelimitedFrom(java.io.InputStream input)
|
||||
throws java.io.IOException {
|
||||
return PARSER.parseDelimitedFrom(input);
|
||||
}
|
||||
public static org.session.libsignal.protos.UtilProtos.ByteArrayList parseDelimitedFrom(
|
||||
java.io.InputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
return PARSER.parseDelimitedFrom(input, extensionRegistry);
|
||||
}
|
||||
public static org.session.libsignal.protos.UtilProtos.ByteArrayList parseFrom(
|
||||
com.google.protobuf.CodedInputStream input)
|
||||
throws java.io.IOException {
|
||||
return PARSER.parseFrom(input);
|
||||
}
|
||||
public static org.session.libsignal.protos.UtilProtos.ByteArrayList parseFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
return PARSER.parseFrom(input, extensionRegistry);
|
||||
}
|
||||
|
||||
public static Builder newBuilder() { return Builder.create(); }
|
||||
public Builder newBuilderForType() { return newBuilder(); }
|
||||
public static Builder newBuilder(org.session.libsignal.protos.UtilProtos.ByteArrayList prototype) {
|
||||
return newBuilder().mergeFrom(prototype);
|
||||
}
|
||||
public Builder toBuilder() { return newBuilder(this); }
|
||||
|
||||
@java.lang.Override
|
||||
protected Builder newBuilderForType(
|
||||
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
|
||||
Builder builder = new Builder(parent);
|
||||
return builder;
|
||||
}
|
||||
/**
|
||||
* Protobuf type {@code signalservice.ByteArrayList}
|
||||
*/
|
||||
public static final class Builder extends
|
||||
com.google.protobuf.GeneratedMessage.Builder<Builder>
|
||||
implements org.session.libsignal.protos.UtilProtos.ByteArrayListOrBuilder {
|
||||
public static final com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptor() {
|
||||
return org.session.libsignal.protos.UtilProtos.internal_static_signalservice_ByteArrayList_descriptor;
|
||||
}
|
||||
|
||||
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
|
||||
internalGetFieldAccessorTable() {
|
||||
return org.session.libsignal.protos.UtilProtos.internal_static_signalservice_ByteArrayList_fieldAccessorTable
|
||||
.ensureFieldAccessorsInitialized(
|
||||
org.session.libsignal.protos.UtilProtos.ByteArrayList.class, org.session.libsignal.protos.UtilProtos.ByteArrayList.Builder.class);
|
||||
}
|
||||
|
||||
// Construct using org.session.libsignal.protos.UtilProtos.ByteArrayList.newBuilder()
|
||||
private Builder() {
|
||||
maybeForceBuilderInitialization();
|
||||
}
|
||||
|
||||
private Builder(
|
||||
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
|
||||
super(parent);
|
||||
maybeForceBuilderInitialization();
|
||||
}
|
||||
private void maybeForceBuilderInitialization() {
|
||||
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
|
||||
}
|
||||
}
|
||||
private static Builder create() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public Builder clear() {
|
||||
super.clear();
|
||||
content_ = java.util.Collections.emptyList();
|
||||
bitField0_ = (bitField0_ & ~0x00000001);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder clone() {
|
||||
return create().mergeFrom(buildPartial());
|
||||
}
|
||||
|
||||
public com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptorForType() {
|
||||
return org.session.libsignal.protos.UtilProtos.internal_static_signalservice_ByteArrayList_descriptor;
|
||||
}
|
||||
|
||||
public org.session.libsignal.protos.UtilProtos.ByteArrayList getDefaultInstanceForType() {
|
||||
return org.session.libsignal.protos.UtilProtos.ByteArrayList.getDefaultInstance();
|
||||
}
|
||||
|
||||
public org.session.libsignal.protos.UtilProtos.ByteArrayList build() {
|
||||
org.session.libsignal.protos.UtilProtos.ByteArrayList result = buildPartial();
|
||||
if (!result.isInitialized()) {
|
||||
throw newUninitializedMessageException(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public org.session.libsignal.protos.UtilProtos.ByteArrayList buildPartial() {
|
||||
org.session.libsignal.protos.UtilProtos.ByteArrayList result = new org.session.libsignal.protos.UtilProtos.ByteArrayList(this);
|
||||
int from_bitField0_ = bitField0_;
|
||||
if (((bitField0_ & 0x00000001) == 0x00000001)) {
|
||||
content_ = java.util.Collections.unmodifiableList(content_);
|
||||
bitField0_ = (bitField0_ & ~0x00000001);
|
||||
}
|
||||
result.content_ = content_;
|
||||
onBuilt();
|
||||
return result;
|
||||
}
|
||||
|
||||
public Builder mergeFrom(com.google.protobuf.Message other) {
|
||||
if (other instanceof org.session.libsignal.protos.UtilProtos.ByteArrayList) {
|
||||
return mergeFrom((org.session.libsignal.protos.UtilProtos.ByteArrayList)other);
|
||||
} else {
|
||||
super.mergeFrom(other);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public Builder mergeFrom(org.session.libsignal.protos.UtilProtos.ByteArrayList other) {
|
||||
if (other == org.session.libsignal.protos.UtilProtos.ByteArrayList.getDefaultInstance()) return this;
|
||||
if (!other.content_.isEmpty()) {
|
||||
if (content_.isEmpty()) {
|
||||
content_ = other.content_;
|
||||
bitField0_ = (bitField0_ & ~0x00000001);
|
||||
} else {
|
||||
ensureContentIsMutable();
|
||||
content_.addAll(other.content_);
|
||||
}
|
||||
onChanged();
|
||||
}
|
||||
this.mergeUnknownFields(other.getUnknownFields());
|
||||
return this;
|
||||
}
|
||||
|
||||
public final boolean isInitialized() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public Builder mergeFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
org.session.libsignal.protos.UtilProtos.ByteArrayList parsedMessage = null;
|
||||
try {
|
||||
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
|
||||
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
|
||||
parsedMessage = (org.session.libsignal.protos.UtilProtos.ByteArrayList) e.getUnfinishedMessage();
|
||||
throw e;
|
||||
} finally {
|
||||
if (parsedMessage != null) {
|
||||
mergeFrom(parsedMessage);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
private int bitField0_;
|
||||
|
||||
// repeated bytes content = 1;
|
||||
private java.util.List<com.google.protobuf.ByteString> content_ = java.util.Collections.emptyList();
|
||||
private void ensureContentIsMutable() {
|
||||
if (!((bitField0_ & 0x00000001) == 0x00000001)) {
|
||||
content_ = new java.util.ArrayList<com.google.protobuf.ByteString>(content_);
|
||||
bitField0_ |= 0x00000001;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>repeated bytes content = 1;</code>
|
||||
*/
|
||||
public java.util.List<com.google.protobuf.ByteString>
|
||||
getContentList() {
|
||||
return java.util.Collections.unmodifiableList(content_);
|
||||
}
|
||||
/**
|
||||
* <code>repeated bytes content = 1;</code>
|
||||
*/
|
||||
public int getContentCount() {
|
||||
return content_.size();
|
||||
}
|
||||
/**
|
||||
* <code>repeated bytes content = 1;</code>
|
||||
*/
|
||||
public com.google.protobuf.ByteString getContent(int index) {
|
||||
return content_.get(index);
|
||||
}
|
||||
/**
|
||||
* <code>repeated bytes content = 1;</code>
|
||||
*/
|
||||
public Builder setContent(
|
||||
int index, com.google.protobuf.ByteString value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
ensureContentIsMutable();
|
||||
content_.set(index, value);
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>repeated bytes content = 1;</code>
|
||||
*/
|
||||
public Builder addContent(com.google.protobuf.ByteString value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
ensureContentIsMutable();
|
||||
content_.add(value);
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>repeated bytes content = 1;</code>
|
||||
*/
|
||||
public Builder addAllContent(
|
||||
java.lang.Iterable<? extends com.google.protobuf.ByteString> values) {
|
||||
ensureContentIsMutable();
|
||||
super.addAll(values, content_);
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>repeated bytes content = 1;</code>
|
||||
*/
|
||||
public Builder clearContent() {
|
||||
content_ = java.util.Collections.emptyList();
|
||||
bitField0_ = (bitField0_ & ~0x00000001);
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(builder_scope:signalservice.ByteArrayList)
|
||||
}
|
||||
|
||||
static {
|
||||
defaultInstance = new ByteArrayList(true);
|
||||
defaultInstance.initFields();
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(class_scope:signalservice.ByteArrayList)
|
||||
}
|
||||
|
||||
private static com.google.protobuf.Descriptors.Descriptor
|
||||
internal_static_signalservice_ByteArrayList_descriptor;
|
||||
private static
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable
|
||||
internal_static_signalservice_ByteArrayList_fieldAccessorTable;
|
||||
|
||||
public static com.google.protobuf.Descriptors.FileDescriptor
|
||||
getDescriptor() {
|
||||
return descriptor;
|
||||
}
|
||||
private static com.google.protobuf.Descriptors.FileDescriptor
|
||||
descriptor;
|
||||
static {
|
||||
java.lang.String[] descriptorData = {
|
||||
"\n\013Utils.proto\022\rsignalservice\" \n\rByteArra" +
|
||||
"yList\022\017\n\007content\030\001 \003(\014B*\n\034org.session.li" +
|
||||
"bsignal.protosB\nUtilProtos"
|
||||
};
|
||||
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
|
||||
public com.google.protobuf.ExtensionRegistry assignDescriptors(
|
||||
com.google.protobuf.Descriptors.FileDescriptor root) {
|
||||
descriptor = root;
|
||||
internal_static_signalservice_ByteArrayList_descriptor =
|
||||
getDescriptor().getMessageTypes().get(0);
|
||||
internal_static_signalservice_ByteArrayList_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_signalservice_ByteArrayList_descriptor,
|
||||
new java.lang.String[] { "Content", });
|
||||
return null;
|
||||
}
|
||||
};
|
||||
com.google.protobuf.Descriptors.FileDescriptor
|
||||
.internalBuildGeneratedFileFrom(descriptorData,
|
||||
new com.google.protobuf.Descriptors.FileDescriptor[] {
|
||||
}, assigner);
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(outer_class_scope)
|
||||
}
|
Reference in New Issue
Block a user