N
nukleus
I have some old java code for network related application.
The program uses several AWT frames that either
get/set various parameters, or perform a specific tasks
with their worker threads.
It is a multi-threaded design and each frame has its own
worker thread to perform a specific task.
There are all sorts of error conditions possible.
Since at any given point, just about any kind of error may occur,
it is desirable to exchange the information between the main
class and various other frames and their threads. If we decide
to abort any operation, all objects, threads and frames should
be properly informed and terminate their operation cleanly,
without memory leaks or any kind of unexpected error conditions.
Now, the catch is, since we run effectively a number of
different logical processes concurrently, any error condition
needs to be propagated properly to all the entities involved.
One way of doing it, is thru the main frame related class
that creates all worker frame objects and those objects
have a reference to the main frame class. So, no matter
what the situation is, they can communicate with each other,
setting error codes, performing different operations, etc.
But this seems to be a lil bit rigid approach as we hard link
between the main class and the worker classes.
Intuitively, it seems to be desirable to exchange the events
instead of using hard linked references.
Any opinions on this?
Thanks.
The program uses several AWT frames that either
get/set various parameters, or perform a specific tasks
with their worker threads.
It is a multi-threaded design and each frame has its own
worker thread to perform a specific task.
There are all sorts of error conditions possible.
Since at any given point, just about any kind of error may occur,
it is desirable to exchange the information between the main
class and various other frames and their threads. If we decide
to abort any operation, all objects, threads and frames should
be properly informed and terminate their operation cleanly,
without memory leaks or any kind of unexpected error conditions.
Now, the catch is, since we run effectively a number of
different logical processes concurrently, any error condition
needs to be propagated properly to all the entities involved.
One way of doing it, is thru the main frame related class
that creates all worker frame objects and those objects
have a reference to the main frame class. So, no matter
what the situation is, they can communicate with each other,
setting error codes, performing different operations, etc.
But this seems to be a lil bit rigid approach as we hard link
between the main class and the worker classes.
Intuitively, it seems to be desirable to exchange the events
instead of using hard linked references.
Any opinions on this?
Thanks.