Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add runAsThread method to ProcessModule & make ProcessModule serializable #625

Merged
merged 1 commit into from
Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package neqsim.processSimulation.processSystem;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
Expand All @@ -21,7 +21,7 @@

*/

public class ProcessModule extends SimulationBaseClass {
public class ProcessModule extends SimulationBaseClass implements Serializable{

private static final long serialVersionUID = 1000;
private static final Logger logger = LogManager.getLogger(ProcessModule.class);
Expand Down Expand Up @@ -208,4 +208,17 @@ public boolean solved() {
return solved;
}

/**
* <p>
* runAsThread.
* </p>
*
* @return a {@link java.lang.Thread} object
*/
public Thread runAsThread() {
Thread processThread = new Thread(this);
processThread.start();
return processThread;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,11 @@ public void runProcessTEG() throws InterruptedException {
modules.add(module2);
modules.add(module3);
modules.add(module4);
modules.run();

Thread runThr = modules.runAsThread();
try {
runThr.join(100000);
} catch (Exception ex) {
}
}
}