mirror of https://github.com/longtai-cn/hippo4j
parent
cc3abd0c3a
commit
79973ee9b8
@ -1,55 +0,0 @@
|
|||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright ownership.
|
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
* (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cn.hippo4j.agent.plugin.spring.common.interceptor;
|
|
||||||
|
|
||||||
import cn.hippo4j.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
|
||||||
import cn.hippo4j.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
|
|
||||||
import cn.hippo4j.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
|
|
||||||
import cn.hippo4j.agent.plugin.spring.common.support.SpringEnvironmentSupport;
|
|
||||||
import cn.hippo4j.agent.plugin.spring.common.support.SpringThreadPoolRegisterSupport;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.core.env.ConfigurableEnvironment;
|
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Event publishing run listener environment prepared interceptor
|
|
||||||
*/
|
|
||||||
public class SpringApplicationRunInterceptor implements InstanceMethodsAroundInterceptor {
|
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(SpringApplicationRunInterceptor.class);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, MethodInterceptResult result) throws Throwable {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Object ret) throws Throwable {
|
|
||||||
ConfigurableEnvironment environment = (ConfigurableEnvironment) allArguments[0];
|
|
||||||
SpringEnvironmentSupport.disableNonAgentSwitch(environment);
|
|
||||||
LOGGER.info("[Hippo4j-Agent] Switch off in non-Agent mode.");
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Throwable t) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in new issue