File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed
src/main/java/com/cisco/trex Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ public abstract class ClientBase {
6262 protected TRexTransport transport ;
6363 protected String apiH ;
6464 protected String masterHandler ;
65+ private XstatsNames xstatsNames ;
6566
6667 private static Gson buildGson () {
6768 GsonBuilder gsonBuilder = new GsonBuilder ();
@@ -360,9 +361,13 @@ public ExtendedPortStatistics getExtendedPortStatistics(int portIndex) {
360361 }
361362
362363 private XstatsNames getPortStatNames (int portIndex ) {
363- Map <String , Object > parameters = new HashMap <>();
364- parameters .put (PORT_ID , portIndex );
365- return callMethod ("get_port_xstats_names" , parameters , XstatsNames .class ).get ();
364+ if (xstatsNames == null ) {
365+ Map <String , Object > parameters = new HashMap <>();
366+ parameters .put (PORT_ID , portIndex );
367+ xstatsNames = callMethod ("get_port_xstats_names" , parameters , XstatsNames .class ).get ();
368+ }
369+
370+ return xstatsNames ;
366371 }
367372
368373 /**
Original file line number Diff line number Diff line change 3535public class TRexAstfClient extends ClientBase {
3636
3737 private static final String ASTF = "ASTF" ;
38+ private MetaData counterMetaData ;
3839
3940 /**
4041 * @param host
@@ -359,8 +360,12 @@ public AstfStatistics getAstfTotalStatistics() {
359360 }
360361
361362 private MetaData getAstfStatsMetaData () {
362- Map <String , Object > payload = createPayload ();
363- return callMethod ("get_counter_desc" , payload , MetaData .class ).get ();
363+ if (counterMetaData == null ) {
364+ Map <String , Object > payload = createPayload ();
365+ counterMetaData = callMethod ("get_counter_desc" , payload , MetaData .class ).get ();
366+ }
367+
368+ return counterMetaData ;
364369 }
365370
366371 /**
You can’t perform that action at this time.
0 commit comments