答案 0 :(得分:9)
使用MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
ObjectName poolName = new ObjectName("com.zaxxer.hikari:type=Pool (foo)");
HikariPoolMXBean poolProxy = JMX.newMXBeanProxy(mBeanServer, poolName, HikariPoolMXBean.class);
int idleConnections = poolProxy.getIdleConnections();
和Math.sin
功能。注意:这些函数接受弧度,因此您需要使用Math.cos
:
rad = deg * Math.PI/180
答案 1 :(得分:1)
罪(角度)=对立/斜边
所以
反向= Sin(角度)*斜边
...因此
<script>
var angle = 88.52;
var angleInRadians = angle * Math.PI / 180;
var hypotenuse = 490;
var opposite = Math.sin(angleInRadians) * hypotenuse;
console.log('Opposite: ' + opposite);
console.log('Opposite (to 2 decimal places): ' + opposite.toFixed(2));
</script>
当然,您可以使用Math.cos而不是Math.sin来获得底值的等效值。