Overhead associated with Exception vs Throwable in Java -
I know
throwing a new exception ();
There is a huge overhead because it creates a full stacktrace, etc. What to
Throw new throttle ();
The same problem exists? Is this behavior inherited, or is there a small (O) overhead to throw throttle?
Edit
From an Analyzer point, a user entering an incorrect password makes an exception to the general execution order of a program. So if I have:
Public session new session () {validate_user_and_password (); }
Throwing a UserNotValidException will correct from the Analysts point. Returning null
or 0
just seems incorrect if your code is pretty intangible I just wanted to know if I could actually implement this code I am, or if I have to leave it on the theory.
Programming-Point-of-View Exceptions and Analysts - Note-Off-View Exceptions.
Note: I have given a very simple and silly example, this is not my case.
Note 2: I know null
will be a normal thing, but I need a summary and oo code properly, and, personally, I do not see any harm in it.
throbble
is also created when it is created. From:
The throwable contains a snapshot of its thread's execution stack that was created at that time.
When creating a stacktrace, there should be no difference between exception
and throbbing
.
If you are using an exception for "extraordinary incidents" (as you should have), then you should not be very worried with the overhead of a stacktrace. An extraordinary event code rarely occurs in the code. Therefore, exceptions should not affect the performance of the normal code in any important way.
Comments
Post a Comment