Home » Developer & Programmer » JDeveloper, Java & XML » Java Stored Procedure - Thread blocks Oracle
icon4.gif  Java Stored Procedure - Thread blocks Oracle [message #128438] Mon, 18 July 2005 09:32
bittner
Messages: 2
Registered: July 2005
Junior Member
Java Stored Procedures and Java threads. Anyone here who has experience with problems in that domain?
Here is my problem:

I have a simple Java method which uses a set of other Java classes to invoke a CORBA call towards a physically separated server running a Java based workflow engine. (The workflow runs on Java 1.4, the classes deployed to Oracle are compatible to Java 1.3 which is necessary to successfully load them into the database.)

In order to make the code compile within Oracle I have loaded all classes under the tree of
com/sun/corba/se/internal
of JRE 1.3 shipped with Oracle 9i into the database (using the loadjava utility). - Oracle 9i is missing those files, necessary for CORBA, otherwise. (Those have been moved to the Oracle Application Server after Oracle 8, as to my knowledge.)

The result behaves fine, CORBA calls from within the classes called by the Java Stored Procedure are invoked and the process returns and terminates normally with in an acceptable time frame.

I have, however, noticed that the Java Stored Procedure Call blocks Oracle completely when the Java process does NOT terminate. As a preventive measure I am letting the Java code start a new thread to do the actual work while the main thread controls the child thread and attempts to terminate it when a the request is not completed within a specific time frame. ('Timeout control' using the
childthread.interrupt()
method followed by throwing an exception that is not going to be caught, thus aborting the Stored Procedure / database trigger operation.)

This approach works when testing it outside of Oracle in a pure Java development environment. When deployed to Oracle the abortion of the timeouting thread works, but any following attempts to start the Java Stored Procedure block Oracle completely. (The Oracle service cannot be stopped any more, e.g., on a Window 2003 server, the oracle process has to be killed to allow for the service to be restarted.)

I think that the problem is somewhat like that Oracle cannot start up der JRE with the Java Stored Procedure any more, probably because the child thread killed beforehand did not allow the last JRE to exit (maybe because some resources were not released by the class performing the actual CORBA call). Clearly, not even the first line of code of the Java Stored Procedure is ever reached and executed (since this would show up in an external log file where I append log entries to in a safe manner).

Similar, unanswered questions I have found searching the web:
- "Oracle Java Stored Procedure and Thread" (Question in a forum)
http://forums.devarticles.com/t9939/s.html
- "Running a Thread in Oracle" (Java Forums, Sun Developer Network)
http://forum.java.sun.com/thread.jspa?threadID=616247&messageID=3430217

Anyone who can explain why Oracle behaves like this?
Anyone who knows a solution to that problem?

Kind regards,
Peter
Previous Topic: CheckBox / DataControl
Next Topic: can connection from javax.sql.DataSource be used for OracleXMLQuery..?
Goto Forum:
  


Current Time: Wed Apr 17 23:57:08 CDT 2024