File tree Expand file tree Collapse file tree
transaction-dubbo/src/main/java/com/codingapi/tx/dubbo/listener
transaction-motan/src/main/java/com/codingapi/tx/motan/listener
transaction-springcloud/src/main/java/com/codingapi/tx/springcloud/listener
tx-client/src/main/java/com/codingapi/tx
tx-manager/src/main/java/com/codingapi/tm Expand file tree Collapse file tree Original file line number Diff line number Diff line change 132132 </execution >
133133 </executions >
134134 </plugin >
135+ <!-- 手动打包时,将下面的plugin注释掉 -->
135136 <plugin >
136137 <groupId >org.apache.maven.plugins</groupId >
137138 <artifactId >maven-gpg-plugin</artifactId >
Original file line number Diff line number Diff line change 1- package com .codingapi .tx .listener ;
1+ package com .codingapi .tx .dubbo . listener ;
22
33import com .codingapi .tx .listener .service .InitService ;
44import org .springframework .beans .BeansException ;
Original file line number Diff line number Diff line change 1+ package com .codingapi .tx .motan .listener ;
2+
3+ import com .codingapi .tx .listener .service .InitService ;
4+ import org .springframework .beans .BeansException ;
5+ import org .springframework .beans .factory .annotation .Autowired ;
6+ import org .springframework .context .ApplicationContext ;
7+ import org .springframework .context .ApplicationContextAware ;
8+ import org .springframework .stereotype .Component ;
9+
10+ /**
11+ * Created by lorne on 2017/7/1.
12+ */
13+ @ Component
14+ public class TransactionSocketListener implements ApplicationContextAware {
15+
16+
17+ @ Autowired
18+ private InitService initService ;
19+
20+
21+ @ Override
22+ public void setApplicationContext (ApplicationContext event ) throws BeansException {
23+ initService .start ();
24+ }
25+
26+ }
Original file line number Diff line number Diff line change 11package com .codingapi .tx .springcloud .listener ;
22
3+ import com .codingapi .tx .listener .service .InitService ;
4+ import org .slf4j .Logger ;
5+ import org .slf4j .LoggerFactory ;
6+ import org .springframework .beans .factory .annotation .Autowired ;
37import org .springframework .boot .context .embedded .EmbeddedServletContainerInitializedEvent ;
48import org .springframework .context .ApplicationListener ;
59import org .springframework .stereotype .Component ;
812@ Component
913public class ServerListener implements ApplicationListener <EmbeddedServletContainerInitializedEvent > {
1014
15+ private Logger logger = LoggerFactory .getLogger (ServerListener .class );
16+
1117 private int serverPort ;
1218
19+ @ Autowired
20+ private InitService initService ;
21+
1322 @ Override
1423 public void onApplicationEvent (EmbeddedServletContainerInitializedEvent event ) {
24+ logger .info ("onApplicationEvent -> onApplicationEvent. " +event .getEmbeddedServletContainer ());
1525 this .serverPort = event .getEmbeddedServletContainer ().getPort ();
26+
27+ initService .start ();
1628 }
1729
1830 public int getPort () {
Original file line number Diff line number Diff line change @@ -21,10 +21,5 @@ public class Constants {
2121 */
2222 public static int maxOutTime = 10000 ;
2323
24- /**
25- * 模块唯一标示
26- */
27- public static String uniqueKey ;
28-
2924
3025}
Original file line number Diff line number Diff line change 11package com .codingapi .tx .listener .service .impl ;
22
3- import com .codingapi .tx .Constants ;
43import com .codingapi .tx .listener .service .InitService ;
5- import com .codingapi .tx .listener .service .ModelNameService ;
64import com .codingapi .tx .netty .service .NettyService ;
75import org .slf4j .Logger ;
86import org .slf4j .LoggerFactory ;
@@ -20,20 +18,9 @@ public class InitServiceImpl implements InitService {
2018 @ Autowired
2119 private NettyService nettyService ;
2220
23-
24- @ Autowired
25- private ModelNameService modelNameService ;
26-
27-
2821 @ Override
2922 public void start () {
3023
31- /**
32- * 设置模块唯一标示
33- */
34-
35- Constants .uniqueKey = modelNameService .getUniqueKey ();
36-
3724 nettyService .start ();
3825 logger .info ("socket-start.." );
3926
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ private boolean isIp(String ipAddress) {
6060 public List <InstanceInfo > getConfigServiceInstances () {
6161 Application application = eurekaClient .getApplication (tmKey );
6262 if (application == null ) {
63- logger .error ("获取eureka服务失败! " );
63+ logger .error ("get eureka server error! " );
6464 }
6565 return application != null ? application .getInstances () : new ArrayList <>();
6666 }
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ public TxCoreServerHandler(NettyService nettyService) {
4848 @ Override
4949 public void channelRead (final ChannelHandlerContext ctx , Object msg ) throws Exception {
5050 final String json = SocketUtils .getJson (msg );
51- logger .info ("接受 ->" +json );
51+ logger .info ("request ->" +json );
5252 threadPool .execute (new Runnable () {
5353 @ Override
5454 public void run () {
You can’t perform that action at this time.
0 commit comments