2bfc3d0bde
InflowControlManager에서 공통 로직을 AbstractInflowControlManager로 분리하고, 커맨드 클래스들이 AbstractInflowControlManager 타입을 사용하도록 변경. InflowControlUtil에 cachedInflowControlManager 정적 캐시 도입. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
57 lines
1.6 KiB
Java
57 lines
1.6 KiB
Java
package com.eactive.eai.agent.inflow;
|
|
|
|
import com.eactive.eai.agent.command.Command;
|
|
import com.eactive.eai.agent.command.CommandException;
|
|
import com.eactive.eai.common.inflow.AbstractInflowControlManager;
|
|
import com.eactive.eai.common.inflow.InflowControlUtil;
|
|
import com.eactive.eai.common.util.Logger;
|
|
|
|
public class ReloadInflowAdapterControlCommand extends Command {
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
public ReloadInflowAdapterControlCommand() {
|
|
super("ReloadInflowAdapterControlCommand");
|
|
}
|
|
|
|
public Object execute() throws CommandException {
|
|
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
|
if (logger.isInfo())
|
|
logger.info(this.name + " is executed");
|
|
|
|
if (!(args instanceof String)) {
|
|
String rspErrorCode = "RECEAIMCM001";
|
|
String msg = makeException(rspErrorCode, null);
|
|
if (logger.isError())
|
|
logger.error(msg);
|
|
throw new CommandException(msg);
|
|
}
|
|
|
|
String keyName = (String) args;
|
|
try {
|
|
AbstractInflowControlManager manager = InflowControlUtil.getInflowControlManager();
|
|
|
|
if (keyName != null) {
|
|
if ("ALL".equals(keyName)) {
|
|
manager.reloadAdapter();
|
|
if (logger.isWarn())
|
|
logger.warn(this.name + "] all rule Reload.");
|
|
} else {
|
|
manager.reloadAdapter(keyName);
|
|
if (logger.isWarn())
|
|
logger.warn(this.name + "] " + keyName + " Reload.");
|
|
}
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
String rspErrorCode = "RECEAIMCM002";
|
|
String msg = makeException(rspErrorCode, e);
|
|
if (logger.isError())
|
|
logger.error(msg, e);
|
|
throw new CommandException(msg);
|
|
}
|
|
return "success";
|
|
|
|
}
|
|
|
|
}
|