如何解决是否可以使用 Java 代码进行维护或中断?
如何在另一个块中的另一个事件发生时将资源池中的所有资源单元发送到维护或中断?
我正在寻找类似的东西:resourcePool.startMainteinance() 并将其写在流程图的其他一些块中的“开始时”框中。当然,我需要使用诸如 resourcePool.stopMainteinance() 之类的东西来结束维护并恢复资源单元正在执行的所有任务。
有什么想法吗?或者手动暂停所有资源执行其任务然后恢复它们的想法?
注意:使用代码SizeBlock.suspend()和SizeBlock.resume()暂停在size块中捕获的agent不是一个选项,因为资源有准备任务,这些任务也需要暂停。
谢谢!
解决方法
您应该使用专为此设置设计的 module.exports = {
async getAllSupervisors(req,res) {
const id_supervisor = req.params.id_supervisor;
const sub = await Supervisor.findAll({
include: [
{
model: Tecnico,as: "tb_tech",where: {
id_supervisor: id_supervisor
}
}
]
});
// const resObj = sup.map((supervisor) => {
const resObj = [];
for (const supervisor of sub) {
resObj.push(
Object.assign(
{},{
id_supervisor: supervisor.id_supervisor,username: supervisor.username,email: supervisor.email,technician: supervisor.tb_tech.map((tec) => {
return Object.assign(
{},{
tech_id: tec.id_tech,id_user: await Usuario.findOne({
where: {
id_user: tec.id_user
},attributes: ["username"]
}),id_supervisor: tec.id_supervisor,zone: tec.zone,region: tec.region,full_name: tec.full_name,tech_type: tec.tech_type,goal: tec.goal,observations: tec.observations,client: tec.client
}
);
})
}
)
);
}
// });
res.status(200).json(resObj); //second
res.status(500).send({ message: error.message });
}
};
块。
您可以随心所欲地控制它。在您的情况下,Downtime
和 myDowntimeblock.startTask(someAgent)
有效。
还要检查名为“维护咖啡机”的示例模型:它显示了使用该块的所有其他方式。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。