use of com.pamirs.pradar.exception.PradarException in project LinkAgent by shulieTech.
the class AfterTraceInterceptor method doAfter.
@Override
public final void doAfter(Advice advice) throws Throwable {
if (!simulatorConfig.getBooleanProperty("plugin." + getPluginName() + ".trace.enabled", true)) {
return;
}
ClusterTestUtils.validateClusterTest();
Throwable throwable = null;
try {
afterFirst(advice);
} catch (PradarException e) {
LOGGER.error("TraceInterceptor afterFirst exec err:{}", this.getClass().getName(), e);
throwable = e;
} catch (PressureMeasureError e) {
LOGGER.error("TraceInterceptor afterFirst exec err:{}", this.getClass().getName(), e);
throwable = e;
} catch (Throwable t) {
LOGGER.error("TraceInterceptor afterFirst exec err:{}", this.getClass().getName(), t);
throwable = t;
}
try {
if (isClient(advice)) {
endClientInvoke(advice);
} else {
endServerInvoke(advice);
}
} catch (PradarException e) {
LOGGER.error("TraceInterceptor after exec err:{}", this.getClass().getName(), e);
if (Pradar.isClusterTest()) {
throw e;
}
} catch (PressureMeasureError e) {
LOGGER.error("TraceInterceptor after exec err:{}", this.getClass().getName(), e);
if (Pradar.isClusterTest()) {
throw e;
}
} catch (Throwable e) {
if (Pradar.isClusterTest()) {
LOGGER.error("TraceInterceptor after exec err:{}", this.getClass().getName(), e);
throw new PressureMeasureError(e);
}
} finally {
try {
afterLast(advice);
} catch (PradarException e) {
LOGGER.error("TraceInterceptor afterLast exec err:{}", this.getClass().getName(), e);
throwable = e;
} catch (PressureMeasureError e) {
LOGGER.error("TraceInterceptor afterLast exec err:{}", this.getClass().getName(), e);
throwable = e;
} catch (Throwable t) {
LOGGER.error("TraceInterceptor afterLast exec err:{}", this.getClass().getName(), t);
throwable = t;
}
}
if (throwable != null && Pradar.isClusterTest()) {
throw throwable;
}
}
use of com.pamirs.pradar.exception.PradarException in project LinkAgent by shulieTech.
the class BeforeTraceInterceptor method doBefore.
@Override
public final void doBefore(Advice advice) throws Throwable {
if (!simulatorConfig.getBooleanProperty("plugin." + getPluginName() + ".trace.enabled", true)) {
return;
}
ClusterTestUtils.validateClusterTest();
Throwable throwable = null;
try {
beforeFirst(advice);
} catch (PradarException e) {
LOGGER.error("BeforeTraceInterceptor beforeFirst exec err:{}", this.getClass().getName(), e);
throwable = e;
} catch (PressureMeasureError e) {
LOGGER.error("BeforeTraceInterceptor beforeFirst exec err:{}", this.getClass().getName(), e);
throwable = e;
} catch (Throwable t) {
LOGGER.error("BeforeTraceInterceptor beforeFirst exec err:{}", this.getClass().getName(), t);
throwable = t;
}
try {
if (isClient(advice)) {
startClientInvoke(advice);
} else {
startServerInvoke(advice);
}
} catch (PradarException e) {
LOGGER.error("BeforeTraceInterceptor before exec err:{}", this.getClass().getName(), e);
if (Pradar.isClusterTest()) {
throw e;
}
} catch (PressureMeasureError e) {
LOGGER.error("BeforeTraceInterceptor before exec err:{}", this.getClass().getName(), e);
if (Pradar.isClusterTest()) {
throw e;
}
} catch (Throwable e) {
if (Pradar.isClusterTest()) {
LOGGER.error("BeforeTraceInterceptor before exec err:{}", this.getClass().getName(), e);
throw new PressureMeasureError(e);
}
} finally {
try {
beforeLast(advice);
} catch (PradarException e) {
LOGGER.error("BeforeTraceInterceptor beforeLast exec err:{}", this.getClass().getName(), e);
throwable = e;
} catch (PressureMeasureError e) {
LOGGER.error("BeforeTraceInterceptor beforeLast exec err:{}", this.getClass().getName(), e);
throwable = e;
} catch (Throwable t) {
LOGGER.error("BeforeTraceInterceptor beforeLast exec err:{}", this.getClass().getName(), t);
throwable = t;
}
}
if (throwable != null && Pradar.isClusterTest()) {
throw throwable;
}
}
use of com.pamirs.pradar.exception.PradarException in project LinkAgent by shulieTech.
the class ReverseTraceInterceptor method doBefore.
@Override
public final void doBefore(Advice advice) throws Throwable {
if (!simulatorConfig.getBooleanProperty("plugin." + getPluginName() + ".trace.enabled", true)) {
return;
}
ClusterTestUtils.validateClusterTest();
Throwable throwable = null;
try {
afterFirst(advice);
} catch (PradarException e) {
LOGGER.error("ReverseTraceInterceptor afterFirst exec err:{}", this.getClass().getName(), e);
throwable = e;
} catch (PressureMeasureError e) {
LOGGER.error("ReverseTraceInterceptor afterFirst exec err:{}", this.getClass().getName(), e);
throwable = e;
} catch (Throwable t) {
LOGGER.error("ReverseTraceInterceptor afterFirst exec err:{}", this.getClass().getName(), t);
throwable = t;
}
try {
if (isClient(advice)) {
endClientInvoke(advice);
} else {
endServerInvoke(advice);
}
} catch (PradarException e) {
LOGGER.error("ReverseTraceInterceptor after exec err:{}", this.getClass().getName(), e);
if (Pradar.isClusterTest()) {
throw e;
}
} catch (PressureMeasureError e) {
LOGGER.error("ReverseTraceInterceptor after exec err:{}", this.getClass().getName(), e);
if (Pradar.isClusterTest()) {
throw e;
}
} catch (Throwable e) {
if (Pradar.isClusterTest()) {
LOGGER.error("ReverseTraceInterceptor after exec err:{}", this.getClass().getName(), e);
throw new PressureMeasureError(e);
}
} finally {
try {
afterLast(advice);
} catch (PradarException e) {
LOGGER.error("ReverseTraceInterceptor afterLast exec err:{}", this.getClass().getName(), e);
throwable = e;
} catch (PressureMeasureError e) {
LOGGER.error("ReverseTraceInterceptor afterLast exec err:{}", this.getClass().getName(), e);
throwable = e;
} catch (Throwable t) {
LOGGER.error("ReverseTraceInterceptor afterLast exec err:{}", this.getClass().getName(), t);
throwable = t;
}
}
if (throwable != null && Pradar.isClusterTest()) {
throw throwable;
}
}
use of com.pamirs.pradar.exception.PradarException in project LinkAgent by shulieTech.
the class AdminAccessInfo method solveByConnection.
public static AdminAccessInfo solveByConnection(Connection connection) {
String username;
String password;
String host;
int port;
Object object = Reflect.on(connection).getSilence("credentialsProvider");
if (object != null) {
// 低版本
CredentialsProvider credentialsProvider = (CredentialsProvider) object;
username = credentialsProvider.getUsername();
password = credentialsProvider.getPassword();
} else {
username = Reflect.on(connection).getSilence("username");
password = Reflect.on(connection).getSilence("password");
if (username == null || password == null) {
throw new PradarException("未支持的rabbitmq版本!无法获取rabbit连接用户名密码");
}
}
InetAddress inetAddress = connection.getAddress();
String virtualHost = Reflect.on(connection).get("_virtualHost");
host = inetAddress.getHostAddress();
port = Integer.parseInt("1" + connection.getPort());
return new AdminAccessInfo(host, port, username, password, virtualHost);
}
use of com.pamirs.pradar.exception.PradarException in project LinkAgent by shulieTech.
the class ZkWithIpCacheSupport method putInZK.
private void putInZK(List<ConsumerApiResult> consumerApiResults) {
try {
if (zkClient.checkExists().forPath(zkDataPath) != null) {
zkClient.delete().deletingChildrenIfNeeded().forPath(zkDataPath);
}
zkClient.create().creatingParentsIfNeeded().forPath(zkDataPath);
Map<String, List<ConsumerApiResult>> ipGroupMap = ipGroup(consumerApiResults);
for (Entry<String, List<ConsumerApiResult>> entry : ipGroupMap.entrySet()) {
String ip = entry.getKey();
String jsonStr = JSON.toJSONString(entry.getValue());
byte[] bytes = jsonStr.getBytes("UTF-8");
logger.info("[RabbitMQ] prepare put consumers data to zk ip {} total bytes(uncompressed) : {}", ip, bytes.length);
zkClient.create().compressed().forPath(zkIpPath(ip), bytes);
logger.info("[RabbitMQ] put consumers data to zk ip {} total bytes(uncompressed) : {}", ip, bytes.length);
}
} catch (Exception e) {
throw new PradarException(e);
}
}
Aggregations