Clone Tools
  • last updated a few seconds ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Change `InetAddressFactory` so that it no longer uses reflection to inspect `NetworkInterface`

+review REVIEW-6046

    • -70
    • +7
    ./internal/inet/InetAddressFactory.java
Replace usage of `String#format` with good old string concatenation

The rationale behind this change is that while `String#format` is usually admitted as good for readability (this is arguable),

in practice it is very bad for performance. Since Java 6, the JVM (the JIT, to be correct) does a pretty good job at optimizing

string concatenation. However, it is only capable to do so if we're using "dirty" string concatenations (using `+`), or `StringBuilder`.

However, usage of `StringBuilder` is not recommended either for 2 reasons:

1. it significantly decreases code readability

2. in Java 9, String concatenation is even more optimized thanks to `invokedynamic`, and code using `StringBuilder` will *not* benefit

from this optimization.

There are sill leftover `String#format` calls in the code, in the following cases:

- the call is used to generate an exception message. That's 90% of the remaining calls.

- the call is obviously a debug message, often used in `toString` (because as we all know, `toString` should only be used for debugging)

- the format includes specific number formatting patterns

- I missed it

    • -1
    • +1
    ./internal/hub/protocol/EndOfStream.java
    • -1
    • +1
    ./internal/inet/MultiChoiceAddress.java
    • -1
    • +1
    ./internal/inet/SocketConnectCompletion.java
    • -1
    • +1
    ./internal/inet/SocketInetAddress.java
    • -1
    • +1
    ./internal/inet/TcpIncomingConnector.java
  1. … 220 more files in changeset.
Busted up some package cycles and switched on classcycle checks for 'messaging' project.

    • -57
    • +0
    ./internal/PlaceholderException.java
    • -1
    • +1
    ./internal/hub/JavaSerializationBackedMethodArgsSerializer.java
    • -0
    • +86
    ./services/MessagingServices.java
  1. … 28 more files in changeset.
Moved `o.g.messaging.*` to `o.g.internal.*`.

    • -0
    • +33
    ./ConnectionAcceptor.java
    • -0
    • +28
    ./MessagingClient.java
    • -0
    • +32
    ./MessagingServer.java
    • -0
    • +43
    ./ObjectConnection.java
    • -0
    • +57
    ./ObjectConnectionBuilder.java
    • -0
    • +32
    ./internal/ConnectCompletion.java
    • -0
    • +22
    ./internal/ConnectException.java
    • -0
    • +37
    ./internal/Connection.java
    • -0
    • +31
    ./internal/IncomingConnector.java
    • -0
    • +37
    ./internal/KryoBackedMessageSerializer.java
    • -0
    • +220
    ./internal/Message.java
    • -0
    • +22
    ./internal/MessageIOException.java
    • -0
    • +35
    ./internal/MessageSerializer.java
    • -0
    • +83
    ./internal/MessagingServices.java
  1. … 281 more files in changeset.