Skip to content

Commit ad3367d

Browse files
authored
Merge pull request #18 from LMAX-Exchange/fix-intellij-warnings
fix IntelliJ warnings
2 parents 85e457c + cf6f402 commit ad3367d

27 files changed

+135
-184
lines changed

nanofix-client/src/main/java/com/lmax/nanofix/ChannelInitializer.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,12 @@ class ChannelInitializer implements ConnectionObserver {
5050
@Override
5151
public void connectionEstablished() {
5252
outboundMessageSender.initialiseOutboundChannel(transport.getWritableByteChannel());
53-
channelReaderExecutorService.execute(new Runnable() {
54-
@Override
55-
public void run() {
56-
final ReadableByteChannel readableByteChannel = transport.getReadableByteChannel();
57-
try {
58-
inputStreamReader.blockingStart(readableByteChannel);
59-
} catch (RuntimeException e) {
60-
LOGGER.error("Exception thrown while reading from stream, channel: " + readableByteChannel, e);
61-
}
53+
channelReaderExecutorService.execute(() -> {
54+
final ReadableByteChannel readableByteChannel = transport.getReadableByteChannel();
55+
try {
56+
inputStreamReader.blockingStart(readableByteChannel);
57+
} catch (RuntimeException e) {
58+
LOGGER.error("Exception thrown while reading from stream, channel: {}", readableByteChannel, e);
6259
}
6360
});
6461
countDownLatch.countDown();

nanofix-client/src/main/java/com/lmax/nanofix/FixClient.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void send(final String message) {
7373
}
7474

7575
/**
76-
* Sends a array of bytes string.
76+
* Sends an array of bytes string.
7777
*
7878
* @param bytes a FIX messages.
7979
*/
@@ -82,7 +82,7 @@ public void send(final byte[] bytes) {
8282
}
8383

8484
/**
85-
* Initiates a TCP connection with the remote host specified on construction..
85+
* Initiates a TCP connection with the remote host specified on construction.
8686
*/
8787
public void connect() {
8888
transportOps.connect();
@@ -94,7 +94,7 @@ public void connect() {
9494
}
9595

9696
/**
97-
* Initiates a TCP connection with the remote host specified on construction..
97+
* Initiates a TCP connection with the remote host specified on construction.
9898
*
9999
* @param timeout the time to wait for a connection to be established
100100
* @param units the {@link TimeUnit unit} of the timeout

nanofix-client/src/main/java/com/lmax/nanofix/FixClientConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public static FixClientConfiguration createInitiatingFixClient(final String host
3838
}
3939

4040
/**
41-
* Listening listening fix client that will listen for inbound tcp connections on port
41+
* Listening fix client that will listen for inbound tcp connections on port
4242
*
4343
* @param port tcp port number int between 0 and 65535
4444
*/

nanofix-client/src/main/java/com/lmax/nanofix/FixClientFactory.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,8 @@
4242
public final class FixClientFactory {
4343
private static final Logger LOGGER = LoggerFactory.getLogger(FixClientFactory.class);
4444

45-
static final Thread.UncaughtExceptionHandler UNCAUGHT_EXCEPTION_HANDLER = new Thread.UncaughtExceptionHandler() {
46-
@Override
47-
public void uncaughtException(Thread thread, Throwable throwable) {
48-
LOGGER.error("Uncaught Exception thrown in thread: " + thread.getName(), throwable);
49-
}
50-
};
45+
static final Thread.UncaughtExceptionHandler UNCAUGHT_EXCEPTION_HANDLER = (thread, throwable) ->
46+
LOGGER.error("Uncaught Exception thrown in thread: {}", thread.getName(), throwable);
5147

5248
private FixClientFactory() {
5349
}
@@ -68,7 +64,7 @@ public static FixClient createFixClient(final String host, final int port) {
6864
}
6965

7066
/**
71-
* Create an listening fix client that will listen for inbound tcp connections on port
67+
* Create a listening fix client that will listen for inbound tcp connections on port
7268
*
7369
* @param port tcp port number int between 0 and 65535
7470
*/

nanofix-client/src/main/java/com/lmax/nanofix/FixSession.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,10 @@
2323
import com.lmax.nanofix.outgoing.OutboundMessageHandler;
2424

2525
public class FixSession {
26-
private int outboundSequenceNumber;
27-
private OutboundMessageHandler outboundMessageSender;
26+
private final OutboundMessageHandler outboundMessageSender;
2827

2928
public FixSession(final OutboundMessageHandler outboundMessageSender) {
3029
this.outboundMessageSender = outboundMessageSender;
31-
this.outboundSequenceNumber = 1;
3230
}
3331

3432
public void send(final Collection<FixMessage> messages) {

nanofix-client/src/main/java/com/lmax/nanofix/FixUtil.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ public static Charset getCharset() {
3838

3939
public static byte[] newMessage(String... tags) {
4040
StringBuilder sb = new StringBuilder();
41-
for (int i = 0, n = tags.length; i < n; i++) {
42-
sb.append(tags[i]);
41+
for (final String tag : tags) {
42+
sb.append(tag);
4343
sb.append(FixTagParser.SOH);
4444
}
4545
return sb.toString().getBytes(FixUtil.getCharset());

nanofix-client/src/main/java/com/lmax/nanofix/concurrent/NamedThreadFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class NamedThreadFactory implements ThreadFactory {
2828
private final String name;
2929
private final boolean daemon;
3030
private final AtomicInteger count = new AtomicInteger(0);
31-
private Thread.UncaughtExceptionHandler uncaughtExceptionHandler;
31+
private final Thread.UncaughtExceptionHandler uncaughtExceptionHandler;
3232

3333
public NamedThreadFactory(final String name, boolean daemon, Thread.UncaughtExceptionHandler uncaughtExceptionHandler) {
3434
this.name = name;

nanofix-client/src/main/java/com/lmax/nanofix/incoming/FixMessage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public boolean hasValue(int tagId) {
4343
}
4444

4545
public void replace(int tagId, String value) {
46-
final LinkedList<String> values = new LinkedList<String>();
46+
final LinkedList<String> values = new LinkedList<>();
4747
values.add(value);
4848
multimap.replaceValues(tagId, values);
4949
}

nanofix-client/src/main/java/com/lmax/nanofix/incoming/FixMessagePublisher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import java.util.concurrent.CopyOnWriteArrayList;
2121

2222
public class FixMessagePublisher implements FixMessageHandler {
23-
List<FixMessageHandler> handlers = new CopyOnWriteArrayList<FixMessageHandler>();
23+
List<FixMessageHandler> handlers = new CopyOnWriteArrayList<>();
2424

2525
public void subscribeToAllMessages(final FixMessageHandler fixMessageHandler) {
2626
handlers.add(fixMessageHandler);

nanofix-client/src/main/java/com/lmax/nanofix/incoming/FixParseException.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616

1717
package com.lmax.nanofix.incoming;
1818

19-
@SuppressWarnings("serial")
20-
public final class FixParseException
21-
extends RuntimeException {
19+
public final class FixParseException extends RuntimeException {
20+
2221
public FixParseException(final String msg) {
2322
super(msg);
2423
}

0 commit comments

Comments
 (0)