Skip to content

Commit

Permalink
Cleanup Read/Write Context
Browse files Browse the repository at this point in the history
  • Loading branch information
lburgazzoli committed Oct 29, 2015
1 parent 8cb0ba8 commit 2025a65
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
Expand Up @@ -164,7 +164,7 @@ private WireStore store() throws IOException {

this.cycle = nextCycle;
this.store = queue.storeForCycle(this.cycle);
this.context.clear();
this.store.acquireBytesAtWritePositionForWrite(this.context.bytes);
}

return this.store;
Expand Down
Expand Up @@ -187,17 +187,6 @@ public long read(@NotNull ReadContext context, @NotNull ReadMarshallable reader)
mappedFile.acquireBytesForRead(position, context.bytes);
}

/*
long position = context.position();
if (position > context.bytes.safeLimit()) {
mappedFile.acquireBytesForRead(position, context.bytes);
context.position(position);
} else if(context.bytes.readLimit() == 0) {
mappedFile.acquireBytesForRead(position, context.bytes);
context.position(position);
}
*/

final int spbHeader = context.bytes.readVolatileInt(position);
if(!Wires.isNotInitialized(spbHeader) && Wires.isReady(spbHeader)) {
int len = Wires.lengthOf(spbHeader);
Expand Down Expand Up @@ -331,10 +320,10 @@ protected void checkRemainingForAppend(long position, long size) {

//TODO move to wire
@ForceInline
static long readWire(@NotNull WireIn wireIn, int len, @NotNull ReadMarshallable dataConsumer) {
static long readWire(@NotNull WireIn wireIn, long len, @NotNull ReadMarshallable dataConsumer) {
final Bytes<?> bytes = wireIn.bytes();
final long limit0 = bytes.readLimit();
final long limit = bytes.readPosition() + (long) len;
final long limit = bytes.readPosition() + len;
try {
bytes.readLimit(limit);
dataConsumer.readMarshallable(wireIn);
Expand Down

0 comments on commit 2025a65

Please sign in to comment.