Synchronized blocks within servlet doPost and/or doPost

Hey,
Does anyone know if there are any potential problems with using a synchronized block within a servlet doGet or doPost method? The blocks are local (I'm not synchronizing the whole doGet or doPost method) and synchronized on the servlet using the "this" keyword.
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
synchronized(this)
try
/** critical section **/
} catch (Exception e) {System.out.println("error " + e);}
Does anyone know any reason that this shouldn't be done?
thanks,
Bryan

Thanks to both respondants.
The synchronized block is needed in this case to fix an existing problem. The fix could also be made by restructuring the application a bit, but I hesitate to do so in this case.
I'm aware that it's best to avoid doing any thread operations in Servlets and was wondering whether this extended to synchronized blocks as well. Thanks again.
Without introducing too much uneccessary detail, it's sufficient to say that the problem occurs when two users are simultaneously in the block at the same time.
Thanks again,
Bryan

Similar Messages

  • Jave servlets- doget() and dopost() methods.

    Iam trying to learn servlets but got confused on these doget() and dopost() methods usage. I just want to know generally what does these methods do in general (like the doget() sets the header..but what about dopost()?). I saw some example code where doget() is called within a dopost()method so Iam not clear about their purposes.
    I'd appreciate any help possible. Thank you.

    The doPost() and doGet() (also doHead() etc.) methods are all designed to handle specific HTTP request types. eg: doGet() handles HTTP GET requests (requests caused by common HTML links or typing a URL in your browser's address bar) while POST handles HTTP POST requests (commonly generated by HTML form submissions).
    When you see an example of a serlvet's doGet() being called within it's doPost(), it is because, at least for part of the processing, the servlet will be treating the two request types the same way.

  • Servlet doPost() method and "HTTP Status 404 - /HelloPost" error

    hi all
    i've a problem with doPost(...) method. i use Tomcat4.1 version and in root folder i store Form.html where i use a doGet() method and in WEB-INI>>classes i store Hello.class file for doGet() method. it works normally. but when i write a Form1.html for doPost() method with "<FORM METHOD=POST ACTION="/HelloPost">" line and store as same folder as Form.html and HelloPost.class in WEB-INI>>classes folder. its not working and showing a error
    "HTTP Status 404 - /HelloPost"
    error type =Status error.
    message=/HelloPost
    description =The requested resource (/HelloPost) is not available
    if anyone of u know what the problem is.. then plz inform me... it will help me a lot to learn servlet.
    thnx a lot
    Arif

    Your post is very hard to read. The next time try to be more accurate.
    i store Form.html where i use a doGet() method That makes no sense.
    I think you have a form with method="GET"
    and in WEB-INI>>classes i store Hello.class file for doGet() method. you have a Servlet called Hello which handles doGet(Request, Response) calls and whose class file you've put into WEB-INF/classes
    but when i write a Form1.html for doPost() method with "<FORM METHOD=POST ACTION="/HelloPost">" line and store as same folder as Form.html and HelloPost.class in WEB-INI>>classes folderIt's not enough to put a class file which has the same name as the action of your form into the folder WEB-INF/classes. The class must implement the (Http)Servlet Interface and you have to configure the servlet in the web.xml file.
    From where did you get the working Hello example code ?
    Look at the Chapter 11: Java Servlet Technology of the J2EE 1.4 Tutorial to learn how to write Servlets.

  • Help : Calling a Servlet.doPost from a HTML Form (404 Error !!!)

    All
    I trying to make a call to a doPost method of a servlet from the doGet method of the same servlet.
    The call is made from an HTML form, so
    *<form name="input" action="servlet/deleteAlertPage" method="post">*
    ======================================================================
    The web.xml file entry is as follows:
    *<servlet>*
    *<servlet-name>deleteAlertPage</servlet-name>*
    *<servlet-class>bsp.perceptive.custom.webapp.deleteAlert.deleteAlertPage</servlet-class>*
    *<load-on-startup>0</load-on-startup>*
    *</servlet>*
    *<servlet-mapping>*
    *<servlet-name>deleteAlertPage</servlet-name>*
    *<url-pattern>/deleteAlertPage</url-pattern>*
    *</servlet-mapping>*
    So when I run my Servlet from my JDeveloper, I do see the “doGet” method getting executed successfully and I see my HTML from appearing on a browser page.
    As soon as I press the submit button, where I want the “doPost” method to get executed, I get the following error:
    Error 404--Not Found
    From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
    *10.4.5 404 Not Found*
    The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.
    If the server does not wish to make this information available to the client, the status code 403 (Forbidden) can be used instead.
    The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource
    is permanently unavailable and has no forwarding address.
    Any ideas ? Is my Servlet Setup and Execution Correct ?
    Any help is appreciated.
    My JDeveloper Version is the latest release :
    About
    Oracle JDeveloper 11g Release 1 11.1.1.2.0
    Studio Edition Version 11.1.1.2.0
    Build JDEVADF_11.1.1.2.0_GENERIC_091029.2229.5536
    Copyright © 1997, 2009 Oracle and/or its affiliates. All rights reserved.
    IDE Version: 11.1.1.2.36.55.36
    Product ID: oracle.jdeveloper
    Product Version: 11.1.1.2.36.55.36
    Any help and advice is greatly appreciated.
    Regards
    patrice

    John
    I got it to work !!
    I had to place the application name in the action value also I had to change the port number, from 8080 to be 7101.
    However
    It was not that straight forward, because when I created my web Application I gave it the application Name of "BSPCustPerWebApps" and Project Name of "BSPCustPerWebApps"and this is reflected in my JDeveloper folder structure: "....\mywork\BSPCustPerWebApps\BSPCustPerWebApps\src\bsp\perceptive\custom\webapp\deleteAlert"
    now when I run my Servlet initially I noticed that Browser URL is saying : http://localhost:7101/BSPCustPerWebApps-BSPCustPerWebApps-context-root/deleteAlertPage
    which means that the web application is : BSPCustPerWebApps-BSPCustPerWebApps-context-root
    so I changed my action value to be
    action="http://localhost:7101/BSPCustPerWebApps-BSPCustPerWebApps-context-root/deleteAlertPage"
    and that worked.
    Weblogic must have created/defauled the application name using the application name and project name that I gave duriung the servlet creation.
    Is there a way of changing the application name to be something shorter and more meaningfull ?
    Also I did not want to hard code the server name, port etc in the action value, so again is there way of making this to be derived ?
    Do you know how to access the WebLogic Console ? , considering I have only installed JDev, which has an embedded weblogic server.
    Thanks for your help.

  • Should this statement be within synchronized block

    I am trying to generate an unique ID as follows:
    uniqueID = String.valueOf( System.currentTimeMillis() + (long) Math.random() )
    Is this statement thread-safe? Should this statement be enclosed within a 'synchronized' block?
    Thanks

    >
    Sorry I missed the issue with casting to a long. That
    certainly makes it easy to get duplicates.
    The problem with (long) Math.random is that you get always 0
    public class LongTest {
         * @param args
        public static void main(String[] args) {
            int failed = 0;
            for (int i = 0; i < 1000000; i++) {
                if (((long) Math.random()) > 0) {
                    failed++;
            System.out.println(failed);
    With the bug in place, and a single-thread, the code
    requires that calls to this piece of code occur
    further apart than the resolution of
    currentTimeMillis() - which as I said is often as
    coarse as 10ms (but can be 15ms on some Windows
    platforms). If you now throw multiple threads in then
    the chances of duplicates is very real.Yes, since with that call you use only System.currentTimeMillis() that, as you said, is coarse grained
    >
    There are easier ways to get unique IDs - just see
    java.util.UUID. Or just use an atomic counter.Yes.

  • Servlet doPost data query.

    I have a question concerning the doPost method within a servlet...
    <p>
    I am using a servlet as the entry point to the server apllication. The servlet is hosted within IBM's Websphere Application Server 5.1. I am sending from a swing client a compressed data stream using http tunneling.
    <p>
    The question I have is - when the doPost is executed has all the data been receivedby the application server? I am decompressing the input stream within the doPost. Is it possible that not all the data has been recieved vy the app server when the app server passes execution to the doPost method of the servlet.
    <p>
    Thanks in advance for any help..
    <p>
    Robert

    I have a question concerning the doPost method within a servlet...
    <p>
    I am using a servlet as the entry point to the server apllication. The servlet is hosted within IBM's Websphere Application Server 5.1. I am sending from a swing client a compressed data stream using http tunneling.
    <p>
    The question I have is - when the doPost is executed has all the data been receivedby the application server? I am decompressing the input stream within the doPost. Is it possible that not all the data has been recieved vy the app server when the app server passes execution to the doPost method of the servlet.
    <p>
    Thanks in advance for any help..
    <p>
    Robert

  • Synchronized blocks: the best approach?

    I have a question concerning synchronization within a servlet. As I
              understand it, by default only one instance of a servlet will be
              instantiated by WebLogic. The impact of this is that if an instance
              variable is set in 'doGet', there is no guarantee that the value will be
              unchanged upon execution of 'doPost' (i.e. it is not "thread-safe").
              There are a few approaches to this problem, none of which are very
              appealing to me. If I utilize the "SingleThreadModel" interface, then I am
              guaranteed that the value will not change. However, this will occur at the
              expense of performance (isn't there a maximum of 5 instances?), especially
              if hundreds of users are concurrently attempting to access this same
              servlet. Even if I store a variable in the session, if the user can open
              multiple browser windows, then I could still run into a synchronization
              problem (since each window will share the same session).
              With this in mind (assuming that a user can open multiple browser windows
              and that I do not want to implement "SingleThreadModel"), is my only option
              to place synchronized blocks around the sections of code that I want
              protected?
              I appreciate any input. Thanks.
              

              It is possible to make this really messy - avoid that.
              Don't use intance variables, use only variables declared in the doGet method -
              each execution will have it's own variables and you won't have these problems.
              If you need data to persist from one call to the next, use the httpSession.
              If you need to manage separate browser windows - then put a hidden field or a
              parameter in the URL that identifies that window. Then store the data in the httpsession
              along with the window id -
              session.putValue("USERNAME_"+winId, username);
              Putting synchronized blocks doesn't really protect you from the multiple window
              problem - suppose a user does a search in one window - and the search results
              are stored in the http session. Then they do a second search in a second window
              - even if you protect the variables in a synchronize block - the second results
              will overwrite the first results. Then they start to page through what should
              be the first results in the first window - but they would see the second results.
              Mike Reiche
              Resume at http://home.earthlink.net/~mikereiche/resume.htm
              "Edward Mench" <[email protected]> wrote:
              > I have a question concerning synchronization within a servlet. As
              >I
              >understand it, by default only one instance of a servlet will be
              >instantiated by WebLogic. The impact of this is that if an instance
              >variable is set in 'doGet', there is no guarantee that the value will
              >be
              >unchanged upon execution of 'doPost' (i.e. it is not "thread-safe").
              >
              > There are a few approaches to this problem, none of which are very
              >appealing to me. If I utilize the "SingleThreadModel" interface, then
              >I am
              >guaranteed that the value will not change. However, this will occur
              >at the
              >expense of performance (isn't there a maximum of 5 instances?), especially
              >if hundreds of users are concurrently attempting to access this same
              >servlet. Even if I store a variable in the session, if the user can
              >open
              >multiple browser windows, then I could still run into a synchronization
              >problem (since each window will share the same session).
              >
              > With this in mind (assuming that a user can open multiple browser windows
              >and that I do not want to implement "SingleThreadModel"), is my only
              >option
              >to place synchronized blocks around the sections of code that I want
              >protected?
              >
              > I appreciate any input. Thanks.
              >
              >
              >
              >
              

  • Terminating enqueued threads at synchronized block

    Hi!
    I would really appreciate your opinions: :)
    The application desing:
    - I'm developing a web applicaction running on a Tomcat server.
    - The app is being developed using Struts and Spring.
    - Pages (presentation layer) are made of JSPs.
    - There are Spring beans (Services) that execute the business logic.
    - These Services are used by the Struts Actions.
    My problem case:
    1. When you submit myPage.jsp, MyAction.java's execute method is called.
    2. MyAction.java uses MyService.java's "process()" method to do some file processing that takes 2 to 3 hours to finish.
    3. This MyService.java is a singleton Spring bean.
    4. The call to process() method is synchronized on MyAction.java like this:
    public ActionForward execute(...) throws Exception {
         // Some code ...
         synchronized (this) {
              myService.process(...); // This method takes up to 3 hours to return
              // Some code ...
         return mapping.findForward("success");
    }As you can imagine, many requests (threads) will be enqueued at the synchronized keyword line. Because of this, I need to provide a cancelation functionality. This would be fired by a cancel button on myPage.jsp.
    So, if you tried to launch the so-long-process by the "Process" button on myPage.jsp and you received a "Waiting..." message at your screen (because the 3 hours process was launched by another client), you should be able to cancel your processing request (because you don't want to wait so much time to begin your file processing).
    I would really appreciate your opinions on which would be the best approach to achive this cancelation functionality.
    I'm sure there's a better way than the one I came up with: I could populate a class variable Map with "sessionId - Thread" (key - value) everytime a request arrives at the line before the synchronized block. Thus, when you clicked the Cancel button, MyAction.java would get the request's session id and then get the Thread it must terminate from the Map. Having the Thread instance, I could maybe call it's interrupt method.
    I don't think that's the best approach, but it's the only one I could thought about.
    Thank you very much for your time and opinions!

    Well, first thing I'd say is that if you use Spring, you'd be better off using it's own Controller architecture which is, to my mind, a lot more developed than Struts, especially now you can do pretty much the whole thing with @RequestMapping rather than XML.
    Having a web transaction wait for a long running server action is basically a bad idea. Rather you should have the web front end launch the file processing job and return immediately, probably showing a list of jobs to the user which may be queued, running or finished (for good or ill). One technique is to display a "background action in progress" page which submits a new transaction every few minutes to check if the job has finished yet (using a Javascript timer). If the job is still queued or running then this request displays the "in progress" page again, if finished it displays the result.
    Such a page could have a "Stop" button to abort the running job if feasible.
    I would suggest that you have a queue of background jobs, probably serviced by a ThreadPoolExecuter. The initial request simply builds a request object and queues it.
    Use a ContextListener object to create the queue and start the executer when the application starts, and close it down when the application is stopped,

  • Dynamic blocks within the WebUI. Is this possible?.

    CRM 7.
    We currently have about 14 user specific blocks within the Online Factsheet. We also have the same in the PDF Factsheet.
    Some of these blocks show data in Metric (Kg, Cm's etc) but there has been a request to show data in Imperial format (Lb's and Inches etc), which is still used in the U.S.
    Using the WebUI and within an Account there's an option under the 'More' tab to display either an Online factsheet or a PDF Factsheet. Does anyone know how I can control the entries in this pull-down tab?.
    With regards to the Factsheet itself, I have two options open to me. The first to create another Factsheet which has the fields and column headings defined in the view config, or use the same factsheet/component/views and dynamically change the column headings and fields, which sounds harder.
    The PDF Factsheet is easy to deal with as it's just a Smartform, so I can copy it  and change it specifically for the Imperial format.
    Has anyone done anything like this before, and perhaps give me the benefit of their wisdom?.
    Best wishes
    Jason

    Thanks for the details.
    I debugged the process and can see this line is providing the text on the tab. However, the method is making a low-level call to get the details from some message class/table, but I can't identify what this message class/table is.
    But it looks like it's the sotr_edit transaction, as you mentioned, that controls this. I'm not that familiar with this OTR process though and the transaction is not that intuitive. I assume that I just need to somehow add new entry, with my own Z package.
    Many thanks for the advice though, I knew nothing about that transaction. I also have to create another Online factsheet as well, and it looks like I can control it this way as well.
    I had already modified table CRMV_PRN_CONTROL via sm30 and had changed the values for the Fom name and class/interface from CRM_ACC_ACCOUNT_OVERVIEW_PRN to ZCRM_ACC_ACCOUNT_OVERVIEW_PRN for the form name and from CL_UIU_PRN_ACCOUNT to ZCL_UIU_PRN_ACCOUNT for the class/interface against all the roles.
    However, I know want to add another form name and class/interface as I have TWO user PDF Factsheets to use, depending on which item the user chooses from the Tab.
    Any idea how I can control this?.
    Best regards
    Jason

  • Accessing / communication between VM1 and VM2 both within a CS and within a VNET

    Hi,
    I have been trying to access one VM from another VM both within a CS and within a VNET.  Let me summarise all that I have done in the last couple of days.
    I have VM1 and VM2 in the same CS and same VNET. I have disabled windows firewall in both the vms for testing purpose. VM1 internal IP Address is 10.0.0.4. VM2 internal IP Address is 10.0.0.5. Both VM1 and VM2 are pingable from each other.
    VM1 runs my own virtual device network I created using one of our virtual device tools. The IP range of the virtual devices is 10.0.0.6 to 10.0.0.13 When I ping from VM1 itself all the .6 to .13 virtual devices are pingable. [Additionally, I installed asset
    scanner in vm1 itself and was able to scan .6 to .13 successfully and ping successfully].
    VM2 also runs a asset scan software.  I open a cmd and route add as follows:
    >route ADD 10.0.0.0 MASK 255.255.255.0 10.0.0.4
    where 10.0.0.0 is the target network which would include 10.0.0.6 to 10.0.0.13. 10.0.0.4 is the gateway.
    Now, I go to the asset scan [running in VM2 with internal ipaddress 10.0.0.5]. From its web client I initiate a asset scan giving the IP range as 10.0.0.6 to 10.0.0.13. the software is not able to detect/discover the virtual devices .6 to .13 [the virtual devices
    running in vm1] Why?
    From this vm2, I pinged 10.0.0.6, no response. I pinged 10.0.0.7 no response.... 10.0.0.13 no response.
    HOWEVER, we created the above scenario using 2 physical servers in our LAN and it all worked fine.
    Where/what am I missing?
    K.Lakshmi Shankar

    Hi,
    The ICMP traffic is blocked by the Azure load balancer and the ping requests timeout.
    Note that while this applies to network traffic going through the external IP (VIP) through configured endpoints, ICMP is not blocked when connecting through an Azure virtual network gateway or ExpressRoute. Also, ICMP will work between internal IPs of VMs
    in the same virtual network or in the same cloud service.
    To test connectivity, we instead recommend that you do a port ping. While Ping.exe uses ICMP, other tools such as PsPing, Nmap, or Telnet allow you to test connectivity to a specific TCP port.
    Hope this helps !
    Regards,
    Sowmya

  • RMI - NAT - Client within the LAN and outside the LAN

    I'm having an RMI server in a machine within a LAN with the private IP 10.XX.XX.XX and a NAT with the public IP 196.XX.XX.XX.
    I am using the property: java.rmi.server.hostname to 196.XX.XX.XX. The server is behind a NAT machine.
    Everything works fine when the client is outside the LAN, but when the client is within the LAN it fails to lookup the server (of course it would work fine if I ommit the java.rmi.server.hostname property or set it to the server IP, but then I cannot work with a client outside the LAN).
    To conclude, my question is how I can work with both clients simultaneously (one within the LAN and one outside the LAN)?

    Most firewalls block access from inside the network to the external IP address (10.x.x.x to 196.x.x.x) as this approach could also be used by an attacker masquerading as a local network computer.
    You're going to need to make sure that all your Internal computers do not go via your firewall to get to the server.
    You can either add a route to the server on the Internal client machines overriding the default routing table or you can use your public domain name instead of the IP address. Then change your internal DNS configuration (if you use one) to point internal users to the local IP address instead.

  • Nested synchronized blocks on multiple objects without deadlock

    Is it possible? Here is an example problem that exhibits deadlock:
    public class SomeObject {
         public static class Foo {
              private int n = 0;
              public synchronized void p() {
                   n++;
                   if (n % 100 == 0)
                        System.out.print("f");
         public static class Bar {
              private int n = 0;
              public void p() {
                   n++;
                   if (n % 100 == 0)
                        System.out.print("b");
         public void doSomething1(Foo f, Bar b) {
              synchronized(f) {
                   synchronized(b) {
                        f.p();
                        b.p();
         public void doSomething2(Foo f, Bar b) {
              synchronized(b) {
                   synchronized(f) {
                        b.p();
                        f.p();
         public static void main(String[] args) {
              SomeObject so = new SomeObject();
              Foo f = new Foo();
              Bar b = new Bar();
              for (int i = 0; i < 100; i++)
                   (new MyThread(so, f, b)).start();
         public static class MyThread extends Thread {
              SomeObject so = null;
              Foo f = null;
              Bar b = null;
              public MyThread(SomeObject so, Foo f, Bar b) {
                   this.so = so;
                   this.f = f;
                   this.b = b;
              public void run() {
                   while (true) {
                        if (Math.random() > 0.5)
                             so.doSomething1(f, b);
                        else
                             so.doSomething2(f, b);
    }

    Well, playing with sinchronized code as to be done carefully.
    This is very important because de JVM does not break the deadlocks (like by throwing an exception in a deadlocked thread). so in the above example, once 2 of the threads do deadlock, the rest of the threads that are created in the main method loop will deadlock too.
    For that it is better to:
    a) use minimal sinchronized code, like in Foo.p, the method is sinchronized to have access to an internal variable.
    b) use layered sinchronization. If several components in a system have synchronized code (methods) or are used as monitors in synchronized blocks, then it is better to layer the monitor usage nesting and to eliminate circular dependencies (also it is good to minimize dependencies). This is similar to code dependency in which package circular dependency should be avoided. Though in this case it is critical.
    In the example given, the doSomething* methods generate circular dependency of monitors.
    If the desing is to have a 'transaction' in calling Foo.p() and Bar.p() from the doSomething* methods, then the usage of a 'grand-daddy' central lock would be a simple solution, like changing the doSomething* methods to:
    static public synchornized void doSomething*(Foo f, Bar b) {
    f.p();
    b.p();
    or
    public void doSomething*(Foo f, Bar b) {
    synchornized (SomeObject.class) {
    f.p();
    b.p();
    If there is no need of a 'transaction' in the calling of Foo.p() and Bar.p(), then the doSomething* methods should not have any type of synchronization, and the methods Foo.p() and Bar.p() should both be synchronized.
    Also a more complex scheme could be deviced in order to lower the contention on the SomeObject class monitor. Though for the example given, as it exists only one instance of both Foo and Bar, it is not needed.
    llongeri

  • IllegalMonitorStateException Thrown From Synchronized Block

    Greetings,
    We recently had a case where a java.lang.IllegalMonitorStateException was thrown from section of code (in activemq) that I'm 99.9% sure was properly synchronized. Has anyone ever seen this exception thrown when the object whose wait method is being called is currently owened (via. a synchronized block)?
    The code that this exception occurred was in the backport-util-concurrent library. A get method (which is synchronized) call was made to a FutureTask instance which (eventually) calls Object.wait(). This call threw the exception. Below is the FutureTask code.
    public synchronized Object get() throws InterruptedException, ExecutionException
      waitFor();
      return getResult();
    private void waitFor() throws InterruptedException
      while (!isDone())
        wait();
    }And the stack trace on the exception was:
    ERROR - 21/2 08:56:41 - Failed to checkpoint a message store: java.lang.IllegalMonitorStateException - org.apache.activemq.store.journal.JournalPersistenceAdapter 395
    java.lang.IllegalMonitorStateException
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:485)
    at edu.emory.mathcs.backport.java.util.concurrent.FutureTask.waitFor(FutureTask.java:267)
    at edu.emory.mathcs.backport.java.util.concurrent.FutureTask.get(FutureTask.java:117)
    at org.apache.activemq.store.journal.JournalPersistenceAdapter.doCheckpoint(JournalPersistenceAdapter.java:386)
    at org.apache.activemq.store.journal.JournalPersistenceAdapter$2.iterate(JournalPersistenceAdapter.java:129)
    at org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:117)
    at org.apache.activemq.thread.PooledTaskRunner.access$100(PooledTaskRunner.java:26)
    at org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:44)
    at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
    at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
    at java.lang.Thread.run(Thread.java:619)We are running Java 1.6 on solaris (64-bit). If anybody has any feedback on what might have caused this problem it would be appreciated.
    Thanks,
    Corey

    There seem to be some difficult to reproduce bugs in JDK 6 relating to hotspot compilation (and maybe synchronization). A few threads worth checking out:
    http://forum.java.sun.com/thread.jspa?threadID=5251785&tstart=0
    http://forum.java.sun.com/thread.jspa?threadID=5262404&tstart=0
    My own bug report (this one is reproducible): http://www.blinkenbyte.org/jvm/hotspot_bug_reviewid_1085121.html
    Which reminds me, I need to get around to submitting an update to the report.. disabling HotSpot compilation on the problematic method made the problem go away in my case...
    If at all possible to turn this into a test case, please do so and submit a bug report to Sun. Somehow Sun needs to pay attention to this problem, but I haven't even got a bug id on my problem despite it being 100% reproducible.

  • Querying a multi-record block within my form

    I have a form where I perform validations of items entered on my main block. I compare the item value entered to an expected value and if they are different then an exception record must be created in a separate, multi-record block within my application. One record on my main block may end up with multiple different exception records in the multi-record block. As a result, part of my validation must include determining whether the user has already created an exception record for the item that I'm validating in the multi-record block.
    Is there a way for me to query and uncomitted, multi-record block in my form? Help would be greatly appreciated!

    Andreas' method is good.
    Only several changes:
      LOOP... EXIT WHEN :SYSTEM.RECORD_STATUS='NEW';
    (Use NEW, not TRUE)
    And just before the Raise Form_Trigger_Failure, I would Go_Item to either the item in error, or to a new line in the exceptions block. And also issue an error message.
    ....By the way...
    If your exceptions block has more rows than will fit on the screen, then your search loop function will may cause the rows to jump up or down when the user tries to commit. There is a way to reset the view after the function completes its search -- you just need to store the value of the block's Top_Record property before the First_Record command, and then Go_Record(Top_Rec_value); after the function completes its loop.
    Also, there is a way to prompt the user to enter the exception record when you first validate the item in a when-validate-item trigger. But the user might ignore the prompt, so you still need to re-check everything from the key-commit process. To use the WVI prompting, in the WVI trigger you check if an exception is required. If it is, store the item name in a package variable, then start a non-repeating timer. When the timer expires, save the :System.cursor_item value (so you can go_item back to it after calling the function), and then call the function to check for the exception for the item named in the package variable. If not found, prompt the user. If found, go_item back to the cursor_item_value.

  • Synchronized Block - Performance Issue

    Hi All,
    In my java class contains lot of synchronized methods...which in turn leads to performance issue....
    If i try to remove the synchronized methods...it leads to deadlock problem...
    Is there a way without removing the synchronized methods..to improve the performance...
    Please suggest any solution

    In my java class contains lot of synchronized methods...which in turn leads to performance issue....It causes sequentialization of critical sections of code so that they will execute correctly. You can't describe that as a performance problem unless you can show that a faster and correct implementation exists. It might: for example you could make yor synchronized blocks smaller, use concurrent data structures, etc. But what you can't do is compare it to the same code without synchronization and say it's slower. It is, but the observation has no meaning as the unsynch version isn't correct.
    If i try to remove the synchronized methods...it leads to deadlock problem...That isn't possible unless you didn't remove them all. Deadlocks result from acquiring locks in different orders.
    Is there a way without removing the synchronized methods..to improve the performance...Almost certainly. Post some code.

Maybe you are looking for

  • Package problems when I migrate

    Hello! I'm new to Oracle. The migration program creates this package: CREATE OR REPLACE PACKAGE SUB_APPROVEPkg AS TYPE RCT1 IS REF CURSOR RETURN keyword%ROWTYPE; END; When I try to compile this package I get an error on keyword that says that the ref

  • SUNW.gds resource creation problem / service startup failure

    We have a vendor provided set of application server start and stop scripts that we are trying to mold into a GDS resource. The scripts must be run as a user not as root. This app takes about 6 minutes to start up and it creates about 400 processes in

  • Batch script to monitor tbs

    Hi guys. On windows machine, I do have cron jobs that monitor tablespace usage and when a tbs reaches a machine, an alert is sent. Now, I do have other dbs runing on windows and would like to do the same. The problem is that am not use to windows and

  • RequestDispatcher -  What is the expected behaviour defined by the spec

    Hello, I just try to understand the servlet specification correctly. I don't understand what should happen when I try to access an not-existent resource by means of the RequestDispatcher. That's the way my source code looks: RequestDispatcher rd = se

  • Installation 10g (10.2) on Debian/Sarge

    Hi list, has anyone some experiences in installation 10g (e-g- 10.2) on Debian/Sarge ? Do you know about an url for an (short) installation guide ? thanks in advance. greets, Rainer