hi all i am using a user defined exception in my project to indicate whether the operation done by a particular method is a success or a failure. A large no of components are goin to use this exception for signalling of the failure thru a log writer which will throw the exception the flow is somewhat like this Component.method(fails)>>LOGWriter.StaticMethod()>>MyException. * the LOGWriter is a class having a static method which writes the errormesg to a file as well as throw the error. now the question b4 me is when the traffic gets heavy i think the LOGWriter may not be able to handle the flow even with synchronisation. pls suggest any solution for the scenario keeping heavy traffic as the primary requirement.......
Peter den Haan
Joined: Apr 20, 2000
You are likely to get scalability problems, but not where you think - it might well be the exception handling that's going to bite you. Please realise that throwing an exception is a heavyweight operation. Exceptions should be just that: ways to handle exceptional cases that are not part of the normal program flow. If you expect a sizeable number of operations to fail then arguably that should not be handled using an exception. - Peter
Joined: Jan 02, 2002
I am not sure why you are throwing the exception from the LOGWriter's method, not the component's method. However, for high traffic it would be best to keep the method threadsafe without using synchronization, that is by using local variables only.
tobe bondhu nouka bherao<br />shonabo gaan aj shara raat