linghengqian opened a new issue, #685:
URL: https://github.com/apache/incubator-seata-samples/issues/685

   <!-- Please do not use this issue template to report security 
vulnerabilities but refer to our [security 
policy](https://github.com/apache/incubator-seata/security/policy). -->
   
   ## Why you need it?
    Is your feature request related to a problem? Please describe in details
   
   - I noticed that `org.apache.seata.api.BusinessService` was calling a 
non-public Java API to do health checks. Refer to 
https://github.com/apache/incubator-seata-samples/blob/3ae0a30e94ccb76eabf8ffc15863dbfa29bda598/at-sample/at-api/src/main/java/org/apache/seata/api/BusinessService.java
 .
   
   ```java
   import io.seata.core.exception.TransactionException;
   import io.seata.core.rpc.netty.RmNettyRemotingClient;
   import io.seata.rm.RMClient;
   import io.seata.tm.TMClient;
   import io.seata.tm.api.GlobalTransaction;
   import io.seata.tm.api.GlobalTransactionContext;
   import org.apache.seata.api.service.OrderService;
   import org.apache.seata.api.service.impl.AccountServiceImpl;
   import org.apache.seata.api.service.impl.OrderServiceImpl;
   import org.apache.seata.api.service.impl.StorageServiceImpl;
   import org.springframework.util.ReflectionUtils;
   
   import java.lang.reflect.Method;
   import java.sql.SQLException;
   import java.util.concurrent.TimeUnit;
   
   RmNettyRemotingClient rmNettyRemotingClient = 
RmNettyRemotingClient.getInstance();
           Class<? extends RmNettyRemotingClient> rmRemoteClass = 
rmNettyRemotingClient.getClass();
           ReflectionUtils.doWithFields(rmRemoteClass, field -> {
               if (field.getName().equals("clientChannelManager")) {
                   field.setAccessible(true);
                   //channelManger
                   Object o = field.get(rmNettyRemotingClient);
                   Method reconnect;
                   try {
                       reconnect = o.getClass().getDeclaredMethod("reconnect", 
String.class);
                       reconnect.setAccessible(true);
                       reconnect.invoke(o, "my_test_tx_group");
                   } catch (Exception e) {
                       throw new RuntimeException("reconnect failed!", e);
                   }
               }
           });
   ```
   - To do a health check, it is very strange to have to use reflection.
   
   ## How it could be?
   A clear and concise description of what you want to happen. You can explain 
more about input of the feature, and output of it.
   
   - No sure. Maybe expose the relevant API on the seata client side?
   
   ## Other related information
   Add any other context or screenshots about the feature request here.
   
   - Null.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@seata.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@seata.apache.org
For additional commands, e-mail: dev-h...@seata.apache.org

Reply via email to