Exception propagation

hi
I know that in the client server application that when an application call a stored procedure or function
procedure that stored on the database the exception is not propagated to the client
but I need to know what is the solution for this case .
thanks

and if so, will the caller of someFunction() be able to only
catch baseExceptionType or will it be able to catch
derivedExceptionType if required?The latter. As an aside, it would probably have been quicker for you to write 20 lines of code to test this than to post the question here and wait for replies, unless you're using a computer which doesn't have a Java compiler installed.

Similar Messages

  • Exception Propagation - Best Practises

    Hello,
    I was thinking what is the best practise for exception propogation.
    The way I know and have been doing is to specify an error page in my web.xml and in that I get a request paramater from the sesion ( which I populate in the catch blocks across the various classes) and display it to the user and ask him to contact the admin. Ofcourse I log them using log4j.
    I was wondering if there are other ways people do this (other than just displaying a "Sorry, Application Error" page and what do you think should be the best practise of exception handling and more importantly exception propagation.
    Thanks in advance for your time
    rgds,

    Sarvananda wrote:
    ...what do you think should be the best practise of exception handling and more importantly exception propagation.The very best practice is to always handle the exception, that is to say: never use empty "catch blocks".
    As already stated there are many correct ways to handle exceptions depending largely on the result you desire according to the exception. If you want feedback for debugging: I've made the errors descriptive... class/method and exception/error included in the message to the end user. This almost never works, since they never read it and if they report it, they just say: "I got this error thingy and it said to call you..." I got smarter the second time around and put the errors in logs, so when they actually called, then I could have them look up the error for me, or even better, just send me the log so I could see any other problems they didn't bother to report.
    It sounds like you are doing web development, one thing I have done in the past is to just pop up an e-mail ready to go with all the info in it. All the end user had to do is hit send.

  • RMI Exception Propagation

    I have a distributed app implemented in RMI. Sometimes when a client invokes a function on the server using the API provided, and the function call results in an exception (NullPointer, ArrayOutOfBounds etc) the exception is propagated all the way to the client even if the client is only catching RemoteException.
    Here's what I want to do:
    Have only User-defined exceptions propagated to the client. All other exceptions, should remain at the server level where I can handle them (log them, send an alert out etc). The API has hundreds of functions and I do not like the idea of putting try/catch in all of the functions in my *Impl classes. Is there an easier way to do this? Can someone explain how exception propagation works in RMI? Can I somehow propagate only UDF exceptions to the client and have the rest stay at the server even if the client uses try{...} catch(Exception e} ?
    I have googled this issue a lot of times and have failed to find an answer to this.
    I appreciate any help at all!
    Thanks.

    Here's what I want to do:
    Have only User-defined exceptions propagated to the
    client. All other exceptions, should remain at the
    server level where I can handle them (log them, send
    an alert out etc). The API has hundreds of functions
    and I do not like the idea of putting try/catch in
    all of the functions in my *Impl classes. Is there an
    easier way to do this? Can someone explain how
    exception propagation works in RMI? Can I somehow
    propagate only UDF exceptions to the client and have
    the rest stay at the server even if the client uses
    try{...} catch(Exception e} ?Exception propagation in RMI works just as you have experienced it. Any RuntimeException, Error, RemoteException, or declared exception that happens inside the server method is propagated to the client. You can't change this. I agree with cajo's idea of using a proxy around the stub to filter for you, but this will still mean that exceptions are logged &c at the client rather than at the server. You can watch & log exceptions at the server via sun.rmi.server.stackTrace=true.

  • DEBUG MESSAGE: new exception propagation across deoptimization

    Greetings,
    we're detecting the following error in our server logs:
    "DEBUG MESSAGE: new exception propagation across deoptimization has not been tested yet "
    Has anybody seen this message before?
    Could it be coming from the JVM?
    Thanks and apologies in advance if this is not the appropriate forum for this question,
    george.

    "exception propagation across deoptimization" sounds like a very HotSpot VM-specific words, referring to some complex internal mechanisms that it uses. However, it's very surprising if a production JVM prints them for a production program. To make sure it's really emitting this message, you can probably download the JVM source code from JVM and grep it for this phrase...

  • How to handle exception propagation in webservice client?

    Hi ,
    Is there a way to catch an exception thrown by Webservice server handler?
    We have a situation where we need to handle the exception on the client side thrown by the server handler.
    We are using Webspehere webservices created thru RAD 7 and clients are generated using axis 2 code generator tool. We generate WSDL from java class rather than Java from WSDL.
    We have vague idea that we can use wsld fault mechanism but does not have much implementation knowledge on it.
    Any ideas on this will be great help.
    Thanks in advance..

    Here is little more detail ::
    We have our regular webservices which has some business methods. Also we have a custom handler which extends javax.xml.rpc.handler.GenericHandler to handle requests [public boolean handleRequest(MessageContext context){
    return true;
    }] for all our application Webservices.
    So, in case of any application errors, handler throws an excpetion which we expect it to be caught in the client stub. e.g. if our application throws InvalidDataException with a specific message on it, we expect it to be caught in the client code as InvalidDataException with the original message on it.
    Is there a way to achieve this?
    Thanks,

  • Exception propagation on OSB

    We have few proxy services and business services which are calling each other in a chain manner. We are handling error at the level of root proxy service. The requirement is any error happen in the subsequent proxy service then that proxy service will throw the exception and root proxy service will handle the exception and log it. When we have implemented the solution it is working fine but the problem is all the subsequent proxy services are returning a generic error like "pipeline exception". We want the original exception happen at subsequent proxy services should propagate back to root proxy service level. By any means I can propagate the original exception back to the root proxy service? Any help will be appreciated.
    Regards,
    Kaushik

    Hi Kaushik,
    In local proxy's error handler, just put one action "reply with failure" and try again.
    http://download.oracle.com/docs/html/E15867_01/proxy_actions.htm#i1265265
    http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/eclipsehelp/tasks.html#wp1113095
    Regards,
    Anuj

  • DefineObjects throws exception

    I'm just trying to get a simple portlet running on 8.1 sp 2
    Error opening /bookmark_01/jsp/view.jsp.
    The source of this error is java.lang.NullPointerException at weblogic.utils.UnsyncHashtable.put(UnsyncHashtable.java:277)
    at weblogic.servlet.jsp.PageContextImpl.setAttribute(PageContextImpl.java:163)
    at com.bea.portlet.container.tags.DefineObjectsTag.doStartTag(DefineObjectsTag.java:39)
    at jsp_servlet._bookmark_01._jsp.__view._jspService(view.jsp:5) at com.bea.portlet.jsp.PortletJspBase.service(PortletJspBase.java:110)
    at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:971)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:402)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:446)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
    at co
    <%@ page session="false" %>
    <%@ page import="javax.portlet.*"%>
    <%@ page import="java.util.*"%>
    <%@ taglib uri='http://java.sun.com/portlet' prefix='portlet'%>
    <portlet:defineObjects/>
    Hello,<br>
    I am the bookmark portlet.<br>
    <br>
    Current Portlet Mode: <%=renderRequest.getPortletMode()%><br>
    Current Window State: <%=renderRequest.getWindowState()%><br>
    <br>

    You need to look into the API documentation for the Scanner class. The method invocations throw an IOException. Now, since these could throw an exception, they need to be handled when the call is made. So, there should either be a try-catch block [read the Java tutorial for exception handling] to handle the exception or the method [in this case, main] should let the exception propagate further. This exception propagation is achieved by the throws clause. throws keyword indicates that the method is going to throw the exception (while causing an abrupt end to the code within it) and this needs to be handled by any method calling it.
    In the specific case, since main is the entry point of the program, the exception (whenever thrown) will result in a stack trace being printed on the standard output device (screen) as a default behaviour.

  • This method should not be called anymore. The client was already released i

    Hi,
    while configuring Business Packager for Projects 50.3 fo, we made few changes in R/3 side as per the documentation. after that we are getting following error in portal
    "This method should not be called anymore. The client was already released into the pool or the pool entry was deleted"
    all the chages were reverted in R/3 system still we are getting the same error.
    Can any one help on this issue....
    Thanks in advance and for early responce higher marks would be awarded!!!..     
    Regards
    Ravi Sankar Karri

    Hi,
    Well there were errors in how stop works:
    "Stopping a thread with Thread.stop causes it to
    unlock all of the monitors that it has locked (as a
    natural consequence of the unchecked ThreadDeath
    exception propagating up the stack). If any of the
    objects previously protected by these monitors were in
    an inconsistent state, the damaged objects become
    visible to other threads, potentially resulting in
    arbitrary behavior. "
    I do understand that you want to have something like
    killTheTreadIDontCareAboutConcequences-method, but
    it's better to let all your methods that you want to
    be able to terminate take a timeout argument, and deal
    with the termination in the method. (Close the
    sockets/streams etc that you are blocking on).
    /KajThe point is, it is not always possible to make those blocking methods stop, via some magic "timeout" thingamabob. The bottom line is still that the blocking methods were written incorrectly to begin with (to possibly block indefinitely), so one cannot come up with an across-the-board solution, other than getting the root cause fixed in the first place. However, one is not always in control of fixing the root cause.

  • Webservice error messages

    Hi All
    I am using a web service to feed my flex application with
    data. When exceptions occur in the web service, I only get some
    generic error message in my fault handler. I would like to be able
    to get information such as error messages from the web service
    exceptions propagated to my web service fault handlers in my Flex
    Application.
    My web service is .Net based/C# and it is used in my Flex app
    by importing the WSDL file of the service.
    Here is an example with some code snippets:
    The web service has a HelloWorld webmethod which throws an
    exception. This webservice is imported into my flex app using the
    Data->Import Webservice feature, which autogenerates the
    webserivce class I am using. When I call the webservice from Flex,
    the fault handler is called but it only contains some generic error
    message.
    Code snippets: The C# webservice method which throws an
    exception:
    [WebMethod]
    public string HelloWorld()
    throw new Exception("Hello World Exception.");
    return "Hello World";
    And here is how I call the webservice in my FIex App:
    private function btnTestWebserviceClicked(event:Event):void
    var service:WebService = new WebService();
    service.addWebServiceFaultEventListener(faultHandler);
    service.addhelloWorldEventListener(webMethodDone);
    service.helloWorld();
    function webMethodDone(event:HelloWorldResultEvent):void
    Alert.show("Done", "Done");
    function faultHandler(event:FaultEvent):void
    Alert.show(event.fault.faultString, "Error");
    The information I can get from the faultEvent passed to the
    fault handler does not contain the error string but only the
    generic "HTTP request error" error message, and not the
    “Hello World Error String” which was passed to the
    exception thrown in the webservice.
    So my question is: How can I get information from web service
    exceptions propagated to my fault handlers in Flex?
    Any help, advice or pointers to articles will be much
    appreciated.
    Best regards Stig Nielsson

    Hi Stig,
    The root cause of the problem is that the body of the 500
    status code isn't returned to the flash player from the browsers.
    This prevents the Flash Player from passing it along to you. Keep
    in mind that the FlashPlayer is just a control that runs within the
    browser; as a result it's restricted by what the browser provides
    to it. The body of a 500 error message isn't one of the things
    provided to it.
    The Flash Player needs to play to the least common
    denominator and while some browsers do provide the web service's
    500 error body the Flash Player requires ubiquity. This is why the
    feature isn't implemented within the Flash Player... when all
    browsers provide this data then Adobe needs to add the feature.
    Adobe has logged a bug on these issues with the browser companies.
    To workaround the issue use LCDS or BlazeDS as proxies. They
    have been coded to return a 200 status response instead of the 500
    error allowing you to access the error message. Adobe has been
    aware of this issue and this is the suggested resolution to the
    problem. It's not ideal but it's the best we currently have
    available.
    Here's a great article that talks about this:
    http://blog.flexmonkeypatches.com/2008/05/16/soap-fault-messages-in-flexflash-player-error -2032-stream-error/
    -Kurt.

  • Write-through limitation and putAll

    Please find the quote below from developer guide, particularly this one In other words, if two cache entries are updated, triggering calls to CacheStore modules sitting on separate cache servers, it is possible for one database update to succeed and for the other to fail.If a putAll is called on a cache, will it result in one CacheStore.storeAll or many storeAll triggered from different coherence nodes/servers? (assume a distributed topology coherence 3.7.1)
    Will the store transaction failure lead to putAll transaction failure?
    Are there any patterns that shows how this coherence works with typical databases?
    14.7.2 Write-Through LimitationsCoherence does not support two-phase CacheStore operations across multiple CacheStore instances. In other words, if two cache entries are updated, triggering calls to CacheStore modules sitting on separate cache servers, it is possible for one database update to succeed and for the other to fail. In this case, it may be preferable to use a cache-aside architecture (updating the cache and database as two separate components of a single transaction) with the application server transaction manager. In many cases it is possible to design the database schema to prevent logical commit failures (but obviously not server failures). Write-behind caching avoids this issue as "puts" are not affected by database behavior (as the underlying issues have been addressed earlier in the design process).

    gs100 wrote:
    Thanks for the input, I have further questions based on these suggestions.
    1. Let us say one of the putAll fails we would know that it has failed due to underlying one or more store/storeAll. And even if we rollback the coherence transaction, the store/storeAll that succeeded would not be rolled back automatically, is that correct? If true, this means that it would leave the underlying DB/store in the inconsistent state with that of in-memory cache?I guess that is one of the reasons why the transaction framework does not support cache stores... also, write-behind would coalesce updates which would have funny consequences with regards to the transactional context...
    2. How do we get the custom implementation of putAll, that you suggested to handle specific errors? any pointers on this would be helpful.I guess it is not going to be posted, the Coherence team may or may not add something which is a bit more deterministic with regards to error.
    A few aspects of Coherence behaviour (a.k.a pitfalls) which you need to be aware of to be able to implement your own solution:
    Exceptions propagating back to the client can happen in:
    - entry-processor (not for putAll specifically)
    - result serialization code (not for putAll specifically, but for processAll/aggregate for example)
    - deserialization code (indexes/filter-based backing map listeners/cache stores lead to deserialization even for putAll)
    - triggers (intentionally, too)
    - cache stores
    There is no place where you could catch any exceptions from inside the NamedCache call, so they will come out.
    Coherence may execute the operation on one thread per partition or one thread per multiple partitions, but never on multiple threads per partition. This means there may be multiple exceptions even from a single storage node, but only at most one exception would be generated per partition (starting with 3.5).
    If you send multiple partitions with the same NamedCache call, you can lose exceptions as you wouldn't know if an exception would have or wouldn't have happened with a partition if it was sent alone instead of together with another on the same node.
    As you need to be able to return all exceptions from your method call, you have to produce and catch all of them and collect them otherwise you would lose all but one. To produce and catch all exceptions you have to produce all exceptions independently, i.e. different partitions must be operated on independently.
    To send an operation to a single partition only, you can separate the operations to different partitions by separating the keysets for different partitions with key-based operations, or applying a PartitionedFilter for filter-based operations.
    It is up to you where and how you iterate through the partitions. You can do it on the caller, you can do it on storage node from an Invocable sent via an InvocationService (in this case you can be either optimistic with ownership or chase a partition).
    3. Because we are thinking putAll that coherence implemented is most optimized (parallelism). I am not sure how the custom implementation can be as optimal (hope we don't end up calling one by one).You cannot implement it as optimally as Coherence itself does as it interleaves operations (Messages) to independent partitions/nodes (does not have to wait for the return message) from a single thread without waiting for the responses from individual nodes/partitions.
    You can either parallelize operations to multiple threads, or do the iteration on the single thread at the cost of higher latency.
    Best regards,
    Robert

  • Start from beginning in a Thread

    Hello!
    I have some problem of starting a Thread again when I have stoped it. The thing I want is that I want to start a Thread, then stop it and after that start the Thread from begining, and I can not use resume/suspend because the Thread should need to begin just after run. For example
    Class hello extends Thread
         run()
              // do something....
         main
              hello h=new hello();
              while(1>0)
              if(.....)
              h.start();
              if(.......)
              h.stop()
    Because of the while these if can happen many times and h will be stopped and started many times. But after I have stoped it once then when I try to start it, it wont start.
    I have solved this problem by making new Threads like h, h1, h2..... all the time but is there a way to do this with only one name of the Thread. And that when it is started then it should start from the beginning of the run.
    Regards
    Tomas

    Don't use stop():
    It was deprecated.
    "This method is inherently unsafe. Stopping a thread with Thread.stop causes it to unlock all of the monitors that it has locked (as a natural consequence of the unchecked ThreadDeath exception propagating up the stack). If any of the objects previously protected by these monitors were in an inconsistent state, the damaged objects become visible to other threads, potentially resulting in arbitrary behavior. Many uses of stop should be replaced by code that simply modifies some variable to indicate that the target thread should stop running. The target thread should check this variable regularly, and return from its run method in an orderly fashion if the variable indicates that it is to stop running. If the target thread waits for long periods (on a condition variable, for example), the interrupt method should be used to interrupt the wait."
    You can use wait() and notifyAll() inside synchronized block.

  • Cursor Variable in Nested Block

    Dear all,
    I have a package that has procedures that open cursor variables and print the queries of sample schema HR. There's one procedure that opens the cursor with an input integer to choose which query that wants to be fetched. The other prints the query by fetching the cursor in a nested block with exceptions. The following package runs as intended, it prints all the three options without any problems:
    CREATE OR REPLACE PACKAGE admin_data AS
    TYPE gencurtyp IS REF CURSOR;
    PROCEDURE open_cv (generic_cv IN OUT gencurtyp, choice INT);
    procedure print_cv (generic_cv gencurtyp);
    END admin_data;
    CREATE OR REPLACE PACKAGE BODY admin_data AS
    PROCEDURE open_cv (generic_cv IN OUT gencurtyp, choice INT) IS
    BEGIN
    IF choice = 1 THEN
    OPEN generic_cv FOR SELECT * FROM jobs where job_id='ST_MAN';
    ELSIF choice = 2 THEN
    OPEN generic_cv FOR SELECT * FROM departments where department_id=270;
    ELSIF choice = 3 THEN
    OPEN generic_cv FOR SELECT * FROM employees where employee_id=206;
    END IF;
    END;
    procedure print_cv (generic_cv gencurtyp)is
    employees_rec employees%rowtype;
    departments_rec departments%rowtype;
    jobs_rec jobs%rowtype;
    begin
    fetch generic_cv into jobs_rec;
    dbms_output.put_line(jobs_rec.job_title);
    exception
    when ROWTYPE_MISMATCH then
      begin
      fetch generic_cv into departments_rec;
      dbms_output.put_line(departments_rec.department_name);
      exception
      when ROWTYPE_MISMATCH then
        dbms_output.put_line('row mismatch');
        fetch generic_cv into employees_rec;
        dbms_output.put_line(employees_rec.first_name);
      when OTHERS then
        dbms_output.put_line('others');
        fetch generic_cv into employees_rec;
        dbms_output.put_line(employees_rec.first_name);
      end;
    end print_cv;
    END admin_data;
    declare
    some_cur admin_data.gencurtyp;
    begin
    admin_data.open_cv(some_cur,1);
    admin_data.print_cv(some_cur);
    admin_data.open_cv(some_cur,2);
    admin_data.print_cv(some_cur);
    admin_data.open_cv(some_cur,3);
    admin_data.print_cv(some_cur);
    admin_data.open_cv(some_cur,3);
    admin_data.print_cv(some_cur);
    admin_data.open_cv(some_cur,1);
    admin_data.print_cv(some_cur);
    admin_data.open_cv(some_cur,2);
    admin_data.print_cv(some_cur);
    end;
    17  /
    Stock Manager
    Payroll
    row mismatch
    William
    row mismatch
    William
    Stock Manager
    Payroll
    PL/SQL procedure successfully completed.The innermost block executes 'rowtype mismatch' exception block, which fetches
    SELECT * FROM employees where employee_id=206 query.
    This time, I switch the query fetch so that
    SELECT * FROM employees where employee_id=206query is in the outermost block and
    SELECT * FROM jobs where job_id='ST_MAN' is in the innermost block. The package body looks like this:
    CREATE OR REPLACE PACKAGE BODY admin_data AS
    PROCEDURE open_cv (generic_cv IN OUT gencurtyp, choice INT) IS
    BEGIN
    IF choice = 1 THEN
    OPEN generic_cv FOR SELECT * FROM jobs where job_id='ST_MAN';
    ELSIF choice = 2 THEN
    OPEN generic_cv FOR SELECT * FROM departments where department_id=270;
    ELSIF choice = 3 THEN
    OPEN generic_cv FOR SELECT * FROM employees where employee_id=206;
    END IF;
    END;
    procedure print_cv (generic_cv gencurtyp)is
    employees_rec employees%rowtype;
    departments_rec departments%rowtype;
    jobs_rec jobs%rowtype;
    begin
    fetch generic_cv into employees_rec;
    dbms_output.put_line(employees_rec.first_name);
    exception
    when ROWTYPE_MISMATCH then
      begin
      fetch generic_cv into departments_rec;
      dbms_output.put_line(departments_rec.department_name);
      exception
      when ROWTYPE_MISMATCH then
        dbms_output.put_line('row mismatch');
        fetch generic_cv into jobs_rec;
        dbms_output.put_line(jobs_rec.job_title);
      when OTHERS then
        dbms_output.put_line('others');
        fetch generic_cv into jobs_rec;
        dbms_output.put_line(jobs_rec.job_title);
      end;
    end print_cv;
    END admin_data;
    then I run the same anonymous block, I get:declare
    some_cur admin_data.gencurtyp;
    begin
    admin_data.open_cv(some_cur,1);
    admin_data.print_cv(some_cur);
    admin_data.open_cv(some_cur,2);
    admin_data.print_cv(some_cur);
    admin_data.open_cv(some_cur,3);
    admin_data.print_cv(some_cur);
    admin_data.open_cv(some_cur,3);
    admin_data.print_cv(some_cur);
    admin_data.open_cv(some_cur,1);
    admin_data.print_cv(some_cur);
    admin_data.open_cv(some_cur,2);
    admin_data.print_cv(some_cur);
    end;
    17 /
    others
    Payroll
    William
    William
    others
    Payroll
    PL/SQL procedure successfully completed.
    The strangest thing is the innermost block execute OTHERS exception block instead of ROWTYPE MISMATCH and the the record doesn't fetch anything. What happen? How come the result is different when I only switch the query?
    Best regards,
    Val

    Hi Sy,
    thanks for the reply, yes I agree that the code is cumbersome, I'm studying to prepare OCP PL/SQL certification, so I'm playing around with cursor variable in order to grasp the whole concept. I'm observing the behaviour of weak cursor variable when getting passed into a function and fetched couple of times and exploring exception propagation in the same time. This why the code looks not relevant in the real world.
    Anyway, I just curious how it behaves like that. Here's my instance info:
    SQL> select * from v$version
      2  ;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE     11.2.0.1.0     Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production

  • Delivery name should start from 0001

    Dear All,
    I open new organization and want to create delivery against that invoice in order management.
    I want to tell when I choose this organization my delivery name should start from 0001 and increment by 1.
    Please tell me where is this option?
    apps: 11.5.10
    db : 10.0.2
    Thanks

    Don't use stop():
    It was deprecated.
    "This method is inherently unsafe. Stopping a thread with Thread.stop causes it to unlock all of the monitors that it has locked (as a natural consequence of the unchecked ThreadDeath exception propagating up the stack). If any of the objects previously protected by these monitors were in an inconsistent state, the damaged objects become visible to other threads, potentially resulting in arbitrary behavior. Many uses of stop should be replaced by code that simply modifies some variable to indicate that the target thread should stop running. The target thread should check this variable regularly, and return from its run method in an orderly fashion if the variable indicates that it is to stop running. If the target thread waits for long periods (on a condition variable, for example), the interrupt method should be used to interrupt the wait."
    You can use wait() and notifyAll() inside synchronized block.

  • Handling OutOfMemoryError without terminating the application

    I have heard that this is "essentially impossible" and am willing to believe it, but I would like to hear why. As I understand it, if the error is caused by a heap allocation failure, and I can catch the exception and immediately make large objects available for garbage collection before I trigger any further heap allocation, then my application should continue to run normally. The only difficulty I can see is that OutOfMemoryError may be thrown on a GUI event-processing thread or other thread that the programmer doesn't control. If this problem can be overcome, and every thread is prepared to free large objects when handling OutOfMemoryError, then what other problems might be encountered?
    -David

    I looked up OutOfMemoryError in the JVM spec and didn't find anything that says OutOfMemoryError is any different from any other runtime error. I believe the difficulties have nothing to do with the error itself and everything to do with the severe nature of the condition that causes it -- please correct me if I'm wrong.No, that's pretty much correct. The JVM throws OOM when you try to allocate memory and it's unable to provide that memory, even after running garbage collection. Assuming that the OOM occurs in your main thread and you don't catch it, your program dies. But this isn't the only outcome, particularly in a multi-threaded application.
    Remember that an OOM will occur only when you try to allocate memory, and that the JVM runs a collection before throwing it. If you're allocating a huge array, there may not be enough space for that array, but there may be plenty of space for everything else your program is doing. Or, perhaps you really were pushing the limits of memory, but as the exception propagated up through the call tree it made objects eligible for collection. In that case, the next time you try to allocate memory, the JVM will run GC and you may have space available.
    The first step to take when you get an OOM error is to figure out why it happened -- not just what code caused it, but the bigger picture of why your program filled its heap. Sometimes, you'll discover a memory leak (memory that never becomes eligible for collection). Often, you'll discover that you just need to increase your heap space -- the JVM defaults to a relatively small heap (64Mb, iirc), and many programs require more.
    A third reason for memory consumption is that your program did something dumb but uncontrollable, such as attempting to download a million rows from a database. In this case, you can use soft references as a "circuit breaker," which prevents the dumb operation but allows the rest of your program to continue.
    Here's a presentation that I did for the Philadelphia Java Users Group, that shows you some of the uses for reference objects: http://phillyjug.jsync.com/meetings/java-reference-objects-by-keith-gregory (I have a longer article on the subject that's been 90% complete since November; the presentation contains a link to where that article will live once I put it up on my website).

  • Exception not propagating form optimised library

    Using studio 12.3.
    I have an optimised 64 bit library (built by IDE) which throws a std::runtime_error. The application has a try/catch( std::exception& ) wrapper, but the application aborts when the runtime_error is thrown. So either the exception isn't propagating or there is some stack corruption.
    Before I build a simplified test case, are there any known bugs I might be seeing?
    Thanks.

    I'm not aware of any bugs in Studio 12.3 that could result in a lost exception. Check the version of libCrun on your system, and be sure it is relatively recent (updated in the last year or so). The runtime suport library is part of Solaris, and is not updated by new Studio installations.
    % version /usr/lib/libCrun.so.1Where "version" is in the same directory as the compilers.

Maybe you are looking for

  • T30 - Problem with WLAN

    I have a T30 that in the past it used to detect the wireless networks of other apartments in my building. I have been using an ethernet connection to my router and when my T30 stopped detecting any wireless networks I had thought that actually there

  • Best Mac Laptop for X Code Development

    Hi, I'm trying to make some ios Apps from the X Code. So what is the best Mac Laptop to use this for.. I'm expecting your kind response from yours. Thank you, Iranga.

  • Copying Master Data Tables

    Hi Currently we have 0COSTELMT which is compunded to 0C0_AREA. Now I have to create ZCOSTELMT which is not compunded to 0CO_AREA. Also I have to create a new Cost Element Master table which is a copy of the existing Master table, except that Controll

  • 10.3 Clients not autologging

    Hey everyone. I'm running 10.4 server and I'm trying to get iMac(G4) and Mac Mini(G4) clients running 10.3 to auto login into a student profile. Previously we were running 10.3 server and these clients were auto logging fine, but when we upgraded to

  • SAP material master upload , but table by table

    Dear All, we have a case in which we want to create a new client and move all the settings and master data from our current client to the new one (we dont want to move the transactional data). our basis consultant has moved the settings and customiza