Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize agent module #23101

Merged
merged 8 commits into from
Dec 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion agent/bootstrap/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,21 @@
<dependencies>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-agent-core</artifactId>
<artifactId>shardingsphere-agent-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-agent-plugin-core</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
Expand Down Expand Up @@ -90,6 +104,14 @@
<pattern>org.apache.commons</pattern>
<shadedPattern>${shade.package}.org.apache.commons</shadedPattern>
</relocation>
<relocation>
<pattern>org.slf4j</pattern>
<shadedPattern>${shade.package}.org.slf4j</shadedPattern>
</relocation>
<relocation>
<pattern>ch.qos.logback</pattern>
<shadedPattern>${shade.package}.ch.qos.logback</shadedPattern>
</relocation>
</relocations>
<filters>
<filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@
import net.bytebuddy.matcher.ElementMatchers;
import org.apache.shardingsphere.agent.config.advisor.AdvisorConfiguration;
import org.apache.shardingsphere.agent.config.plugin.PluginConfiguration;
import org.apache.shardingsphere.agent.core.classloader.AgentClassLoader;
import org.apache.shardingsphere.agent.core.config.loader.PluginConfigurationLoader;
import org.apache.shardingsphere.agent.core.logging.LoggingListener;
import org.apache.shardingsphere.agent.core.plugin.PluginBootServiceManager;
import org.apache.shardingsphere.agent.core.plugin.PluginJar;
import org.apache.shardingsphere.agent.core.plugin.loader.AdvisorConfigurationLoader;
import org.apache.shardingsphere.agent.core.plugin.loader.AgentPluginLoader;
import org.apache.shardingsphere.agent.core.transformer.AgentJunction;
import org.apache.shardingsphere.agent.core.transformer.AgentTransformer;
import org.apache.shardingsphere.agent.bootstrap.classloader.AgentClassLoader;
import org.apache.shardingsphere.agent.bootstrap.config.loader.PluginConfigurationLoader;
import org.apache.shardingsphere.agent.bootstrap.logging.LoggingListener;
import org.apache.shardingsphere.agent.bootstrap.plugin.PluginBootServiceManager;
import org.apache.shardingsphere.agent.bootstrap.plugin.PluginJar;
import org.apache.shardingsphere.agent.bootstrap.plugin.loader.AdvisorConfigurationLoader;
import org.apache.shardingsphere.agent.bootstrap.plugin.loader.AgentPluginLoader;
import org.apache.shardingsphere.agent.bootstrap.transformer.AgentJunction;
import org.apache.shardingsphere.agent.bootstrap.transformer.AgentTransformer;

import java.io.IOException;
import java.lang.instrument.Instrumentation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
* limitations under the License.
*/

package org.apache.shardingsphere.agent.core.classloader;
package org.apache.shardingsphere.agent.bootstrap.classloader;

import com.google.common.io.ByteStreams;
import lombok.Getter;
import org.apache.shardingsphere.agent.core.plugin.loader.AgentPluginLoader;
import org.apache.shardingsphere.agent.core.plugin.PluginJar;
import org.apache.shardingsphere.agent.bootstrap.plugin.PluginJar;
import org.apache.shardingsphere.agent.bootstrap.plugin.loader.AgentPluginLoader;

import java.io.IOException;
import java.net.MalformedURLException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
* limitations under the License.
*/

package org.apache.shardingsphere.agent.core.config.loader;
package org.apache.shardingsphere.agent.bootstrap.config.loader;

import com.google.common.base.Preconditions;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.agent.bootstrap.config.yaml.entity.YamlPluginsConfiguration;
import org.apache.shardingsphere.agent.bootstrap.config.yaml.swapper.YamlPluginsConfigurationSwapper;
import org.apache.shardingsphere.agent.bootstrap.path.AgentPathBuilder;
import org.apache.shardingsphere.agent.config.plugin.PluginConfiguration;
import org.apache.shardingsphere.agent.core.config.yaml.entity.YamlPluginsConfiguration;
import org.apache.shardingsphere.agent.core.config.yaml.swapper.YamlPluginsConfigurationSwapper;
import org.apache.shardingsphere.agent.core.path.AgentPathBuilder;
import org.yaml.snakeyaml.Yaml;

import java.io.File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.agent.core.config.yaml.entity;
package org.apache.shardingsphere.agent.bootstrap.config.yaml.entity;

import lombok.Getter;
import lombok.Setter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.agent.core.config.yaml.entity;
package org.apache.shardingsphere.agent.bootstrap.config.yaml.entity;

import lombok.Getter;
import lombok.Setter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.agent.core.config.yaml.entity;
package org.apache.shardingsphere.agent.bootstrap.config.yaml.entity;

import lombok.Getter;
import lombok.Setter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
* limitations under the License.
*/

package org.apache.shardingsphere.agent.core.config.yaml.swapper;
package org.apache.shardingsphere.agent.bootstrap.config.yaml.swapper;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.agent.bootstrap.config.yaml.entity.YamlPluginCategoryConfiguration;
import org.apache.shardingsphere.agent.bootstrap.config.yaml.entity.YamlPluginConfiguration;
import org.apache.shardingsphere.agent.bootstrap.config.yaml.entity.YamlPluginsConfiguration;
import org.apache.shardingsphere.agent.config.plugin.PluginConfiguration;
import org.apache.shardingsphere.agent.core.config.yaml.entity.YamlPluginsConfiguration;
import org.apache.shardingsphere.agent.core.config.yaml.entity.YamlPluginCategoryConfiguration;
import org.apache.shardingsphere.agent.core.config.yaml.entity.YamlPluginConfiguration;

import java.util.LinkedHashMap;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
* limitations under the License.
*/

package org.apache.shardingsphere.agent.core.logging;
package org.apache.shardingsphere.agent.bootstrap.logging;

import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import org.apache.shardingsphere.agent.core.classloader.AgentClassLoader;
import org.apache.shardingsphere.agent.core.plugin.PluginJar;
import org.apache.shardingsphere.agent.bootstrap.classloader.AgentClassLoader;
import org.apache.shardingsphere.agent.bootstrap.plugin.PluginJar;

import java.io.File;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
* limitations under the License.
*/

package org.apache.shardingsphere.agent.core.logging;
package org.apache.shardingsphere.agent.bootstrap.logging;

import net.bytebuddy.agent.builder.AgentBuilder.Listener;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.dynamic.DynamicType;
import net.bytebuddy.utility.JavaModule;
import org.apache.shardingsphere.agent.core.logging.LoggerFactory.Logger;
import org.apache.shardingsphere.agent.bootstrap.logging.LoggerFactory.Logger;

/**
* Logging listener for ByteBuddy lifecycle.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.agent.core.path;
package org.apache.shardingsphere.agent.bootstrap.path;

import com.google.common.base.Preconditions;
import lombok.AccessLevel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
* limitations under the License.
*/

package org.apache.shardingsphere.agent.core.plugin;
package org.apache.shardingsphere.agent.bootstrap.plugin;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.agent.bootstrap.spi.PluginBootServiceRegistry;
import org.apache.shardingsphere.agent.config.plugin.PluginConfiguration;
import org.apache.shardingsphere.agent.core.logging.LoggerFactory;
import org.apache.shardingsphere.agent.core.logging.LoggerFactory.Logger;
import org.apache.shardingsphere.agent.core.spi.PluginBootServiceRegistry;
import org.apache.shardingsphere.agent.bootstrap.logging.LoggerFactory;
import org.apache.shardingsphere.agent.bootstrap.logging.LoggerFactory.Logger;

import java.io.IOException;
import java.util.Collection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.agent.core.plugin;
package org.apache.shardingsphere.agent.bootstrap.plugin;

/**
* Plugin Context.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.agent.core.plugin;
package org.apache.shardingsphere.agent.bootstrap.plugin;

import lombok.Getter;
import lombok.RequiredArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.agent.core.plugin.advisor;
package org.apache.shardingsphere.agent.bootstrap.plugin.advisor;

import org.apache.shardingsphere.agent.config.advisor.AdvisorConfiguration;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.agent.core.plugin.advisor;
package org.apache.shardingsphere.agent.bootstrap.plugin.advisor;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.agent.core.plugin.executor;
package org.apache.shardingsphere.agent.bootstrap.plugin.executor;

import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.dynamic.DynamicType.Builder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.agent.core.plugin.executor.type;
package org.apache.shardingsphere.agent.bootstrap.plugin.executor.type;

import lombok.RequiredArgsConstructor;
import net.bytebuddy.description.method.MethodDescription;
Expand All @@ -28,10 +28,10 @@
import net.bytebuddy.matcher.ElementMatchers;
import org.apache.shardingsphere.agent.advice.TargetAdviceObject;
import org.apache.shardingsphere.agent.advice.type.ConstructorAdvice;
import org.apache.shardingsphere.agent.core.logging.LoggerFactory;
import org.apache.shardingsphere.agent.core.logging.LoggerFactory.Logger;
import org.apache.shardingsphere.agent.core.plugin.PluginContext;
import org.apache.shardingsphere.agent.core.plugin.executor.AdviceExecutor;
import org.apache.shardingsphere.agent.bootstrap.logging.LoggerFactory;
import org.apache.shardingsphere.agent.bootstrap.logging.LoggerFactory.Logger;
import org.apache.shardingsphere.agent.bootstrap.plugin.PluginContext;
import org.apache.shardingsphere.agent.bootstrap.plugin.executor.AdviceExecutor;

import java.util.Collection;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.agent.core.plugin.executor.type;
package org.apache.shardingsphere.agent.bootstrap.plugin.executor.type;

import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
Expand All @@ -30,10 +30,10 @@
import net.bytebuddy.matcher.ElementMatchers;
import org.apache.shardingsphere.agent.advice.TargetAdviceObject;
import org.apache.shardingsphere.agent.advice.type.InstanceMethodAdvice;
import org.apache.shardingsphere.agent.core.logging.LoggerFactory;
import org.apache.shardingsphere.agent.core.logging.LoggerFactory.Logger;
import org.apache.shardingsphere.agent.core.plugin.PluginContext;
import org.apache.shardingsphere.agent.core.plugin.executor.AdviceExecutor;
import org.apache.shardingsphere.agent.bootstrap.plugin.executor.AdviceExecutor;
import org.apache.shardingsphere.agent.bootstrap.logging.LoggerFactory;
import org.apache.shardingsphere.agent.bootstrap.logging.LoggerFactory.Logger;
import org.apache.shardingsphere.agent.bootstrap.plugin.PluginContext;

import java.lang.reflect.Method;
import java.util.Collection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.agent.core.plugin.executor.type;
package org.apache.shardingsphere.agent.bootstrap.plugin.executor.type;

import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
Expand All @@ -28,10 +28,10 @@
import net.bytebuddy.implementation.bind.annotation.SuperCall;
import net.bytebuddy.matcher.ElementMatchers;
import org.apache.shardingsphere.agent.advice.type.StaticMethodAdvice;
import org.apache.shardingsphere.agent.core.logging.LoggerFactory;
import org.apache.shardingsphere.agent.core.logging.LoggerFactory.Logger;
import org.apache.shardingsphere.agent.core.plugin.PluginContext;
import org.apache.shardingsphere.agent.core.plugin.executor.AdviceExecutor;
import org.apache.shardingsphere.agent.bootstrap.logging.LoggerFactory;
import org.apache.shardingsphere.agent.bootstrap.logging.LoggerFactory.Logger;
import org.apache.shardingsphere.agent.bootstrap.plugin.PluginContext;
import org.apache.shardingsphere.agent.bootstrap.plugin.executor.AdviceExecutor;

import java.lang.reflect.Method;
import java.util.Collection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
* limitations under the License.
*/

package org.apache.shardingsphere.agent.core.plugin.loader;
package org.apache.shardingsphere.agent.bootstrap.plugin.loader;

import com.google.common.collect.ImmutableMap;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.agent.bootstrap.classloader.AgentClassLoader;
import org.apache.shardingsphere.agent.bootstrap.plugin.PluginJar;
import org.apache.shardingsphere.agent.bootstrap.plugin.yaml.loader.YamlAdvisorsConfigurationLoader;
import org.apache.shardingsphere.agent.bootstrap.plugin.yaml.swapper.YamlAdvisorsConfigurationSwapper;
import org.apache.shardingsphere.agent.bootstrap.spi.PluginBootServiceRegistry;
import org.apache.shardingsphere.agent.config.advisor.AdvisorConfiguration;
import org.apache.shardingsphere.agent.core.classloader.AgentClassLoader;
import org.apache.shardingsphere.agent.core.plugin.PluginJar;
import org.apache.shardingsphere.agent.core.plugin.yaml.loader.YamlAdvisorsConfigurationLoader;
import org.apache.shardingsphere.agent.core.plugin.yaml.swapper.YamlAdvisorsConfigurationSwapper;
import org.apache.shardingsphere.agent.core.spi.PluginBootServiceRegistry;
import org.apache.shardingsphere.agent.spi.PluginBootService;

import java.io.InputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
* limitations under the License.
*/

package org.apache.shardingsphere.agent.core.plugin.loader;
package org.apache.shardingsphere.agent.bootstrap.plugin.loader;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.agent.core.logging.LoggerFactory;
import org.apache.shardingsphere.agent.core.logging.LoggerFactory.Logger;
import org.apache.shardingsphere.agent.core.path.AgentPathBuilder;
import org.apache.shardingsphere.agent.core.plugin.PluginJar;
import org.apache.shardingsphere.agent.bootstrap.logging.LoggerFactory;
import org.apache.shardingsphere.agent.bootstrap.logging.LoggerFactory.Logger;
import org.apache.shardingsphere.agent.bootstrap.path.AgentPathBuilder;
import org.apache.shardingsphere.agent.bootstrap.plugin.PluginJar;

import java.io.File;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.agent.core.plugin.yaml.entity;
package org.apache.shardingsphere.agent.bootstrap.plugin.yaml.entity;

import lombok.Getter;
import lombok.Setter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.agent.core.plugin.yaml.entity;
package org.apache.shardingsphere.agent.bootstrap.plugin.yaml.entity;

import lombok.Getter;
import lombok.Setter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.agent.core.plugin.yaml.entity;
package org.apache.shardingsphere.agent.bootstrap.plugin.yaml.entity;

import lombok.Getter;
import lombok.Setter;
Expand Down
Loading