diff --git a/aeron-all/build.gradle b/aeron-all/build.gradle new file mode 100644 index 0000000000..ec30006d8b --- /dev/null +++ b/aeron-all/build.gradle @@ -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. + */ diff --git a/aeron-client/src/main/java/uk/co/real_logic/aeron/logbuffer/LogBufferDescriptor.java b/aeron-client/src/main/java/uk/co/real_logic/aeron/logbuffer/LogBufferDescriptor.java index 0343ee2f08..c7b1ee401f 100644 --- a/aeron-client/src/main/java/uk/co/real_logic/aeron/logbuffer/LogBufferDescriptor.java +++ b/aeron-client/src/main/java/uk/co/real_logic/aeron/logbuffer/LogBufferDescriptor.java @@ -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) diff --git a/aeron-client/src/main/java/uk/co/real_logic/aeron/logbuffer/TermAppender.java b/aeron-client/src/main/java/uk/co/real_logic/aeron/logbuffer/TermAppender.java index a3daf60fc0..873370d2d2 100644 --- a/aeron-client/src/main/java/uk/co/real_logic/aeron/logbuffer/TermAppender.java +++ b/aeron-client/src/main/java/uk/co/real_logic/aeron/logbuffer/TermAppender.java @@ -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) @@ -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) { diff --git a/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/Configuration.java b/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/Configuration.java index 85228508af..d358963fa6 100644 --- a/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/Configuration.java +++ b/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/Configuration.java @@ -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); diff --git a/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/LossDetector.java b/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/LossDetector.java index 85bf542e61..fdaded8343 100644 --- a/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/LossDetector.java +++ b/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/LossDetector.java @@ -64,6 +64,13 @@ public int rebuildOffset() *

* 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( @@ -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 */ diff --git a/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/MediaDriver.java b/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/MediaDriver.java index 623e056017..fc40a71a11 100644 --- a/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/MediaDriver.java +++ b/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/MediaDriver.java @@ -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 { diff --git a/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/NetworkPublication.java b/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/NetworkPublication.java index 48ad5aa463..8d92885a31 100644 --- a/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/NetworkPublication.java +++ b/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/NetworkPublication.java @@ -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() { diff --git a/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/NetworkUtil.java b/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/NetworkUtil.java index da2343b41e..09673f0afa 100644 --- a/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/NetworkUtil.java +++ b/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/NetworkUtil.java @@ -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 filterBySubnet(final InetAddress address, final int subnetPrefix) throws SocketException diff --git a/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/NetworkedImage.java b/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/NetworkedImage.java index ba160c72dd..0a4b2bd5fa 100644 --- a/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/NetworkedImage.java +++ b/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/NetworkedImage.java @@ -262,9 +262,9 @@ public Status status() /** * Set status of the image. *

- * Set by {@link Receiver} for INIT -> ACTIVE -> INACTIVE + * Set by {@link Receiver} for INIT to ACTIVE to INACTIVE *

- * Set by {@link DriverConductor} for INACTIVE -> LINGER + * Set by {@link DriverConductor} for INACTIVE to LINGER * * @param status of the image */ @@ -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. diff --git a/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/RetransmitHandler.java b/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/RetransmitHandler.java index aa9331c950..2f64c4277b 100644 --- a/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/RetransmitHandler.java +++ b/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/RetransmitHandler.java @@ -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, diff --git a/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/media/UdpChannel.java b/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/media/UdpChannel.java index e8055a1fa4..3cd0f33c9a 100644 --- a/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/media/UdpChannel.java +++ b/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/media/UdpChannel.java @@ -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) @@ -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 { diff --git a/aeron-samples/src/main/java/uk/co/real_logic/aeron/samples/MultipleSubscribersWithFragmentAssembly.java b/aeron-samples/src/main/java/uk/co/real_logic/aeron/samples/MultipleSubscribersWithFragmentAssembly.java index c03ac2bcbb..593498f10b 100644 --- a/aeron-samples/src/main/java/uk/co/real_logic/aeron/samples/MultipleSubscribersWithFragmentAssembly.java +++ b/aeron-samples/src/main/java/uk/co/real_logic/aeron/samples/MultipleSubscribersWithFragmentAssembly.java @@ -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 { @@ -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 { diff --git a/aeron-tools/build.gradle b/aeron-tools/build.gradle index 02fc50aeb9..3d4ee82c82 100644 --- a/aeron-tools/build.gradle +++ b/aeron-tools/build.gradle @@ -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(',')) } } diff --git a/aeron-tools/src/main/java/uk/co/real_logic/aeron/tools/MessageSizePattern.java b/aeron-tools/src/main/java/uk/co/real_logic/aeron/tools/MessageSizePattern.java index 91bce48e72..c79aaa786b 100644 --- a/aeron-tools/src/main/java/uk/co/real_logic/aeron/tools/MessageSizePattern.java +++ b/aeron-tools/src/main/java/uk/co/real_logic/aeron/tools/MessageSizePattern.java @@ -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 entries = new ArrayList(); + private final List 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 @@ -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 { @@ -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 { @@ -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 { @@ -213,7 +215,7 @@ public int maximum() /** * Get the range minimum value of the current message. * - * @return + * @return current range min */ public int currentRangeMinimum() { @@ -223,7 +225,7 @@ public int currentRangeMinimum() /** * Get the range maximum value of the current message. * - * @return + * @return curren range max */ public int currentRangeMaximum() { diff --git a/aeron-tools/src/main/java/uk/co/real_logic/aeron/tools/MessageStream.java b/aeron-tools/src/main/java/uk/co/real_logic/aeron/tools/MessageStream.java index 5a62001bb3..e3743f583d 100644 --- a/aeron-tools/src/main/java/uk/co/real_logic/aeron/tools/MessageStream.java +++ b/aeron-tools/src/main/java/uk/co/real_logic/aeron/tools/MessageStream.java @@ -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 { @@ -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 { diff --git a/aeron-tools/src/main/java/uk/co/real_logic/aeron/tools/PubSubOptions.java b/aeron-tools/src/main/java/uk/co/real_logic/aeron/tools/PubSubOptions.java index 2e5d012cbe..02dac7c3ee 100644 --- a/aeron-tools/src/main/java/uk/co/real_logic/aeron/tools/PubSubOptions.java +++ b/aeron-tools/src/main/java/uk/co/real_logic/aeron/tools/PubSubOptions.java @@ -150,8 +150,8 @@ public PubSubOptions() sizePattern = null; input = null; output = null; - channels = new ArrayList(); - rateIntervals = new ArrayList(); + channels = new ArrayList<>(); + rateIntervals = new ArrayList<>(); } /** @@ -183,8 +183,8 @@ public void clear() /** * Helper function to add a single port to a channel string. - * @param port - * @return + * @param port to use + * @return string */ String getChannelWithPort(final int port) { @@ -282,7 +282,7 @@ private static final class OptionValuesStruct * also call #close(). * @param args Command line arguments * @return 0 when options parsed, 1 if program should call {@link #printHelp(String)}. - * @throws ParseException + * @throws ParseException if an error occurs */ public int parseArgs(final String[] args) throws ParseException { @@ -369,7 +369,7 @@ public void printHelp(final String program) /** * Get the list of channels on which to publish or subscribe. - * @return + * @return channels */ public List channels() { @@ -378,7 +378,7 @@ public List channels() /** * Set the list of channels on which to publish or subscribe - * @param channels + * @param channels to use */ public void channels(final List channels) { @@ -387,7 +387,7 @@ public void channels(final List channels) /** * Get the output stream where a subscriber will write received data. - * @return + * @return output stream */ public OutputStream output() { @@ -396,7 +396,7 @@ public OutputStream output() /** * Set the output stream where a subscriber will write received data. - * @param output + * @param output to use */ public void output(final OutputStream output) { @@ -405,7 +405,7 @@ public void output(final OutputStream output) /** * Get the input stream that a Publisher will read for data to send. - * @return + * @return input stream */ public InputStream input() { @@ -414,7 +414,7 @@ public InputStream input() /** * Get if messages use additional space to store checksums for the message and stream. - * @return + * @return true if verify */ public boolean verify() { @@ -423,7 +423,7 @@ public boolean verify() /** * Set if messages use additional space to store checksums for the message and stream. - * @param verify + * @param verify or not */ public void verify(final boolean verify) { @@ -432,7 +432,7 @@ public void verify(final boolean verify) /** * Set the input stream that a Publisher will read for data to send. - * @param input + * @param input stream to use */ public void input(final InputStream input) { @@ -451,7 +451,7 @@ public List rateIntervals() /** * Get the number of threads for the application to use. - * @return + * @return threads */ public int threads() { @@ -478,7 +478,7 @@ public long messages() /** * Set the total number of messages an application will send or receive before exiting. - * @param messages + * @param messages to sue */ public void messages(final long messages) { @@ -487,7 +487,7 @@ public void messages(final long messages) /** * The number of times to run the rate sequence. - * @return + * @return iterations */ public long iterations() { @@ -496,7 +496,7 @@ public long iterations() /** * The seed for a random number generator. - * @return + * @return random seed */ public long randomSeed() { @@ -505,7 +505,7 @@ public long randomSeed() /** * Set the seed for a random number generator. - * @param value + * @param value to use */ public void randomSeed(final long value) { @@ -514,7 +514,7 @@ public void randomSeed(final long value) /** * Set the number of times to run the rate sequence. - * @param value + * @param value iterations */ public void iterations(final long value) { @@ -523,7 +523,7 @@ public void iterations(final long value) /** * True when application should use an embedded Aeron media driver. - * @return + * @return true if embedded */ public boolean useEmbeddedDriver() { @@ -532,7 +532,7 @@ public boolean useEmbeddedDriver() /** * Set the use of an embedded Aeron media driver. - * @param embedded + * @param embedded true if embedded */ public void useEmbeddedDriver(final boolean embedded) { @@ -542,7 +542,7 @@ public void useEmbeddedDriver(final boolean embedded) /** * Enable or disable the use of a specific session ID. * @see #sessionId(int) - * @param enabled + * @param enabled true if use session Id */ public void useSessionId(final boolean enabled) { @@ -563,7 +563,7 @@ public boolean useSessionId() /** * Set the session ID to be used when #useSessionId() returns true. * @see #useSessionId #sessionId(boolean) - * @param id + * @param id to use */ public void sessionId(final int id) { @@ -581,7 +581,7 @@ public int sessionId() /** * Get the message size pattern used to determine what each messages size should be. - * @return + * @return pattern */ public MessageSizePattern messageSizePattern() { @@ -590,7 +590,7 @@ public MessageSizePattern messageSizePattern() /** * Set the message size pattern used to determine what each message size should be. - * @param pattern + * @param pattern to use */ public void messageSizePattern(final MessageSizePattern pattern) { @@ -614,10 +614,13 @@ public void numberOfStreams(final int value) { totalStreams = value; } + /** * If the parsed arguments created file input or output streams, those need to be closed. * This is a convenience method that will handle all the closable cases for you. Call this * before shutting down an application. Output streams will also be flushed. + * + * @throws IOException if an error occurs */ public void close() throws IOException { @@ -724,7 +727,7 @@ else if (useEmbeddedStr.equalsIgnoreCase("embedded")) * Parses a comma separated list of channels. The channels can use ranges for ports and * stream-id on a per address basis. Channel Example: udp://192.168.0.100:21000-21004#1-10 * will give 5 channels with 10 streams each. - * @param csv + * @param csv to use * @throws ParseException */ private void parseChannels(final String csv) throws ParseException @@ -875,8 +878,8 @@ private void parseRawChannelToStruct(final String chanString, final ChannelStruc /** * Walk the string to find the end of the ports, which can be a number or range. * Ports will end at the end of the string, or at a # or | character. - * @param input - * @param startIdx + * @param input to use + * @param startIdx to use * @return The index of the first character not part of the ports string. */ private int findPortsEndIdx(final String input, final int startIdx) @@ -1000,8 +1003,8 @@ private int[] findMinAndMaxStreamIds(final String inputString) throws ParseExcep /** * Function to add ChannelDescriptor objects to the channels list. * @param chan Channel address including port low and high - * @param streamIdLow - * @param streamIdHigh + * @param streamIdLow to use + * @param streamIdHigh to use */ private void addChannelRanges(final ChannelStruct chan, final int streamIdLow, final int streamIdHigh) { @@ -1027,7 +1030,7 @@ private void addChannelRanges(final ChannelStruct chan, final int streamIdLow, f /** * - * @param ratesCsv + * @param ratesCsv to use */ private void parseRates(final String ratesCsv) throws ParseException { @@ -1328,12 +1331,6 @@ else if (outputStr.equalsIgnoreCase("stderr")) } } - /** - * - * @param filename - * @return - * @throws ParseException - */ private PubSubOptions.OptionValuesStruct getDefaultsFromOptionsFile(final String filename) throws ParseException { BufferedReader br; @@ -1382,12 +1379,6 @@ BufferedReader newBufferedFileReader(final String filename) throws FileNotFoundE return new BufferedReader(new FileReader(filename)); } - /** - * Parses a bit rate multiplier based on a string that may contain Gbps, Mbps, Kbps, bps - * @param s - * @return - * @throws Exception - */ private int parseBitRateMultiplier(final String s) throws ParseException { final String rateLowercase = s.toLowerCase(); @@ -1411,12 +1402,6 @@ private int parseBitRateMultiplier(final String s) throws ParseException throw new ParseException("bit rate " + s + " was not 'Gbps','Mbps','Kbps', or 'bps'."); } - /** - * Parses a long string and returns the value. Value must be positive. - * @param longStr - * @return - * @throws ParseException - */ private long parseLongCheckPositive(final String longStr) throws ParseException { long value; @@ -1436,11 +1421,8 @@ private long parseLongCheckPositive(final String longStr) throws ParseException return value; } - /** + /* * Parses an integer and returns the value if positive. - * @param intStr - * @return - * @throws ParseException */ private int parseIntCheckPositive(final String intStr) throws ParseException { diff --git a/aeron-tools/src/main/java/uk/co/real_logic/aeron/tools/RandomInputStream.java b/aeron-tools/src/main/java/uk/co/real_logic/aeron/tools/RandomInputStream.java index adc499b036..a22fa19c85 100644 --- a/aeron-tools/src/main/java/uk/co/real_logic/aeron/tools/RandomInputStream.java +++ b/aeron-tools/src/main/java/uk/co/real_logic/aeron/tools/RandomInputStream.java @@ -50,7 +50,7 @@ public int read() throws IOException /** * Does nothing. - * @param b + * @param b to use * @return The value passed in */ public long skip(final long b) @@ -60,8 +60,8 @@ public long skip(final long b) /** * Returns between 0 and up to 400 bytes, or less if the buffer is not large enough. - * @param b - * @return + * @param b to use + * @return length */ public int read(final byte[] b) throws IOException { @@ -76,7 +76,7 @@ public int read(final byte[] b) throws IOException /** * Put random data into the byte array. This will always read the given length. - * @param b + * @param b to use * @param off Where to start in the buffer * @param len Amount of bytes to read * @return Always the same as len diff --git a/aeron-tools/src/main/java/uk/co/real_logic/aeron/tools/RateController.java b/aeron-tools/src/main/java/uk/co/real_logic/aeron/tools/RateController.java index 5de8409930..408521754f 100644 --- a/aeron-tools/src/main/java/uk/co/real_logic/aeron/tools/RateController.java +++ b/aeron-tools/src/main/java/uk/co/real_logic/aeron/tools/RateController.java @@ -172,6 +172,7 @@ public interface Callback { /** * Returns the number of bytes "sent", or -1 to indicate sending should stop. + * @return number of bytes sent */ int onNext(); } diff --git a/aeron-tools/src/main/java/uk/co/real_logic/aeron/tools/ThwackerTool.java b/aeron-tools/src/main/java/uk/co/real_logic/aeron/tools/ThwackerTool.java index 48059c27e3..49cf2cfad7 100644 --- a/aeron-tools/src/main/java/uk/co/real_logic/aeron/tools/ThwackerTool.java +++ b/aeron-tools/src/main/java/uk/co/real_logic/aeron/tools/ThwackerTool.java @@ -147,8 +147,8 @@ public ThwackerTool(final String[] args) } /** - * createAndInitObjects(): - * Initializes all the necessary objects used + * Initializes all the necessary objects used + * @param opts to use */ public void createAndInitObjects(final ThwackerOptions opts) { @@ -275,6 +275,9 @@ public void createAndStartThreads() * Run function that allows threads to run for a set duration * If iterations is set, add/remove threads will be running for one duration then * will sleep for a few seconds and repeat until the set number of iterations. + * + * @param duration to use + * @param iterations to use */ public void run(final int duration, int iterations) { @@ -614,9 +617,10 @@ public void messageHandler( } } - /** Thwacking Element: - * Internal object used to contain either a publication or subscription - * and state associated along with it + /* + * Thwacking Element: + * Internal object used to contain either a publication or subscription + * and state associated along with it */ private class ThwackingElement { diff --git a/build.gradle b/build.gradle index b993e4ce88..7fb59a1e28 100644 --- a/build.gradle +++ b/build.gradle @@ -13,15 +13,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import org.gradle.plugins.ide.eclipse.model.Classpath -apply plugin: 'maven' -apply plugin: 'signing' -apply plugin: 'eclipse' +plugins { + id 'java' + id 'com.github.johnrengelman.shadow' version '1.2.1' +} + +defaultTasks 'clean', 'build', 'shadowJar', 'install' -defaultTasks 'clean', 'build', 'install' +def aeronGroup = 'uk.co.real-logic' +def aeronVersion = '0.1-SNAPSHOT' group = aeronGroup +version = aeronVersion +ext.isReleasedVersion = !version.endsWith("SNAPSHOT") ext { group = aeronGroup @@ -34,36 +39,12 @@ ext { ossrhPassword = '' } -allprojects { - apply plugin: 'eclipse' - apply plugin: 'idea' -} - -buildscript { - repositories { - jcenter() - } - dependencies { - classpath 'com.github.jengelman.gradle.plugins:shadow:0.8' - classpath 'com.puppycrawl.tools:checkstyle:6.7' - } -} - subprojects { apply plugin: 'java' apply plugin: 'maven' apply plugin: 'checkstyle' - - // Make sure that we use the correct JDK in Eclipse - // There needs to be a JDK8 JVM installed in Eclipse before - // importing the generated projects. - plugins.withType(JavaBasePlugin) { - eclipse.classpath.file.whenMerged { Classpath path -> - path.entries.findAll { it.path.contains('JRE_CONTAINER') }.each { - it.path += "/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8" - } - } - } + apply plugin: 'signing' + apply plugin: 'com.github.johnrengelman.shadow' group = aeronGroup version = aeronVersion @@ -111,41 +92,82 @@ subprojects { options.bottom = 'Copyright © 2014 - 2015 Real Logic Ltd. All Rights Reserved.' options.addStringOption('XDignore.symbol.file', '-quiet') } - afterEvaluate { - if (plugins.hasPlugin(JavaPlugin)) { - - // configuration here - rootProject.tasks.docs { - source += files(sourceSets.collect { srcSet -> srcSet.allJava }) - classpath += files(sourceSets*.compileClasspath) - } - - } - } - - task sourcesJar(type: Jar) { - classifier = 'sources' - from sourceSets.main.allSource - } task testJar(type: Jar, dependsOn: testClasses) { baseName = "test-${project.archivesBaseName}" from sourceSets.test.output } - task javadocJar(type: Jar) { - classifier = 'javadoc' - from javadoc.destinationDir - } - configurations { tests } artifacts { - archives sourcesJar, javadocJar tests testJar } + + signing { + required { isReleasedVersion && gradle.taskGraph.hasTask("uploadArchives") } + sign configurations.archives + } + + uploadArchives { + repositories { + mavenDeployer { + beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } + + repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { + authentication(userName: ossrhUsername, password: ossrhPassword) + } + + snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { + authentication(userName: ossrhUsername, password: ossrhPassword) + } + + pom.project { + name = 'Aeron' + packaging = 'pom' + // optionally artifactId can be defined here + description = 'Efficient reliable unicast and multicast transport protocol.' + url = 'https://github.com/real-logic/Aeron' + + scm { + connection = 'scm:git:https://github.com/real-logic/Aeron.git' + developerConnection = 'scm:git:https://github.com/real-logic/Aeron.git' + url = 'https://github.com/real-logic/Aeron.git' + } + + licenses { + license { + name = 'The Apache License, Version 2.0' + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + + developers { + developer { + id = 'tmontgomery' + name = 'Todd L. Montgomery' + email = 'tmont@nard.net' + url = 'https://github.com/tmontgomery' + } + developer { + id = 'mjpt777' + name = 'Martin Thompson' + email = 'mjpt777@gmail.com' + url = 'https://github.com/mjpt777' + } + developer { + id = 'RichardWarburton' + name = 'Richard Warburton' + email = 'richard.warburton@gmail.com' + url = 'https://github.com/RichardWarburton' + } + } + } + } + } + } } project(':aeron-driver') { @@ -166,6 +188,20 @@ project(':aeron-driver') { systemProperties(System.properties) } + task sourcesJar(type: Jar) { + classifier = 'sources' + from sourceSets.main.allSource + } + + task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir + } + + artifacts { + archives sourcesJar, javadocJar + } + build.doLast { tasks.distZip.execute() } @@ -173,26 +209,50 @@ project(':aeron-driver') { project(':aeron-client') { dependencies { - dependencies { - compile 'uk.co.real-logic:Agrona:0.3.2-SNAPSHOT' - } + compile 'uk.co.real-logic:Agrona:0.4' } + + task sourcesJar(type: Jar) { + classifier = 'sources' + from sourceSets.main.allSource + } + + task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir + } + + artifacts { + archives sourcesJar, javadocJar + } + } project(':aeron-samples') { - apply plugin: 'shadow' + apply plugin: 'com.github.johnrengelman.shadow' dependencies { compile project(':aeron-client'), project(':aeron-driver'), 'org.hdrhistogram:HdrHistogram:2.1.4' } - shadow { - outputFile = new File('aeron-samples/build/libs/samples.jar') + shadowJar { + archiveName = 'samples.jar' } - build.doLast { - tasks.shadowJar.execute() + task sourcesJar(type: Jar) { + classifier = 'sources' + from sourceSets.main.allSource + } + + task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir + } + + artifacts { + archives sourcesJar, javadocJar } + } project(':aeron-system-tests') { @@ -204,97 +264,78 @@ project(':aeron-system-tests') { test { systemProperties('aeron.event.log': System.properties['aeron.event.log']) } + + task sourcesJar(type: Jar) { + classifier = 'sources' + from sourceSets.test.allSource + } + + task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir + } + + artifacts { + archives sourcesJar, javadocJar + } } -uploadArchives { - repositories { - mavenDeployer { - beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } +project(':aeron-tools') { + apply plugin: 'com.github.johnrengelman.shadow' - repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { - authentication(userName: ossrhUsername, password: ossrhPassword) - } + dependencies { + compile project(':aeron-client'), project(':aeron-driver'), project(':aeron-samples') + compile 'commons-cli:commons-cli:1.2' + } - snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { - authentication(userName: ossrhUsername, password: ossrhPassword) - } + shadowJar { + archiveName = 'tools.jar' + } - pom.project { - name = 'Aeron' - packaging = 'pom' - // optionally artifactId can be defined here - description = 'Efficient reliable unicast and multicast transport protocol.' - url = 'https://github.com/real-logic/Aeron' - - scm { - connection = 'scm:git:https://github.com/real-logic/Aeron.git' - developerConnection = 'scm:git:https://github.com/real-logic/Aeron.git' - url = 'https://github.com/real-logic/Aeron.git' - } + task sourcesJar(type: Jar) { + classifier = 'sources' + from sourceSets.main.allSource + } - licenses { - license { - name = 'The Apache License, Version 2.0' - url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' - } - } + task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir + } - developers { - developer { - id = 'tmontgomery' - name = 'Todd L. Montgomery' - email = 'tmont@nard.net' - url = 'https://github.com/tmontgomery' - } - developer { - id = 'mjpt777' - name = 'Martin Thompson' - email = 'mjpt777@gmail.com' - url = 'https://github.com/mjpt777' - } - developer { - id = 'RichardWarburton' - name = 'Richard Warburton' - email = 'richard.warburton@gmail.com' - url = 'https://github.com/RichardWarburton' - } - } - } - } + artifacts { + archives sourcesJar, javadocJar } -} -task wrapper(type: Wrapper) { - gradleVersion = '2.4' } -task docs(type: Javadoc) { - title = '

Aeron Transport Protocol

' - - options.bottom = 'Copyright © 2014 - 2015 Real Logic Ltd. All Rights Reserved.' - options.addStringOption('XDignore.symbol.file', '-quiet') - include '**/Aeron.java' - include '**/FragmentAssemblyAdapter.java' - include '**/InactiveImageHandler.java' - include '**/NewImageHandler.java' - include '**/Image.java' - include '**/Publication.java' - include '**/Subscription.java' - include '**/CommonContext.java' - include '**/ErrorCode.java' - include '**/Header.java' - include '**/DataHandler.java' - include '**/BufferClaim.java' - include '**/RegistrationException.java' - include '**/DriverTimeoutException.java' - destinationDir = file("$buildDir/docs/doc") -} +project(':aeron-all') { + apply plugin: 'com.github.johnrengelman.shadow' -task docsJar (type: Jar, dependsOn: docs) { - classifier = 'docs' - from docs.destinationDir + dependencies { + compile project(':aeron-client'), project(':aeron-driver') + } + + task sourcesJar(type: Jar) { + classifier = 'sources' + from project(':aeron-client').sourceSets.main.allSource + from project(':aeron-driver').sourceSets.main.allSource + } + + task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from project(':aeron-client').javadoc.destinationDir + from project(':aeron-driver').javadoc.destinationDir + } + + shadowJar { + classifier = '' + } + + artifacts { + archives sourcesJar, javadocJar + } } -artifacts { - archives docsJar +task wrapper(type: Wrapper) { + gradleVersion = '2.4' } diff --git a/gradle.properties b/gradle.properties deleted file mode 100644 index 0af42805dc..0000000000 --- a/gradle.properties +++ /dev/null @@ -1,2 +0,0 @@ -aeronVersion=0.1-SNAPSHOT -aeronGroup=uk.co.real-logic diff --git a/settings.gradle b/settings.gradle index 5bc3c80d63..be2a57e3a4 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,2 +1,2 @@ -include 'aeron-client', 'aeron-driver', 'aeron-samples', 'aeron-system-tests', 'aeron-tools' +include 'aeron-client', 'aeron-driver', 'aeron-samples', 'aeron-system-tests', 'aeron-tools', 'aeron-all'