- The code is not easy to extend... if you get a new datacenter, it will be a huge pain to reconfigure. What if your DEV environment gets two datacenters?
- Your access patterns are all .... bizarre, in that you have protected static methods (what does that mean?) protected static methods (what does that mean?) and all the other access is through static methods as well.
- The code is not easy to extend... if you get a new datacenter, it will be a huge pain to reconfigure. What if your DEV environment gets two datacenters?
- Your access patterns are all .... bizarre, in that you have protected static methods (what does that mean?) and all the other access is through static methods as well.
- The code is not easy to extend... if you get a new datacenter, it will be a huge pain to reconfigure. What if your DEV environment gets two datacenters?
- Your access patterns are all .... bizarre, in that you have protected static methods (what does that mean?) and all the other access is through static methods as well.
import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Properties;
import java.util.Random;
import java.util.stream.Stream;
@SuppressWarnings("javadoc")
public class DatacenterDetail {
private static final String keyCheckDev = "dev_domain_part";
private static final String keyDevLocalDatacenter = "dev_local_datacenter";
private static final String keyDevRemoteDatacenter = "dev_remote_datacenter";
private static final String keyDatacenters = "datacenter_names";
private static final String keyDefaultDatacenter = "datacenter_default";
private static final String keyRecoPrefix = "reco_prefix";
private static final String keyRecoSuffix = "reco_suffix";
private static final String keyUnRecoPrefix = "unreco_prefix";
private static final String keyUnRecoSuffix = "unreco_suffix";
private static final String localHost;
private static final String localDatacenter;
private static final String localReco;
private static final String localUnReco;
private static final String remoteReco;
private static final String remoteUnReco;
static {
Properties props = loadProperties();
localHost = getHostNameOfServer();
String devCheck = props.getProperty(keyCheckDev, ".dev.");
String recoPrefix = props.getProperty(keyRecoPrefix, "/tr/datacenter/");
String recoSuffix = props.getProperty(keyRecoSuffix, "");
String unrecoPrefix = props.getProperty(keyUnRecoPrefix, "/trtrpp/datacenter/");
String unrecoSuffix = props.getProperty(keyUnRecoSuffix, "");
if (!DataUtils.isProduction() || localHost.indexOf("." + devCheck + ".") >= 0) {
// we are running on a dev machine. Force the system in to dev mode.
localDatacenter = props.getProperty(keyDevLocalDatacenter, "dhp");
String remotedc = props.getProperty(keyDevRemoteDatacenter, "dhp");
localReco = recoPrefix + localDatacenter + recoSuffix;
localUnReco = unrecoPrefix + localDatacenter + unrecoSuffix;
remoteReco = recoPrefix + remotedc + recoSuffix;
remoteUnReco = unrecoPrefix + remotedc + unrecoSuffix;
} else {
String defaultdatacenter = props.getProperty(keyDefaultDatacenter, "dhp");
String[] datacenters = props.getProperty(keyDatacenters, "dhp slp ltr").trim().split("\\s+");
localDatacenter = getLocalDC(localHost, defaultdatacenter, datacenters);
String remotedc = getRandomRemote(localDatacenter, datacenters);
localReco = recoPrefix + localDatacenter + recoSuffix;
remoteReco = recoPrefix + remotedc + recoSuffix;
localUnReco = unrecoPrefix + localDatacenter + unrecoSuffix;
remoteUnReco = unrecoPrefix + remotedc + unrecoSuffix;
}
}
private static Properties loadProperties() {
String cname = DatacenterDetail.class.getName();
String propname = "/" + cname.replace('.', '/') + ".properties";
Properties props = new Properties();
try (InputStream is = DatacenterDetail.class.getResourceAsStream(propname)) {
if (is == null) {
throw new IllegalStateException("Cannot locate properties " + propname);
}
props.load(is);
} catch (IOException e) {
e.printStackTrace();
throw new IllegalStateException("Unable to load proprties from system resource " + propname, e);
}
return props;
}
private static String getRandomRemote(String localdc, String[] datacenters) {
String[] notlocal = Stream.of(datacenters).filter(dc -> !localdc.equals(dc)).toArray(s -> new String[s]);
if (notlocal.length == 0) {
return localdc;
}
if (notlocal.length == 1) {
return notlocal[0];
}
Random rand = new Random();
return notlocal[rand.nextInt(notlocal.length)];
}
private static String getLocalDC(String hostname, String defaultdatacenter, String[] datacenters) {
for (String dc : datacenters) {
if (hostname.indexOf("." + dc + ".") >= 0) {
return dc;
}
}
return defaultdatacenter;
}
private static final String getHostNameOfServer() {
try {
return InetAddress.getLocalHost().getCanonicalHostName().toLowerCase();
} catch (UnknownHostException ex) {
// logging error
}
return null;
}
public static String getLocalString(DataFlowEnum dataFlowType) {
return dataFlowType.equals(DataFlowEnum.RECO) ? localReco : localUnReco;
}
public static String getRemoteString(DataFlowEnum dataFlowType) {
return dataFlowType.equals(DataFlowEnum.RECO) ? remoteReco : remoteUnReco;
}
public static String getCurrentDatacenter() {
return localDatacenter;
}
public static String getCurrentHostName() {
return localHost;
}
public static void main(String[] args) {
System.out.println(getCurrentDatacenter());
System.out.println(getCurrentHostName());
System.out.println(getLocalString(DataFlowEnum.RECO));
System.out.println(getLocalString(DataFlowEnum.UNRECO));
System.out.println(getRemoteString(DataFlowEnum.RECO));
System.out.println(getRemoteString(DataFlowEnum.UNRECO));
}
}
import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Properties;
import java.util.Random;
import java.util.stream.Stream;
@SuppressWarnings("javadoc")
public class DatacenterDetail {
private static final String keyCheckDev = "dev_domain_part";
private static final String keyDevLocalDatacenter = "dev_local_datacenter";
private static final String keyDevRemoteDatacenter = "dev_remote_datacenter";
private static final String keyDatacenters = "datacenter_names";
private static final String keyDefaultDatacenter = "datacenter_default";
private static final String keyRecoPrefix = "reco_prefix";
private static final String keyRecoSuffix = "reco_suffix";
private static final String keyUnRecoPrefix = "unreco_prefix";
private static final String keyUnRecoSuffix = "unreco_suffix";
private static final String localHost;
private static final String localDatacenter;
private static final String localReco;
private static final String localUnReco;
private static final String remoteReco;
private static final String remoteUnReco;
static {
Properties props = loadProperties();
localHost = getHostNameOfServer();
String devCheck = props.getProperty(keyCheckDev, ".dev.");
String recoPrefix = props.getProperty(keyRecoPrefix, "/tr/datacenter/");
String recoSuffix = props.getProperty(keyRecoSuffix, "");
String unrecoPrefix = props.getProperty(keyUnRecoPrefix, "/tr/datacenter/");
String unrecoSuffix = props.getProperty(keyUnRecoSuffix, "");
if (!DataUtils.isProduction() || localHost.indexOf("." + devCheck + ".") >= 0) {
// we are running on a dev machine. Force the system in to dev mode.
localDatacenter = props.getProperty(keyDevLocalDatacenter, "dhp");
String remotedc = props.getProperty(keyDevRemoteDatacenter, "dhp");
localReco = recoPrefix + localDatacenter + recoSuffix;
localUnReco = unrecoPrefix + localDatacenter + unrecoSuffix;
remoteReco = recoPrefix + remotedc + recoSuffix;
remoteUnReco = unrecoPrefix + remotedc + unrecoSuffix;
} else {
String defaultdatacenter = props.getProperty(keyDefaultDatacenter, "dhp");
String[] datacenters = props.getProperty(keyDatacenters, "dhp slp ltr").trim().split("\\s+");
localDatacenter = getLocalDC(localHost, defaultdatacenter, datacenters);
String remotedc = getRandomRemote(localDatacenter, datacenters);
localReco = recoPrefix + localDatacenter + recoSuffix;
remoteReco = recoPrefix + remotedc + recoSuffix;
localUnReco = unrecoPrefix + localDatacenter + unrecoSuffix;
remoteUnReco = unrecoPrefix + remotedc + unrecoSuffix;
}
}
private static Properties loadProperties() {
String cname = DatacenterDetail.class.getName();
String propname = "/" + cname.replace('.', '/') + ".properties";
Properties props = new Properties();
try (InputStream is = DatacenterDetail.class.getResourceAsStream(propname)) {
if (is == null) {
throw new IllegalStateException("Cannot locate properties " + propname);
}
props.load(is);
} catch (IOException e) {
e.printStackTrace();
throw new IllegalStateException("Unable to load proprties from system resource " + propname, e);
}
return props;
}
private static String getRandomRemote(String localdc, String[] datacenters) {
String[] notlocal = Stream.of(datacenters).filter(dc -> !localdc.equals(dc)).toArray(s -> new String[s]);
if (notlocal.length == 0) {
return localdc;
}
if (notlocal.length == 1) {
return notlocal[0];
}
Random rand = new Random();
return notlocal[rand.nextInt(notlocal.length)];
}
private static String getLocalDC(String hostname, String defaultdatacenter, String[] datacenters) {
for (String dc : datacenters) {
if (hostname.indexOf("." + dc + ".") >= 0) {
return dc;
}
}
return defaultdatacenter;
}
private static final String getHostNameOfServer() {
try {
return InetAddress.getLocalHost().getCanonicalHostName().toLowerCase();
} catch (UnknownHostException ex) {
// logging error
}
return null;
}
public static String getLocalString(DataFlowEnum dataFlowType) {
return dataFlowType.equals(DataFlowEnum.RECO) ? localReco : localUnReco;
}
public static String getRemoteString(DataFlowEnum dataFlowType) {
return dataFlowType.equals(DataFlowEnum.RECO) ? remoteReco : remoteUnReco;
}
public static String getCurrentDatacenter() {
return localDatacenter;
}
public static String getCurrentHostName() {
return localHost;
}
public static void main(String[] args) {
System.out.println(getCurrentDatacenter());
System.out.println(getCurrentHostName());
System.out.println(getLocalString(DataFlowEnum.RECO));
System.out.println(getLocalString(DataFlowEnum.UNRECO));
System.out.println(getRemoteString(DataFlowEnum.RECO));
System.out.println(getRemoteString(DataFlowEnum.UNRECO));
}
}
import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Properties;
import java.util.Random;
import java.util.stream.Stream;
@SuppressWarnings("javadoc")
public class DatacenterDetail {
private static final String keyCheckDev = "dev_domain_part";
private static final String keyDevLocalDatacenter = "dev_local_datacenter";
private static final String keyDevRemoteDatacenter = "dev_remote_datacenter";
private static final String keyDatacenters = "datacenter_names";
private static final String keyDefaultDatacenter = "datacenter_default";
private static final String keyRecoPrefix = "reco_prefix";
private static final String keyRecoSuffix = "reco_suffix";
private static final String keyUnRecoPrefix = "unreco_prefix";
private static final String keyUnRecoSuffix = "unreco_suffix";
private static final String localHost;
private static final String localDatacenter;
private static final String localReco;
private static final String localUnReco;
private static final String remoteReco;
private static final String remoteUnReco;
static {
Properties props = loadProperties();
localHost = getHostNameOfServer();
String devCheck = props.getProperty(keyCheckDev, ".dev.");
String recoPrefix = props.getProperty(keyRecoPrefix, "/tr/datacenter/");
String recoSuffix = props.getProperty(keyRecoSuffix, "");
String unrecoPrefix = props.getProperty(keyUnRecoPrefix, "/trpp/datacenter/");
String unrecoSuffix = props.getProperty(keyUnRecoSuffix, "");
if (!DataUtils.isProduction() || localHost.indexOf("." + devCheck + ".") >= 0) {
// we are running on a dev machine. Force the system in to dev mode.
localDatacenter = props.getProperty(keyDevLocalDatacenter, "dhp");
String remotedc = props.getProperty(keyDevRemoteDatacenter, "dhp");
localReco = recoPrefix + localDatacenter + recoSuffix;
localUnReco = unrecoPrefix + localDatacenter + unrecoSuffix;
remoteReco = recoPrefix + remotedc + recoSuffix;
remoteUnReco = unrecoPrefix + remotedc + unrecoSuffix;
} else {
String defaultdatacenter = props.getProperty(keyDefaultDatacenter, "dhp");
String[] datacenters = props.getProperty(keyDatacenters, "dhp slp ltr").trim().split("\\s+");
localDatacenter = getLocalDC(localHost, defaultdatacenter, datacenters);
String remotedc = getRandomRemote(localDatacenter, datacenters);
localReco = recoPrefix + localDatacenter + recoSuffix;
remoteReco = recoPrefix + remotedc + recoSuffix;
localUnReco = unrecoPrefix + localDatacenter + unrecoSuffix;
remoteUnReco = unrecoPrefix + remotedc + unrecoSuffix;
}
}
private static Properties loadProperties() {
String cname = DatacenterDetail.class.getName();
String propname = "/" + cname.replace('.', '/') + ".properties";
Properties props = new Properties();
try (InputStream is = DatacenterDetail.class.getResourceAsStream(propname)) {
if (is == null) {
throw new IllegalStateException("Cannot locate properties " + propname);
}
props.load(is);
} catch (IOException e) {
e.printStackTrace();
throw new IllegalStateException("Unable to load proprties from system resource " + propname, e);
}
return props;
}
private static String getRandomRemote(String localdc, String[] datacenters) {
String[] notlocal = Stream.of(datacenters).filter(dc -> !localdc.equals(dc)).toArray(s -> new String[s]);
if (notlocal.length == 0) {
return localdc;
}
if (notlocal.length == 1) {
return notlocal[0];
}
Random rand = new Random();
return notlocal[rand.nextInt(notlocal.length)];
}
private static String getLocalDC(String hostname, String defaultdatacenter, String[] datacenters) {
for (String dc : datacenters) {
if (hostname.indexOf("." + dc + ".") >= 0) {
return dc;
}
}
return defaultdatacenter;
}
private static final String getHostNameOfServer() {
try {
return InetAddress.getLocalHost().getCanonicalHostName().toLowerCase();
} catch (UnknownHostException ex) {
// logging error
}
return null;
}
public static String getLocalString(DataFlowEnum dataFlowType) {
return dataFlowType.equals(DataFlowEnum.RECO) ? localReco : localUnReco;
}
public static String getRemoteString(DataFlowEnum dataFlowType) {
return dataFlowType.equals(DataFlowEnum.RECO) ? remoteReco : remoteUnReco;
}
public static String getCurrentDatacenter() {
return localDatacenter;
}
public static String getCurrentHostName() {
return localHost;
}
public static void main(String[] args) {
System.out.println(getCurrentDatacenter());
System.out.println(getCurrentHostName());
System.out.println(getLocalString(DataFlowEnum.RECO));
System.out.println(getLocalString(DataFlowEnum.UNRECO));
System.out.println(getRemoteString(DataFlowEnum.RECO));
System.out.println(getRemoteString(DataFlowEnum.UNRECO));
}
}
Here is what I imagine a config file could look like:
dev_domain_part = dev
dev_local_datacenter = dhp
dev_remote_datacenter = dhp
datacenter_names = dhp slp ltr
datacenter_default = dhp
reco_prefix = /tr/datacenter/
reco_suffix =
unreco_prefix = /trpp/datacenter/
unreco_suffix =
This is how I would read it:
import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Properties;
import java.util.Random;
import java.util.stream.Stream;
@SuppressWarnings("javadoc")
public class DatacenterDetail {
private static final String keyCheckDev = "dev_domain_part";
private static final String keyDevLocalDatacenter = "dev_local_datacenter";
private static final String keyDevRemoteDatacenter = "dev_remote_datacenter";
private static final String keyDatacenters = "datacenter_names";
private static final String keyDefaultDatacenter = "datacenter_default";
private static final String keyRecoPrefix = "reco_prefix";
private static final String keyRecoSuffix = "reco_suffix";
private static final String keyUnRecoPrefix = "unreco_prefix";
private static final String keyUnRecoSuffix = "unreco_suffix";
private static final String localHost;
private static final String localDatacenter;
private static final String localReco;
private static final String localUnReco;
private static final String remoteReco;
private static final String remoteUnReco;
static {
Properties props = loadProperties();
localHost = getHostNameOfServer();
String devCheck = props.getProperty(keyCheckDev, ".dev.");
String recoPrefix = props.getProperty(keyRecoPrefix, "/tr/datacenter/");
String recoSuffix = props.getProperty(keyRecoSuffix, "");
String unrecoPrefix = props.getProperty(keyUnRecoPrefix, "/tr/datacenter/");
String unrecoSuffix = props.getProperty(keyUnRecoSuffix, "");
if (!DataUtils.isProduction() || localHost.indexOf("." + devCheck + ".") >= 0) {
// we are running on a dev machine. Force the system in to dev mode.
localDatacenter = props.getProperty(keyDevLocalDatacenter, "dhp");
String remotedc = props.getProperty(keyDevRemoteDatacenter, "dhp");
localReco = recoPrefix + localDatacenter + recoSuffix;
localUnReco = unrecoPrefix + localDatacenter + unrecoSuffix;
remoteReco = recoPrefix + remotedc + recoSuffix;
remoteUnReco = unrecoPrefix + remotedc + unrecoSuffix;
} else {
String defaultdatacenter = props.getProperty(keyDefaultDatacenter, "dhp");
String[] datacenters = props.getProperty(keyDatacenters, "dhp slp ltr").trim().split("\\s+");
localDatacenter = getLocalDC(localHost, defaultdatacenter, datacenters);
String remotedc = getRandomRemote(localDatacenter, datacenters);
localReco = recoPrefix + localDatacenter + recoSuffix;
remoteReco = recoPrefix + remotedc + recoSuffix;
localUnReco = unrecoPrefix + localDatacenter + unrecoSuffix;
remoteUnReco = unrecoPrefix + remotedc + unrecoSuffix;
}
}
private static Properties loadProperties() {
String cname = DatacenterDetail.class.getName();
String propname = "/" + cname.replace('.', '/') + ".properties";
Properties props = new Properties();
try (InputStream is = DatacenterDetail.class.getResourceAsStream(propname)) {
if (is == null) {
throw new IllegalStateException("Cannot locate properties " + propname);
}
props.load(is);
} catch (IOException e) {
e.printStackTrace();
throw new IllegalStateException("Unable to load proprties from system resource " + propname, e);
}
return props;
}
private static String getRandomRemote(String localdc, String[] datacenters) {
String[] notlocal = Stream.of(datacenters).filter(dc -> !localdc.equals(dc)).toArray(s -> new String[s]);
if (notlocal.length == 0) {
return localdc;
}
if (notlocal.length == 1) {
return notlocal[0];
}
Random rand = new Random();
return notlocal[rand.nextInt(notlocal.length)];
}
private static String getLocalDC(String hostname, String defaultdatacenter, String[] datacenters) {
for (String dc : datacenters) {
if (hostname.indexOf("." + dc + ".") >= 0) {
return dc;
}
}
return defaultdatacenter;
}
private static final String getHostNameOfServer() {
try {
return InetAddress.getLocalHost().getCanonicalHostName().toLowerCase();
} catch (UnknownHostException ex) {
// logging error
}
return null;
}
public static String getLocalString(DataFlowEnum dataFlowType) {
return dataFlowType.equals(DataFlowEnum.RECO) ? localReco : localUnReco;
}
public static String getRemoteString(DataFlowEnum dataFlowType) {
return dataFlowType.equals(DataFlowEnum.RECO) ? remoteReco : remoteUnReco;
}
public static String getCurrentDatacenter() {
return localDatacenter;
}
public static String getCurrentHostName() {
return localHost;
}
public static void main(String[] args) {
System.out.println(getCurrentDatacenter());
System.out.println(getCurrentHostName());
System.out.println(getLocalString(DataFlowEnum.RECO));
System.out.println(getLocalString(DataFlowEnum.UNRECO));
System.out.println(getRemoteString(DataFlowEnum.RECO));
System.out.println(getRemoteString(DataFlowEnum.UNRECO));
}
}
Here is what I imagine a config file could look like:
dev_domain_part = dev
dev_local_datacenter = dhp
dev_remote_datacenter = dhp
datacenter_names = dhp slp ltr
datacenter_default = dhp
reco_prefix = /tr/datacenter/
reco_suffix =
unreco_prefix = /trpp/datacenter/
unreco_suffix =
This is how I would read it:
import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Properties;
import java.util.Random;
import java.util.stream.Stream;
@SuppressWarnings("javadoc")
public class DatacenterDetail {
private static final String keyCheckDev = "dev_domain_part";
private static final String keyDevLocalDatacenter = "dev_local_datacenter";
private static final String keyDevRemoteDatacenter = "dev_remote_datacenter";
private static final String keyDatacenters = "datacenter_names";
private static final String keyDefaultDatacenter = "datacenter_default";
private static final String keyRecoPrefix = "reco_prefix";
private static final String keyRecoSuffix = "reco_suffix";
private static final String keyUnRecoPrefix = "unreco_prefix";
private static final String keyUnRecoSuffix = "unreco_suffix";
private static final String localHost;
private static final String localDatacenter;
private static final String localReco;
private static final String localUnReco;
private static final String remoteReco;
private static final String remoteUnReco;
static {
Properties props = loadProperties();
localHost = getHostNameOfServer();
String devCheck = props.getProperty(keyCheckDev, ".dev.");
String recoPrefix = props.getProperty(keyRecoPrefix, "/tr/datacenter/");
String recoSuffix = props.getProperty(keyRecoSuffix, "");
String unrecoPrefix = props.getProperty(keyUnRecoPrefix, "/tr/datacenter/");
String unrecoSuffix = props.getProperty(keyUnRecoSuffix, "");
if (!DataUtils.isProduction() || localHost.indexOf("." + devCheck + ".") >= 0) {
// we are running on a dev machine. Force the system in to dev mode.
localDatacenter = props.getProperty(keyDevLocalDatacenter, "dhp");
String remotedc = props.getProperty(keyDevRemoteDatacenter, "dhp");
localReco = recoPrefix + localDatacenter + recoSuffix;
localUnReco = unrecoPrefix + localDatacenter + unrecoSuffix;
remoteReco = recoPrefix + remotedc + recoSuffix;
remoteUnReco = unrecoPrefix + remotedc + unrecoSuffix;
} else {
String defaultdatacenter = props.getProperty(keyDefaultDatacenter, "dhp");
String[] datacenters = props.getProperty(keyDatacenters, "dhp slp ltr").trim().split("\\s+");
localDatacenter = getLocalDC(localHost, defaultdatacenter, datacenters);
String remotedc = getRandomRemote(localDatacenter, datacenters);
localReco = recoPrefix + localDatacenter + recoSuffix;
remoteReco = recoPrefix + remotedc + recoSuffix;
localUnReco = unrecoPrefix + localDatacenter + unrecoSuffix;
remoteUnReco = unrecoPrefix + remotedc + unrecoSuffix;
}
}
private static Properties loadProperties() {
String cname = DatacenterDetail.class.getName();
String propname = "/" + cname.replace('.', '/') + ".properties";
Properties props = new Properties();
try (InputStream is = DatacenterDetail.class.getResourceAsStream(propname)) {
if (is == null) {
throw new IllegalStateException("Cannot locate properties " + propname);
}
props.load(is);
} catch (IOException e) {
e.printStackTrace();
throw new IllegalStateException("Unable to load proprties from system resource " + propname, e);
}
return props;
}
private static String getRandomRemote(String localdc, String[] datacenters) {
String[] notlocal = Stream.of(datacenters).filter(dc -> !localdc.equals(dc)).toArray(s -> new String[s]);
if (notlocal.length == 0) {
return localdc;
}
if (notlocal.length == 1) {
return notlocal[0];
}
Random rand = new Random();
return notlocal[rand.nextInt(notlocal.length)];
}
private static String getLocalDC(String hostname, String defaultdatacenter, String[] datacenters) {
for (String dc : datacenters) {
if (hostname.indexOf("." + dc + ".") >= 0) {
return dc;
}
}
return defaultdatacenter;
}
private static final String getHostNameOfServer() {
try {
return InetAddress.getLocalHost().getCanonicalHostName().toLowerCase();
} catch (UnknownHostException ex) {
// logging error
}
return null;
}
public static String getLocalString(DataFlowEnum dataFlowType) {
return dataFlowType.equals(DataFlowEnum.RECO) ? localReco : localUnReco;
}
public static String getRemoteString(DataFlowEnum dataFlowType) {
return dataFlowType.equals(DataFlowEnum.RECO) ? remoteReco : remoteUnReco;
}
public static String getCurrentDatacenter() {
return localDatacenter;
}
public static String getCurrentHostName() {
return localHost;
}
public static void main(String[] args) {
System.out.println(getCurrentDatacenter());
System.out.println(getCurrentHostName());
System.out.println(getLocalString(DataFlowEnum.RECO));
System.out.println(getLocalString(DataFlowEnum.UNRECO));
System.out.println(getRemoteString(DataFlowEnum.RECO));
System.out.println(getRemoteString(DataFlowEnum.UNRECO));
}
}
lang-java