Skip to content

Commit 03ec5ea

Browse files
committed
optimize thrift adapter related
1 parent 050c5e2 commit 03ec5ea

File tree

6 files changed

+1068
-5
lines changed

6 files changed

+1068
-5
lines changed

example/example-adapter/example-adapter-thrift/pom.xml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,42 @@
6464
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
6565
</dependency>
6666
</dependencies>
67+
68+
<build>
69+
<extensions>
70+
<extension>
71+
<groupId>kr.motd.maven</groupId>
72+
<artifactId>os-maven-plugin</artifactId>
73+
<version>1.7.1</version>
74+
</extension>
75+
</extensions>
76+
<plugins>
77+
<plugin>
78+
<groupId>org.apache.thrift</groupId>
79+
<artifactId>thrift-maven-plugin</artifactId>
80+
<version>0.10.0</version>
81+
<configuration>
82+
<thriftExecutable>thrift</thriftExecutable>
83+
<thriftSourceRoot>${project.basedir}/src/main/thrift</thriftSourceRoot>
84+
<outputDirectory>${project.basedir}/src/main/java</outputDirectory>
85+
<generator>java</generator>
86+
87+
</configuration>
88+
<executions>
89+
<execution>
90+
<id>thrift-sources</id>
91+
<phase>generate-sources</phase>
92+
<goals>
93+
<goal>compile</goal>
94+
</goals>
95+
</execution>
96+
</executions>
97+
</plugin>
98+
<!-- Add Spring Boot Maven plugin -->
99+
<plugin>
100+
<groupId>org.springframework.boot</groupId>
101+
<artifactId>spring-boot-maven-plugin</artifactId>
102+
</plugin>
103+
</plugins>
104+
</build>
67105
</project>

example/example-adapter/example-adapter-thrift/src/main/java/org/dromara/dynamictp/example/ThriftExampleApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
/**
2626
* @author devin
27-
* @since 1.1.5
27+
* @since 1.2.2
2828
*/
2929
@EnableDynamicTp
3030
@SpringBootApplication(exclude = RedisAutoConfiguration.class)

example/example-adapter/example-adapter-thrift/src/main/java/org/dromara/dynamictp/example/controller/TestController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
/**
2828
* @author devin
29-
* @since 1.1.5
29+
* @since 1.2.2
3030
*/
3131
@Slf4j
3232
@RestController

example/example-adapter/example-adapter-thrift/src/main/java/org/dromara/dynamictp/example/thrift/ThriftClientService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* ThriftClientService related
3232
*
3333
* @author devin
34-
* @since 1.1.5
34+
* @since 1.2.2
3535
*/
3636
@Service
3737
@Slf4j

example/example-adapter/example-adapter-thrift/src/main/java/org/dromara/dynamictp/example/thrift/ThriftServerService.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package org.dromara.dynamictp.example.thrift;
1919

20+
import lombok.extern.slf4j.Slf4j;
2021
import org.apache.thrift.TProcessor;
2122
import org.apache.thrift.protocol.TBinaryProtocol;
2223
import org.apache.thrift.server.TThreadPoolServer;
@@ -35,9 +36,10 @@
3536
* ThriftServerService related
3637
*
3738
* @author devin
38-
* @since 1.1.5
39+
* @since 1.2.2
3940
*/
4041
@Service
42+
@Slf4j
4143
public class ThriftServerService implements SimpleService.Iface {
4244

4345
@Value("${thrift.server.port:9998}")
@@ -57,7 +59,7 @@ public void start() {
5759
.processor(processor)
5860
.protocolFactory(new TBinaryProtocol.Factory());
5961
server = new TThreadPoolServer(args);
60-
System.out.println("Starting Thrift server on port " + serverPort);
62+
log.info("Starting Thrift server on port {}", serverPort);
6163
server.serve();
6264
} catch (TTransportException e) {
6365
e.printStackTrace();

0 commit comments

Comments
 (0)