我通过传递ipAddress来调用方法,它将返回ipAddress的位置,如Country,City等等.所以我试图看看它为每次调用花了多少时间.所以我在调用方法之前设置了start_time,在调用之后设置了end_time.所以有时我会得到0的差异.并且resp包含有效的响应.
long start_time = System.currentTimeMillis();
resp = GeoLocationService.getLocationIp(ipAddress);
long end_time = System.currentTimeMillis();
long difference = end_time-start_time;
Run Code Online (Sandbox Code Playgroud)
所以这意味着有时需要0毫秒来获得响应.任何建议将不胜感激.
java ×1