This is a school assignment I have been working on. I've been back and forth with my tutor and he's been helping me with this but there's something I'm obviously missing here. The program in question takes an argument, "-f filename.txt" and in that filename are a list of things like this
FansOn, 2000
FansOff, 4000
Bell, 2000,5
The program does takes those names and creates classes using reflection and then calls the action() method of the generated classes (FansOn, etc.). It creates a thread for each class and then starts the thread, which generates a message like "Fan is on". On two of the events, PowerOut and WindowMalfunction, it throws a custom exception ControllerException which then needs to grab an object called GreenhouseControls
and serialize it to a file called dump.out
for later examination. The problem I'm having is being able to call my ghcSuspend()
method which should suspend all events immediately after the exception call. In fact, at this point my program just generates massive stack overflow issues. I don't know if I should post my entire code here because I obviously don't want someone else taking my course to just get handed the bulk of code so I don't know what I should post to make you guys understand my issue.
So in my main()
method, i create a GreenhouseControls
object called gc. GreenhouseControls is the name of the main class file. Eventually, I need this gc object in my custom exception, which is defined and caught in my events.class file