使用java线程监控设备压力和热量值的小作业
1.下面是英文作业要求:
Write a class Controller (extends Thread) that can poll the sensors concurrently to running the device. You should implement its run() method such that it starts the device and then monitors it by waiting for and examining any new sensor values. The controller shuts down the device if the heat sensor exceeds the value 70 or the pressure sensor the value 100. Also complete the run() method in the class Sensor which calls updateValue() continuously and signals the controller if its value has changed. You can print the heat and pressure value to console in the run() method of Controller to check
2.下面是自己翻译的内容,不一定准确,大神们可以再看看:
编写一个类控制器(扩展线程),可以同时轮询传感器运行设备。 您应该实现其run()方法,以便启动设备,然后通过等待和检查任何新的传感器值来监视它。 如果热传感器的值超过70,或者压力传感器的值为100,控制器将关闭设备。同样,在类Sensor中调用updateValue()的方法完成run()方法,并在控制器的值发生变化时通知控制器。 您可以在Controller的run()方法中打印热量和压力值以进行检查。
3.main方法中给的实例化的代码:
public static void main(String[] args) {
Device device = new Device();
Sensor heat = new Sensor(device);
Sensor pressure = new Sensor(device);
Controller controller = new Controller(device,heat,pressure);
controller.start();
heat.start();
pressure.start();
}
4.下面是输出结果:
Device started
heat -> 0.00 , pressure -> 0.00
heat -> 0.80 , pressure -> 2.10
heat -> 15.50 , pressure -> 15.40
heat -> 30.30 , pressure -> 31.10
heat -> 66.40 , pressure -> 68.90
heat -> 68.70 , pressure -> 132.60
Device shutting down due to maintenance
要求完成线程类的代码!!
Write a class Controller (extends Thread) that can poll the sensors concurrently to running the device. You should implement its run() method such that it starts the device and then monitors it by waiting for and examining any new sensor values. The controller shuts down the device if the heat sensor exceeds the value 70 or the pressure sensor the value 100. Also complete the run() method in the class Sensor which calls updateValue() continuously and signals the controller if its value has changed. You can print the heat and pressure value to console in the run() method of Controller to check
2.下面是自己翻译的内容,不一定准确,大神们可以再看看:
编写一个类控制器(扩展线程),可以同时轮询传感器运行设备。 您应该实现其run()方法,以便启动设备,然后通过等待和检查任何新的传感器值来监视它。 如果热传感器的值超过70,或者压力传感器的值为100,控制器将关闭设备。同样,在类Sensor中调用updateValue()的方法完成run()方法,并在控制器的值发生变化时通知控制器。 您可以在Controller的run()方法中打印热量和压力值以进行检查。
3.main方法中给的实例化的代码:
public static void main(String[] args) {
Device device = new Device();
Sensor heat = new Sensor(device);
Sensor pressure = new Sensor(device);
Controller controller = new Controller(device,heat,pressure);
controller.start();
heat.start();
pressure.start();
}
4.下面是输出结果:
Device started
heat -> 0.00 , pressure -> 0.00
heat -> 0.80 , pressure -> 2.10
heat -> 15.50 , pressure -> 15.40
heat -> 30.30 , pressure -> 31.10
heat -> 66.40 , pressure -> 68.90
heat -> 68.70 , pressure -> 132.60
Device shutting down due to maintenance
要求完成线程类的代码!!
...全文
相关推荐
java压力测试监控程序
java压力测试监控程序,完整的部署流程,源码打包方式。
Monkey测试–monkey压力测试及性能监控
基础环境 jdk1.8安装 sdk: 下载sdk:http://tools.android-studio.org/index.phph/sdk 配置环境变量:ANDROID_HOME=sdkpath path添加:%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools; adb命令:adb是Android调试桥 monkey使用 做App性能的测试 monkey操作的是手机里面的app 连接手机:打开USB调试模式 使用adb连接:adb devices(真机连接) monkey详解 包:在app上唯一标识一个APP的apppackage adb
使用JMeter 完成常用的压力测试
讲到测试,人们脑海中首先浮现的就是针对软件正确性的测试,即常说的功能测试。但是软件仅仅只是功能正确是不够的。在实际开发中,还有其它的非功能因素也起着决定性的因素,例如软件的响应速度。影响软件响应速度的因素有很多,有些是因为算法不够高效;还有些可能受用户并发数的影响。
压力测试java模拟
压力测试java模拟工程
java监控系统链接和内存使用情况
java监控系统链接和内存使用情况


Java SE
