tidy up cap table in BuilderArena
This commit is contained in:
parent
caa4441a65
commit
e19faf0b81
1 changed files with 10 additions and 11 deletions
|
@ -39,14 +39,14 @@ public final class BuilderArena implements Arena {
|
||||||
public final ArrayList<SegmentBuilder> segments;
|
public final ArrayList<SegmentBuilder> segments;
|
||||||
private Allocator allocator;
|
private Allocator allocator;
|
||||||
|
|
||||||
private CapTableBuilder localCapTable = new CapTableBuilder() {
|
private final CapTableBuilder localCapTable = new CapTableBuilder() {
|
||||||
|
|
||||||
List<ClientHook> capTable = new ArrayList<>();
|
private final List<ClientHook> capTable = new ArrayList<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int injectCap(ClientHook cap) {
|
public int injectCap(ClientHook cap) {
|
||||||
int result = this.capTable.size();
|
int result = this.capTable.size();
|
||||||
capTable.add(cap);
|
this.capTable.add(cap);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,6 @@ public final class BuilderArena implements Arena {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.capTable.set(index, null);
|
this.capTable.set(index, null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -94,16 +93,16 @@ public final class BuilderArena implements Arena {
|
||||||
this.allocator = allocator;
|
this.allocator = allocator;
|
||||||
}
|
}
|
||||||
|
|
||||||
CapTableBuilder getLocalCapTable() {
|
/**
|
||||||
|
* Return a CapTableBuilder that merely implements local loopback. That is, you can set
|
||||||
|
* capabilities, then read the same capabilities back, but there is no intent ever to transmit
|
||||||
|
* these capabilities. A MessageBuilder that isn't imbued with some other CapTable uses this
|
||||||
|
* by default.
|
||||||
|
*/
|
||||||
|
public CapTableBuilder getLocalCapTable() {
|
||||||
return this.localCapTable;
|
return this.localCapTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
CapTableBuilder releaseLocalCapTable() {
|
|
||||||
var tmp = this.localCapTable;
|
|
||||||
this.localCapTable = null;
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final SegmentReader tryGetSegment(int id) {
|
public final SegmentReader tryGetSegment(int id) {
|
||||||
return this.segments.get(id);
|
return this.segments.get(id);
|
||||||
|
|
Loading…
Reference in a new issue