-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#noissue] Refactor Executor Configuration
- Loading branch information
Showing
73 changed files
with
1,431 additions
and
1,354 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
collector/src/main/java/com/navercorp/pinpoint/collector/config/CollectorConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright 2023 NAVER Corp. | ||
* | ||
* Licensed 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 com.navercorp.pinpoint.collector.config; | ||
|
||
import com.navercorp.pinpoint.common.config.executor.ExecutorCustomizer; | ||
import com.navercorp.pinpoint.common.config.executor.ExecutorProperties; | ||
import com.navercorp.pinpoint.common.config.executor.ThreadPoolExecutorCustomizer; | ||
import com.navercorp.pinpoint.common.server.util.CallerUtils; | ||
import org.springframework.beans.factory.FactoryBean; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.scheduling.concurrent.ThreadPoolExecutorFactoryBean; | ||
import org.springframework.validation.annotation.Validated; | ||
|
||
import java.util.concurrent.ExecutorService; | ||
|
||
@Configuration | ||
public class CollectorConfiguration { | ||
|
||
@Bean | ||
public ExecutorCustomizer<ThreadPoolExecutorFactoryBean> collectorExecutorCustomizer() { | ||
return new ThreadPoolExecutorCustomizer(); | ||
} | ||
|
||
@Bean | ||
@Validated | ||
@ConfigurationProperties(prefix="collector.agent-event-worker") | ||
public ExecutorProperties agentEventWorkerExecutorProperties() { | ||
return new ExecutorProperties(); | ||
} | ||
|
||
@Bean | ||
public FactoryBean<ExecutorService> agentEventWorker(@Qualifier("collectorExecutorCustomizer") ExecutorCustomizer<ThreadPoolExecutorFactoryBean> executorCustomizer, | ||
@Qualifier("agentEventWorkerExecutorProperties") ExecutorProperties properties) { | ||
|
||
ThreadPoolExecutorFactoryBean factory = new ThreadPoolExecutorFactoryBean(); | ||
executorCustomizer.customize(factory, properties); | ||
|
||
String beanName = CallerUtils.getCallerMethodName(); | ||
factory.setThreadNamePrefix(beanName); | ||
return factory; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 0 additions & 94 deletions
94
collector/src/main/java/com/navercorp/pinpoint/collector/config/ExecutorProperties.java
This file was deleted.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
...rc/main/java/com/navercorp/pinpoint/collector/grpc/config/CollectorGrpcConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright 2023 NAVER Corp. | ||
* | ||
* Licensed 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 com.navercorp.pinpoint.collector.grpc.config; | ||
|
||
import com.codahale.metrics.MetricRegistry; | ||
import com.navercorp.pinpoint.collector.monitor.MonitoringExecutors; | ||
import com.navercorp.pinpoint.common.config.executor.ExecutorCustomizer; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.ImportResource; | ||
import org.springframework.scheduling.concurrent.ThreadPoolExecutorFactoryBean; | ||
|
||
@Configuration | ||
@ImportResource({ | ||
"classpath:applicationContext-collector-grpc.xml" | ||
}) | ||
public class CollectorGrpcConfiguration { | ||
|
||
@Bean | ||
public MonitoringExecutors monitoringExecutors( | ||
@Qualifier("collectorExecutorCustomizer") ExecutorCustomizer<ThreadPoolExecutorFactoryBean> customizer, | ||
@Autowired(required = false) MetricRegistry metricRegistry) { | ||
return new MonitoringExecutors(customizer, metricRegistry); | ||
} | ||
|
||
} |
Oops, something went wrong.