try {
agent.checkAgentProcess();
} catch (Exception e) {
-
- e.printStackTrace();
+ logger.error("exception occured in checkAgentProcess ", e);
}
agent.readAgentTopic();
} else {
private boolean checkStartup() {
FileInputStream input = null;
try {
- //this.mmagenthome = System.getProperty("MMAGENTHOME");
input = new FileInputStream(mmagenthome + "/etc/mmagent.config");
logger.info("mmagenthome is set :" + mmagenthome + " loading properties at /etc/mmagent.config");
} catch (IOException ex) {
- logger.error(mmagenthome + "/etc/mmagent.config not found. Set -DMMAGENTHOME and check the config file");
+ logger.error(mmagenthome + "/etc/mmagent.config not found.", ex);
return false;
} finally {
if (input != null) {
try {
input.close();
} catch (IOException e) {
- e.printStackTrace();
+ logger.error("exception occured in checkStartup "+e);
}
}
}
input = null;
try {
input = new FileInputStream(kafkahome + "/bin/kafka-run-class.sh");
- logger.info("kakahome is set :" + kafkahome);
+ logger.info("kafkahome is set :" + kafkahome);
} catch (IOException ex) {
- logger.error(kafkahome + "/bin/kafka-run-class.sh not found. Make sure kafka home is set correctly");
+ logger.error(kafkahome + "/bin/kafka-run-class.sh not found. Make sure kafka home is set correctly", ex);
return false;
} finally {
if (input != null) {
try {
input.close();
} catch (IOException e) {
- e.printStackTrace();
+ logger.error("exception occured in checkStartup "+e);
}
}
}
return false;
}
logger.info("Published to Topic :" + this.topicname + " Successfully");
- response = topicUtil.subscribeTopic(topicURL, topicname, "1", response, response);
+ response = topicUtil.subscribeTopic(topicURL, topicname, "1", mechid, password);
if (response != null && response.startsWith("ERROR:")) {
logger.error("Problem subscribing to topic, please verify the config " + this.topicname + " MR URL is:"
+ this.topicURL + " Error is: " + response);
prop.store(out, "");
} catch (Exception e) {
- e.printStackTrace();
+ logger.error("exception occured in checkPropertiesFile "+e);
}
} finally {
if (input != null) {
try {
input.close();
} catch (IOException e) {
- e.printStackTrace();
+ logger.error("exception occured in checkPropertiesFile ", e);
}
}
if (out != null) {
try {
out.close();
} catch (IOException e) {
- e.printStackTrace();
+ logger.error("exception occured in checkPropertiesFile "+e);
}
}
}
}
} catch (Exception e) {
- e.printStackTrace();
+ logger.error("exception occured in readAgentTopic ", e);
}
}
out = new FileOutputStream(mmagenthome + "/etc/mmagent.config");
mirrorMakerProperties.store(out, "");
} catch (IOException ex) {
- ex.printStackTrace();
+ logger.error("exception occured in createMirrorMaker ", ex);
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
- e.printStackTrace();
+ logger.error("exception occured in createMirrorMaker ", e);
}
}
}
} catch (InterruptedException e) {
}
} catch (IOException ex) {
- ex.printStackTrace();
+ logger.error("exception occured in updateMirrorMaker ", ex);
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
- e.printStackTrace();
+ logger.error("exception occured in updateMirrorMaker ", e);
}
}
}
} catch (InterruptedException e) {
}
} catch (IOException ex) {
- ex.printStackTrace();
+ logger.error("exception occured in updateWhiteList ", ex);
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
- e.printStackTrace();
+ logger.error("exception occured in updateWhiteList ", e);
}
}
}
File file = new File(path);
file.delete();
} catch (Exception ex) {
+ logger.error("exception occured in deleteMirrorMaker ", ex);
}
try {
String path = mmagenthome + "/etc/" + newMirrorMaker.name + "producer" + ".properties";
File file = new File(path);
file.delete();
} catch (Exception ex) {
+ logger.error("exception occured in deleteMirrorMaker ", ex);
}
Gson g = new Gson();
mirrorMakerProperties.setProperty("mirrormakers", g.toJson(this.mirrorMakers));
mirrorMakerProperties.store(out, "");
MirrorMakerProcessHandler.stopMirrorMaker(newMirrorMaker.name);
} catch (IOException ex) {
- ex.printStackTrace();
+ logger.error("exception occured in deleteMirrorMaker ", ex);
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
- e.printStackTrace();
+ logger.error("exception occured in deleteMirrorMaker ", e);
}
}
}
if (mirrorMakerProperties.getProperty("mirrormakers") == null) {
this.mirrorMakers = new ListMirrorMaker();
ArrayList<MirrorMaker> list = this.mirrorMakers.getListMirrorMaker();
- list = new ArrayList<MirrorMaker>();
+ list = new ArrayList<>();
this.mirrorMakers.setListMirrorMaker(list);
} else {
this.mirrorMakers = g.fromJson(mirrorMakerProperties.getProperty("mirrormakers"),
textEncryptor.setPassword(secret);
this.password = textEncryptor.decrypt(mirrorMakerProperties.getProperty("password"));
} catch (Exception ex) {
- // ex.printStackTrace();
+ logger.error("exception occured in loadProperties ", ex);
} finally {
if (input != null) {
try {
input.close();
} catch (IOException e) {
- // e.printStackTrace();
+ logger.error("exception occured in loadProperties ", e);
}
}
}