Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Five refactorings #45

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d70a029
Dead stores should be removed
robinroos Mar 16, 2019
285216d
Optimize Imports
robinroos Mar 16, 2019
ee5fe85
Unused "private" fields should be removed
robinroos Mar 16, 2019
823025c
Static fields should not be updated in constructors (in this case the…
robinroos Mar 16, 2019
d9e7644
"throws" declarations should not be superfluous
robinroos Mar 16, 2019
8ffd12e
Standard outputs should not be used directly to log anything - in thi…
robinroos Mar 17, 2019
863f850
Standard outputs should not be used directly to log anything - in thi…
robinroos Mar 17, 2019
c6f761d
Merge branch 'master' of https://github.com/bitsofinfo/hazelcast-dock…
robinroos Mar 19, 2019
3ba86ed
Unused method parameters should be removed
robinroos Mar 20, 2019
d7ffd5c
Local variables should be appropriately scoped
robinroos Mar 22, 2019
ada0f15
Remove @SuppressWarnings("squid:S106")
robinroos Mar 22, 2019
f416d17
Reformat code and Optimize Imports
robinroos Mar 22, 2019
7ef9d16
Reformat code and Optimize Imports
robinroos Mar 22, 2019
5ec093b
Variable scope
robinroos Mar 22, 2019
f9a5615
Revert to last good build
robinroos Mar 23, 2019
7658ea6
Revert "Reformat code and Optimize Imports"
robinroos Mar 23, 2019
3b52a61
Revert "Reformat code and Optimize Imports"
robinroos Mar 23, 2019
8322458
Revert "Remove @SuppressWarnings("squid:S106")"
robinroos Mar 23, 2019
c020dbe
Revert "Local variables should be appropriately scoped"
robinroos Mar 23, 2019
a0453b9
Remove TODO marker
robinroos Mar 24, 2019
bf5ecab
Reformat code and Optimize Imports
robinroos Mar 25, 2019
225027d
Remove some whitespace
robinroos Mar 25, 2019
eede6f8
Private method overloadings which merely alter argument sequence shou…
robinroos Mar 25, 2019
ec5e0e1
Fields set only in constructors should be final
robinroos Mar 25, 2019
5853324
Fields set only in constructors should be final
robinroos Mar 25, 2019
7a799a6
Reformat code and Optimize Imports
robinroos Mar 25, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
import java.util.logging.Level;
import java.util.logging.LogRecord;

@SuppressWarnings("squid:S106")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SuppressWarnings is already used in this project.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, but not referencing third party tooling like this which is not used in the project

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood. will remove as part of the next PR if that's ok.

public class SystemPrintLogger implements ILogger {

private DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");

@Override
public void finest(String message) {
System.out.println("FINEST " + message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.hazelcast.config.ClasspathXmlConfig;
import com.hazelcast.config.Config;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.instance.AddressPicker;
import com.hazelcast.instance.DefaultNodeContext;
import com.hazelcast.instance.HazelcastInstanceFactory;
Expand Down Expand Up @@ -33,7 +32,7 @@ public AddressPicker createAddressPicker(Node node) {
}
};

HazelcastInstance hazelcastInstance = HazelcastInstanceFactory
HazelcastInstanceFactory
.newHazelcastInstance(conf, "hazelcast-docker-swarm-discovery-spi-example", nodeContext);


Expand All @@ -42,16 +41,15 @@ public AddressPicker createAddressPicker(Node node) {
Config conf = new ClasspathXmlConfig("hazelcast-docker-swarm-discovery-spi-example-member-address-provider.xml");


HazelcastInstance hazelcastInstance = HazelcastInstanceFactory
HazelcastInstanceFactory
.newHazelcastInstance(conf, "hazelcast-docker-swarm-discovery-spi-example", new DefaultNodeContext());
} else if (System.getProperty("swarm-bind-method").equalsIgnoreCase("dockerDNSRR")) {
Config conf =
new ClasspathXmlConfig(
"hazelcast-docker-swarm-dnsrr-discovery-spi-example.xml"
);

HazelcastInstance hazelcastInstance =
HazelcastInstanceFactory.newHazelcastInstance(conf);
HazelcastInstanceFactory.newHazelcastInstance(conf);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,22 @@
*/
public class DockerDNSRRMemberAddressProvider
implements MemberAddressProvider {
public static Properties properties;
public static InetSocketAddress bindAddress = null;
protected Properties properties;
protected InetSocketAddress bindAddress = null;
ILogger logger = Logger.getLogger(DockerDNSRRMemberAddressProvider.class);

/**
*
* @param properties
* @throws NumberFormatException if servicePort cannot be parsed
* @throws SocketException
* @throws UnknownHostException
*/
public DockerDNSRRMemberAddressProvider(Properties properties)
throws
NumberFormatException,
SocketException,
UnknownHostException {
DockerDNSRRMemberAddressProvider.properties = properties;
this.properties = properties;

if (properties != null) {
String serviceName = properties.getProperty(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ public Iterable<DiscoveryNode> discoverNodes() {
return discoveryNodes;
}

Set<InetAddress> serviceNameResolutions =
new HashSet<>();
// TODO robin - tighten scope of these variables
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already done in a pending PR which tightens variable scopes.

Set<InetAddress> serviceNameResolutions;
String[] serviceHostnameAndPort;
Integer port = 5701;
Integer port;

//Loop for every service defined in the CSV
for (String service : servicesCsv.split(",")) {
Expand Down