Skip to content

Commit

Permalink
[Java] Minor tidy ups.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjpt777 committed Jun 24, 2017
1 parent ce3f3e1 commit 7debe75
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ private void startRecording(final Image image)
notificationsProxy,
image,
recordingContext);

recordingSessionByIdMap.put(recordingId, session);
recorder.addSession(session);
}
Expand Down
9 changes: 3 additions & 6 deletions aeron-archiver/src/main/java/io/aeron/archiver/Catalog.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,14 @@ class Catalog implements AutoCloseable
private static final int PAGE_SIZE = 4096;

private final RecordingDescriptorEncoder recordingDescriptorEncoder = new RecordingDescriptorEncoder();

private final ByteBuffer byteBuffer;
private final UnsafeBuffer unsafeBuffer;
private final ByteBuffer byteBuffer = BufferUtil.allocateDirectAligned(RECORD_LENGTH, PAGE_SIZE);
private final UnsafeBuffer unsafeBuffer = new UnsafeBuffer(byteBuffer);
private final FileChannel catalogFileChannel;

private long nextRecordingId = 0;

Catalog(final File archiveDir)
{
byteBuffer = BufferUtil.allocateDirectAligned(RECORD_LENGTH, PAGE_SIZE);
unsafeBuffer = new UnsafeBuffer(byteBuffer);

FileChannel channel = null;
try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

class ControlSession implements Session, ControlRequestListener
{

enum State
{
INIT, ACTIVE, INACTIVE, CLOSED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
class RecordingWriter implements AutoCloseable, RawBlockHandler
{
private static final boolean VALIDATE_POSITION_ASSUMPTIONS = true;

static class Marker
{
private final ByteBuffer buffer =
Expand Down Expand Up @@ -286,7 +287,6 @@ void writeFragment(final DirectBuffer buffer, final Header header)
}
}


public void close()
{
if (closed)
Expand Down Expand Up @@ -446,7 +446,7 @@ private void validateStartTermOffset(final int termOffset)
{
if (VALIDATE_POSITION_ASSUMPTIONS)
{
final int expectedStartTermOffset = (int) (joinPosition & (termBufferLength - 1));
final int expectedStartTermOffset = (int)(joinPosition & (termBufferLength - 1));
if (expectedStartTermOffset != termOffset)
{
throw new IllegalStateException();
Expand All @@ -462,6 +462,7 @@ private void validateWritePreConditions(final int termId, final int termOffset)
{
throw new IllegalStateException();
}

final int recordingOffset = recordingOffset(
termOffset,
termId,
Expand Down Expand Up @@ -492,7 +493,7 @@ static class RecordingContext
private File archiveDir;
private EpochClock epochClock;
private boolean forceWrites = true;
private int segmentFileLength = 128 * 1024 * 1024;
private int segmentFileLength = 1024 * 1024 * 1024;

RecordingContext archiveDir(final File archiveDir)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@
* <li>Stream recorded data into the replayPublication {@link ExclusivePublication}</li>
* </ul>
*/
class ReplaySession
implements Session, RecordingFragmentReader.SimplifiedControlledPoll
class ReplaySession implements Session, RecordingFragmentReader.SimplifiedControlledPoll
{
enum State
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* limitations under the License.
*
*/

package io.aeron.archiver;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* limitations under the License.
*
*/

package io.aeron.archiver;

import org.agrona.collections.ArrayListUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* limitations under the License.
*
*/

package io.aeron.archiver;

import io.aeron.Aeron;
Expand Down

0 comments on commit 7debe75

Please sign in to comment.