Skip to content

Commit

Permalink
[Java]: clean up build for maven upload. Clean up javadoc.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmontgomery committed Jul 9, 2015
1 parent a864428 commit a7f5b8d
Show file tree
Hide file tree
Showing 22 changed files with 322 additions and 303 deletions.
15 changes: 15 additions & 0 deletions aeron-all/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright 2014 - 2015 Real Logic Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ public static int indexByTermCount(final int termCount)
* Determine the partition index given a stream position.
*
* @param position in the stream in bytes.
* @param positionBitsToShift number of times to right shift the position for term count
* @return the partition index for the position
*/
public static int indexByPosition(final long position, final int positionBitsToShift)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public int maxFrameLength()
* @param srcOffset at which the encoded message begins.
* @param length of the message in bytes.
* @return the resulting termOffset on success otherwise {@link #FAILED} if beyond end of the term, or
* {@link #TRIPPED if first failure.
* {@link #TRIPPED} if first failure.
* @throws IllegalArgumentException if the length is greater than {@link #maxMessageLength()}
*/
public int append(final DirectBuffer srcBuffer, final int srcOffset, final int length)
Expand Down Expand Up @@ -151,7 +151,7 @@ public int append(final DirectBuffer srcBuffer, final int srcOffset, final int l
* @param length of the message payload
* @param bufferClaim to be completed for the claim if successful.
* @return the resulting termOffset on success otherwise {@link #FAILED} if beyond end of the term, or
* {@link #TRIPPED if first failure.
* {@link #TRIPPED} if first failure.
*/
public int claim(final int length, final BufferClaim bufferClaim)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public class Configuration
public static final String DO_NOT_SEND_NAK_PROP_NAME = "aeron.driver.disable.naks";

/**
* how often to check liveness & cleanup
* how often to check liveness and cleanup
*/
public static final long HEARTBEAT_TIMEOUT_NS = TimeUnit.SECONDS.toNanos(1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ public int rebuildOffset()
* <p>
* The handler keeps track from scan to scan what is a gap and what must have been repaired.
*
* @param termBuffer to scan
* @param rebuildPosition to start scanning from
* @param hwmPosition to scan up to
* @param now time in nanoseconds
* @param termLengthMask used for offset calculation
* @param positionBitsToShift used for position calculation
* @param initialTermId used by the scanner
* @return the work count for this operation.
*/
public int scan(
Expand Down Expand Up @@ -116,6 +123,7 @@ public int scan(
/**
* Called on reception of a NAK
*
* @param now time in nanoseconds
* @param termId in the NAK
* @param termOffset in the NAK
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public static void loadPropertiesFile(final String filename)
* Start Media Driver as a stand-alone process.
*
* @param args command line arguments
* @throws Exception if an error occurs
*/
public static void main(final String[] args) throws Exception
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ public void senderPositionLimit(final long positionLimit)

/**
* This is performed on the {@link DriverConductor} thread
*
* @return amount of work done
*/
public int cleanLogBuffer()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class NetworkUtil
* @param subnetPrefix to limit the search.
* @return {@link NetworkInterface}s that match the supplied criteria, ordered by the length
* of the subnet prefix. Empty if none match.
* @throws SocketException
* @throws SocketException if an error occurs
*/
public static Collection<NetworkInterface> filterBySubnet(final InetAddress address, final int subnetPrefix)
throws SocketException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,9 @@ public Status status()
/**
* Set status of the image.
* <p>
* Set by {@link Receiver} for INIT -> ACTIVE -> INACTIVE
* Set by {@link Receiver} for INIT to ACTIVE to INACTIVE
* <p>
* Set by {@link DriverConductor} for INACTIVE -> LINGER
* Set by {@link DriverConductor} for INACTIVE to LINGER
*
* @param status of the image
*/
Expand Down Expand Up @@ -388,6 +388,8 @@ public int trackRebuild(final long now)
/**
* Insert frame into term buffer.
*
* @param termId for the data packet to insert into the appropriate term.
* @param termOffset for the start of the packet in the term.
* @param buffer for the data packet to insert into the appropriate term.
* @param length of the data packet
* @return number of bytes applied as a result of this insertion.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public class RetransmitHandler
* @param systemCounters for recording significant events.
* @param delayGenerator to use for delay determination
* @param lingerTimeoutGenerator to use for linger timeout
* @param initialTermId to use for the retransmission
* @param capacity of the term buffer
*/
public RetransmitHandler(
final NanoClock nanoClock,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,8 @@ public String toString()
* The general format is:
* UDP-interface-localPort-remoteAddress-remotePort
*
* @param localData for the channel
* @param remoteData for the channel
* @return canonical representation as a string
*/
public static String canonicalise(final InetSocketAddress localData, final InetSocketAddress remoteData)
Expand All @@ -406,7 +408,7 @@ public boolean isMulticast()
* Local interface to be used by the channel
*
* @return {@link NetworkInterface} for the local interface used by the channel
* @throws SocketException
* @throws SocketException if an error occurs
*/
public NetworkInterface localInterface() throws SocketException
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public static void eventInactiveImage(
*
* @param streamId to show when printing
* @return subscription data handler function that prints the message contents
* @throws Exception
* @throws Exception if an error occurs
*/
public static FragmentHandler reassembledStringMessage1(final int streamId) throws Exception
{
Expand Down Expand Up @@ -164,6 +164,7 @@ public static FragmentHandler reassembledStringMessage1(final int streamId) thro
*
* @param streamId to show when printing
* @return subscription data handler function that prints the message contents
* @throws Exception if an error occurs
*/
public static FragmentHandler reassembledStringMessage2(final int streamId) throws Exception
{
Expand Down
109 changes: 33 additions & 76 deletions aeron-tools/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,90 +14,47 @@
* limitations under the License.
*/

apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'eclipse'

defaultTasks 'clean', 'build', 'install'

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:0.8'
classpath 'com.puppycrawl.tools:checkstyle:6.7'
task stats(type:JavaExec) {
main = 'uk.co.real_logic.aeron.tools.StatsDriver'
classpath = sourceSets.main.runtimeClasspath
systemProperties(System.properties);
if (project.hasProperty('myargs')) {
args(myargs.split(','))
}
}

project(':aeron-tools') {
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'checkstyle'
apply plugin: 'shadow'

compileJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}

[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'

dependencies {
compile project(':aeron-client'), project(':aeron-driver'), project(':aeron-samples')
compile 'commons-cli:commons-cli:1.2'
}

shadow {
outputFile = new File('aeron-tools/build/libs/tools.jar')
}

task stats(type:JavaExec) {
main = 'uk.co.real_logic.aeron.tools.StatsDriver'
classpath = sourceSets.main.runtimeClasspath
systemProperties(System.properties);
if (project.hasProperty('myargs')) {
args(myargs.split(','))
}
}

task ping(type:JavaExec) {
main = 'uk.co.real_logic.aeron.tools.perf_tools.AeronPing'
classpath = sourceSets.main.runtimeClasspath
systemProperties(System.properties);
if (project.hasProperty('myargs')) {
args(myargs.split(','))
}
}

task pong(type:JavaExec) {
main = 'uk.co.real_logic.aeron.tools.perf_tools.AeronPong'
classpath = sourceSets.main.runtimeClasspath
systemProperties(System.properties);
if (project.hasProperty('myargs')) {
args(myargs.split(','))
}
task ping(type:JavaExec) {
main = 'uk.co.real_logic.aeron.tools.perf_tools.AeronPing'
classpath = sourceSets.main.runtimeClasspath
systemProperties(System.properties);
if (project.hasProperty('myargs')) {
args(myargs.split(','))
}
}

task latencyUnderLoadPub(type:JavaExec) {
main = 'uk.co.real_logic.aeron.tools.perf_tools.AeronLatencyUnderLoadPublisher'
classpath = sourceSets.main.runtimeClasspath
systemProperties(System.properties);
if (project.hasProperty('myargs')) {
args(myargs.split(','))
}
task pong(type:JavaExec) {
main = 'uk.co.real_logic.aeron.tools.perf_tools.AeronPong'
classpath = sourceSets.main.runtimeClasspath
systemProperties(System.properties);
if (project.hasProperty('myargs')) {
args(myargs.split(','))
}
}

task latencyUnderLoadSub(type:JavaExec) {
main = 'uk.co.real_logic.aeron.tools.perf_tools.AeronLatencyUnderLoadSubscriber'
classpath = sourceSets.main.runtimeClasspath
systemProperties(System.properties);
if (project.hasProperty('myargs')) {
args(myargs.split(','))
}
task latencyUnderLoadPub(type:JavaExec) {
main = 'uk.co.real_logic.aeron.tools.perf_tools.AeronLatencyUnderLoadPublisher'
classpath = sourceSets.main.runtimeClasspath
systemProperties(System.properties);
if (project.hasProperty('myargs')) {
args(myargs.split(','))
}
}

build.doLast {
tasks.shadowJar.execute()
task latencyUnderLoadSub(type:JavaExec) {
main = 'uk.co.real_logic.aeron.tools.perf_tools.AeronLatencyUnderLoadSubscriber'
classpath = sourceSets.main.runtimeClasspath
systemProperties(System.properties);
if (project.hasProperty('myargs')) {
args(myargs.split(','))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ final class MessageSizeEntry
private int patternMinSize = Integer.MAX_VALUE;
/* maximum size starts at min value so it can be set higher */
private int patternMaxSize = 0;
private final List<MessageSizeEntry> entries = new ArrayList<MessageSizeEntry>();
private final List<MessageSizeEntry> entries = new ArrayList<>();

/**
* Instantiate a MessageSizePattern and always return the given message size.
*
* @param messageSize
* @param messageSize to use
* @throws Exception when message size is invalid
*/
public MessageSizePattern(final int messageSize) throws Exception
Expand All @@ -66,8 +66,9 @@ public MessageSizePattern(final int messageSize) throws Exception
/**
* Instantiate a MessageSizePattern with a number of messages and their size.
*
* @param messageCount
* @param messageSize
* @param messageCount to use
* @param messageSize to use
* @throws Exception if an error occurs
*/
public MessageSizePattern(final long messageCount, final int messageSize) throws Exception
{
Expand All @@ -77,9 +78,10 @@ public MessageSizePattern(final long messageCount, final int messageSize) throws
/**
* Instantiate a MessageCount with a number of message, and random size range.
*
* @param messageCount
* @param minSize
* @param maxSize
* @param messageCount to use
* @param minSize to use
* @param maxSize to use
* @throws Exception if an error occurs
*/
public MessageSizePattern(final long messageCount, final int minSize, final int maxSize) throws Exception
{
Expand All @@ -105,9 +107,9 @@ public MessageSizePattern(final MessageSizePattern original)
/**
* Add a number of messages with the given size to the pattern.
*
* @param messageCount
* @param size
* @throws Exception
* @param messageCount to use
* @param size to use
* @throws Exception if an error occurs
*/
public void addPatternEntry(final long messageCount, final int size) throws Exception
{
Expand Down Expand Up @@ -213,7 +215,7 @@ public int maximum()
/**
* Get the range minimum value of the current message.
*
* @return
* @return current range min
*/
public int currentRangeMinimum()
{
Expand All @@ -223,7 +225,7 @@ public int currentRangeMinimum()
/**
* Get the range maximum value of the current message.
*
* @return
* @return curren range max
*/
public int currentRangeMaximum()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ public static void printHex(final DirectBuffer buffer, final int offset, final i
*
* @param buffer The buffer to write a message to.
* @return number of bytes written
* @throws Exception
* @throws Exception if an errors occurs
*/
public int getNext(final UnsafeBuffer buffer) throws Exception
{
Expand Down Expand Up @@ -387,7 +387,7 @@ private void checkConstraints(final UnsafeBuffer buffer, final int size) throws
* @param buffer The buffer to write a message to.
* @param size The length of the message to write, in bytes
* @return number of bytes written
* @throws Exception
* @throws Exception if an error occurs
*/
public int getNext(final UnsafeBuffer buffer, final int size) throws Exception
{
Expand Down
Loading

0 comments on commit a7f5b8d

Please sign in to comment.