How can I prevent the MediaTracker waitForID method from blocking?

Hi everyone:
I am writing an application that deals with various image file formats with the help of the JIMI package (available at http://java.sun.com/products/jimi/). Everything works fine except for the Targa format. When I generate an Image object as follows (url is a valid URL object):
Image image = Jimi.getImage(url);
ImageIcon icon = new ImageIcon(image);the program execution blocks at the second line above. I searched the ImageIcon source code for some clues, which led me to the following ImageIcon method (tracker is a MediaTracker object, a static property of ImageIcon):
(01) protected void loadImage(Image image) {
(02)   synchronized(tracker) {
(03)     tracker.addImage(image, 0);
(04)     try {
(05)       tracker.waitForID(0, 0);
(06)     } catch (InterruptedException e) {
(07)       System.out.println("INTERRUPTED while loading Image");
(08)     }
(09)     loadStatus = tracker.statusID(0, false);
(10)     tracker.removeImage(image, 0);
(11)
(12)     width = image.getWidth(imageObserver);
(13)     height = image.getHeight(imageObserver);
(14)   }
(15) }The program blocks at line (05) above. I peeked into the MediaTracker class source code, which brought me to determine that the image loading process never finishes. The symptoms are as follows:
(1) When I perform a c.checkImage(image, null) where c is some Component, I always get a result of 7, which translates to the following combination of ImageObserver constants:
WIDTH | HEIGHT | PROPERTIESAs matter of fact, the dimensions are indeed determined correctly. However, when the loading process terminates, the checkImage result includes ALLBITS or FRAMEBITS in case of success, ABORT or ERROR in case of failure. None of these bits is ever turned on whenever I try to load a Targa image.
(2) When I get to the MediaTracker source code, I see that when none of the four bytes above is set, the internal MediaTracker status has the MediaTracker.LOADING bit turned on (nothing abnormal here). And the waitForID method terminates precisely only when this bit is turned off!
Logically, if the loading process fails for some reason, I should expect to get an error response so that I can go further in code execution. However, since the loading process never terminates, everything stays blocked at the waitForID method invocation.
Is there an efficient way to detect such a hidden loading error without letting my program go into the waitForID endless loop? In other words, going back to the first two lines of code of this message, how could I detect that an Image loading process will not terminate before calling the ImageIcon constructor?
Thanks in advance for any useful help...
Jean-Fran�ois Morin

Hi:
I tried precisely your suggestion before posting my message to the forum yesterday. I just forgot to mention it... Maybe I was afraid of increasing my message length more and more...
I already know that this solution prevents the MediaTracker from blocking. However...
(1) If they reach a troublesome image (like a Targa), the users of my application might not be pleased by its freezing for 10 seconds. Actually, this image loading module is part of an architecture for database applications from which my development team and I produce applications for various customers. Images are used, in particular, in Oracle BLOB support.
(2) If I use a smaller timeout delay, I have no guarantee that any image, whatever its length, will load properly (Targa excluded, of course). According to tests I performed yesterday, I am virtually sure that the 10-second delay will be busted very easily by pictures larger than 1 Mb. I cannot overlook this potential problem: an Oracle BLOB can contain up to 2 terabytes of data!
On the other side, I don't want to focus too much the attention on the JIMI Targa import filter because I know that a revised version of the JIMI and JAI packages will be part of JDK 1.4. This is why I am trying to figure out what is happening in the MediaTracker and Toolkit classes, which are much more fundamental than the Jimi ones...
Thanks anyway...
Best regards,
Jean-Fran�ois Morin

Similar Messages

  • How can you prevent the mac book pro from unexpectedly shutting off and beeping three times repeatedly?

    How can you prevent the mac book pro from unexpectedly shutting off and beeping three times repeatedly?

    The three beeps are an indication of a hardware problem. Power On Self-Test Beep Definition - Part 2 - Apple Support

  • How can I prevent the settings on iMessage from changing each time I sync the devices with iTunes on our iMac?

    Each time I sync an apple device (iPad, iPad mini, iPhone) with iTunes on our iMac the settings on iMessage and phone settings change. We use the same Apple ID and have different e-mail addresses and phone numbers; however, each time a device is sync'd on iTunes on our iMac, the iMessage settings and phone settings are changed so that we all each get each other's text messages and phone calls. After the device is sync'd/charged, I have to go into each device (all of them somehow update when only one is sync'ing) and re-set the settings to what we want. How can I prevent settings from being changed each time?

    Okay I've tried safe mode.  Let it run down to 98%, plugged it in, locked the screen, and waited.  A few minutes later, the screen came on showing the 100% icon at the top right, full battery icon just to the left of the time, 100% text to the left of that.
    I'm not going to do a hard reset until I have confirmation that this is not normal behavior for the phone because that's going to take hours of my time and gigabytes of data transfer to get all of my media and apps back on the phone and configured.
    After all my griping, I do have to give credit where it's due.  This phone is much more efficient than my Galaxy Nexus.  I left the S5 running in WiFi hotspot mode while on battery last night.  It still had over 50% left on the battery.  The Galaxy Nexus would be stone dead after about 4 hours.  I can live with that if I have to but I'd really rather be able to leave it on the charger at night.

  • How can I prevent the active Tab Group from changing whenever I close a tab?

    Simply, often I will close a tab in Firefox 4; then, for some reason the active Tab Group changes to some other collection. It usually happens when I close the last tab in my tabs bar, but it has happened after closing other tabs, as well. Would love to prevent Tab Groups from changing automatically. Thank you!

    Hi:
    I tried precisely your suggestion before posting my message to the forum yesterday. I just forgot to mention it... Maybe I was afraid of increasing my message length more and more...
    I already know that this solution prevents the MediaTracker from blocking. However...
    (1) If they reach a troublesome image (like a Targa), the users of my application might not be pleased by its freezing for 10 seconds. Actually, this image loading module is part of an architecture for database applications from which my development team and I produce applications for various customers. Images are used, in particular, in Oracle BLOB support.
    (2) If I use a smaller timeout delay, I have no guarantee that any image, whatever its length, will load properly (Targa excluded, of course). According to tests I performed yesterday, I am virtually sure that the 10-second delay will be busted very easily by pictures larger than 1 Mb. I cannot overlook this potential problem: an Oracle BLOB can contain up to 2 terabytes of data!
    On the other side, I don't want to focus too much the attention on the JIMI Targa import filter because I know that a revised version of the JIMI and JAI packages will be part of JDK 1.4. This is why I am trying to figure out what is happening in the MediaTracker and Toolkit classes, which are much more fundamental than the Jimi ones...
    Thanks anyway...
    Best regards,
    Jean-Fran�ois Morin

  • How can I prevent the S5's screen from coming on when charging completes?

    I got my S5 today and it seems to have a "feature" that will be very damaging to the OLED display.  When it's done charging, the screen comes on and stays on.  I've been going through all the settings I can find and don't see anything that will prevent this.  Since static images burn into OLED screens, this is the last thing I want.  It's done the same thing several times.  My old phone (Galaxy Nexus) didn't do this.  When the Nexus finished charging, it did so with no fanfare.  The screen stayed off.
    When the S5 is locked and the screen is off, there's no reason for the screen to come on for anything short of a phone call.  It certainly shouldn't come on and stay on just because the battery finished charging.  And, any time the display does come on without user input, it should turn off again automatically if it's idle for the length of the screen timeout.
    I've got "Smart stay" turned off and "Screen timeout" set to 1 minute but, after it self-activates, it stays on indefinitely.  I've let it go for 20 minutes and the screen is still on.  How can I fix this?  If I can't get this behavior to stop, it's going back to the store.  I'm not paying $600 plus tax to have my lock screen burned onto my phone because I charge it at night.

    Okay I've tried safe mode.  Let it run down to 98%, plugged it in, locked the screen, and waited.  A few minutes later, the screen came on showing the 100% icon at the top right, full battery icon just to the left of the time, 100% text to the left of that.
    I'm not going to do a hard reset until I have confirmation that this is not normal behavior for the phone because that's going to take hours of my time and gigabytes of data transfer to get all of my media and apps back on the phone and configured.
    After all my griping, I do have to give credit where it's due.  This phone is much more efficient than my Galaxy Nexus.  I left the S5 running in WiFi hotspot mode while on battery last night.  It still had over 50% left on the battery.  The Galaxy Nexus would be stone dead after about 4 hours.  I can live with that if I have to but I'd really rather be able to leave it on the charger at night.

  • How can we  prevent the PO while creating the sales order

    Hi All,
    How can we prevent the PO number while creating sales order with existing PO. I have checked the box in sales document type as A but still im able to create sales order with same PO.
    Thanks in advance.
    Naveen

    Hi
    In VOV8 check the box
    Check Purchase Order Number
    The purpose of this field is to check for duplicate
    purchase order (PO) numbers during sales order entry. When you select A in
    this field, SAP gives a warning message during sales order creation if another sales
    document for same customer with the same PO number exists already. Leave this
    field blank if you do not want SAP to check for duplicate PO numbers.
    regards
    Prashanth

  • Have Operating System 10.6.8, Mail Program 4.6.  How can I prevent the next email in the que from automatically opening after I act on the previous email ? It creates big organizational problems for me. My computer changes this mode from self opening to m

    Have Operating System 10.6.8, Mail Program 4.6.
    How can I prevent the next email in the que from automatically opening after I act on the previous email ? It creates big organizational problems for me. My computer changes this mode from self opening to manually opening every few month with no ? action from me.
    Help

    Have Operating System 10.6.8, Mail Program 4.6.
    How can I prevent the next email in the que from automatically opening after I act on the previous email ? It creates big organizational problems for me. My computer changes this mode from self opening to manually opening every few month with no ? action from me.
    Help

  • How can I prevent the flushing of the buffer until the playing is finished in AS3?

    How can I prevent the flushing of the buffer until the playing is finished in AS3?
    Is it possible?
    The buffer is emptied and flushed 10-11 seconds before the real end of the flv file.
    The file is locally saved and I stream it though crtmp server.
    I cannot seek the last 10 seconds because of empty buffer. How can I stop flash from flushing the buffer at end?

    i used the same code and i got it working correctly...
    thanx a lot fot it...
    now i have one more problem with it.
    Actually i created a new class 'ErrorDialog' and the function showErrorDialog() inside it.
    now i want the option YES_NO_OPTION and the function sayshowMsgDialog() returning int value indicating the option selected from the dialog box.
    I tried it with following code
    public
    static
    int
    confirmDialog( String message_in, Component parent_in, String title_in,
    int messageType_in )
    try
    JOptionPane pane = new JOptionPane( message_in, messageType_in,
    JOptionPane.YES_NO_OPTION );
    JDialog dialog = pane.createDialog( parent_in, title_in );
    dialog.setResizable( false );
    dialog.show();
    int optionType = -1;
    try
    optionType = ( ( Integer )( pane.getValue() ) ).intValue();
    catch( Exception ee )
    optionType = -1;
    dialog.dispose();
    return optionType;
    catch( Exception e )
    e.printStackTrace();
    but, since return is after dispose() it is throwing an error 'missing return value'
    can i get some kind of solution for this?
    waiting eagerly...........
    -Soni

  • How can I prevent the open/save file confirmation window popup ? Mine is currently set for "always do this action" but I still get the popup.

    Whenever I "export" a QIF file from my bank I get a File Action confirmation window popup. I have the correct application selected and I have it selected to "open" and "always do this action" but the popup always pops.
    I have checked the applications tab and the correct application is selected.
    How can I prevent the confirmation popup window please ?

    Cheers for the reply.
    I have deleted the rdf file but no difference. I still get the opening file box popup.
    From the resetting download actions link. Both lines in the about:config are missing.
    I have also tried switching the download option for the qif file to use a csr file but that also opens the confirmation box.
    I pulled this from the rdf file
    <RDF:Description RDF:about="urn:mimetype:handler:text/x-qif"
    NC:alwaysAsk="false"
    NC:saveToDisk="false"
    NC:useSystemDefault="false"
    NC:handleInternal="false">
    <NC:externalApplication RDF:resource="urn:mimetype:externalApplication:text/x-qif"/>
    <NC:possibleApplication RDF:resource="urn:handler:local:C:\Program Files\Microsoft Money\System\msmoney.exe"/>
    </RDF:Description>
    <RDF:Description RDF:about="urn:scheme:webcal"
    NC:value="webcal">
    <NC:handlerProp RDF:resource="urn:scheme:handler:webcal"/>
    </RDF:Description>
    <RDF:Description RDF:about="urn:mimetype:externalApplication:text/x-qif"
    NC:path="C:\Program Files\Microsoft Money\System\msmoney.exe"
    NC:prettyName="msmoney.exe" />
    Not sure if that helps.
    Thanks again for the reply

  • When inserting a checkbox, how can I prevent the note box from appearing?

    To all,
    After -reluctantly- "upgrading" from Acrobat Pro 7 to Pro X I find this new version absolutely maddening.
    Pro 7's features were easy to find in the tool bar. Now in Pro X everything is "dumbed down" with everything "nested" into each other...
    But I whine and digress from my problem:
    QUESTION:
    When inserting a checkbox, how can I prevent the note box from appearing?
    With every insertion of a checkbox onto a form, a "notebox" appears.
    Thank you,
    Matt

    As you can see, when I add a checkmark to a page/form, a "note" is automatically added also. In my old Acrobat v. 7, this did not happen.
    Any ideas on how I can set Acrobat Pro X to NOT include this note?
    Thank you,
    Matt

  • When used as an Activex control in windows How can I prevent the "Q" logo from appearing between streaming videos?

    When used as an Activex control in windows How can I prevent the "Q" logo from appearing between streaming videos?

    Hello Cgifford,
    Welcome to National Instruments Forums.
    To output your signal to the PFI lines,
    you can use external connectios between OUT0 and PFI lines. You can also use
    the backplane to do so by routing into the same RTSI line.
    1)
    On the SCOPE and FGEN, the name of the
    terminals are actually “PXI Trigger Line x/RTSIx” but on the 6602 you might
    need to route the signal using the property:
    You can also use the DAQmx route signal which perform the same opperation.
    2)
    This will depend on the frequency of
    your pulse train. If this is lower than about 10 ms, then you can probably
    place this on a loop and start and stop the acquisition every time. If the
    frequency is higher than this, you will have to use:
    -       Scripting on the FGEN side (read more)
    -       MultiRecord Fetch (more information in the scope help file
    section “Acquisition Functions Reading versus Fetching”).
    3)
    The short answer is yes. The longer one
    might depend on how tight you need the synchronization to be (us, ns, ps). For
    very tight synchronization, you should look into here.
    Message Edited by Yardov on 06-18-2007 03:14 PM
    Gerardo O.
    RF Systems Engineering
    National Instruments
    Attachments:
    property.JPG ‏7 KB

  • I'm using "window.open()" to show one Calendar in a popup window. I can see that the popup is re-sizable. How can I prevent the user from re-sizing the popup?

    I'm using "window.open()" to show one Calendar in a popup window. I can see that the popup is re-sizable. How can I prevent the user from re-sizing the popup? I have tried "resizable=yes|no|1|0" and that seems to be not working.

    You can't prevent users from resizing a pop-up.
    *https://developer.mozilla.org/en-US/docs/Web/API/window.open

  • How can I move the ODI Work Repository from one server to another server?

    How can I move the ODI Work Repository from one server to another server?

    Hi,
    If you would like to move your source models, target models and project contents from Work repository 1 to another work repository.
    I.e. Dev. server to Prod Server.
    1. Firstly, replicate the master repository connections i.e. with same naming conventions manually
    2. Go to Dev. Server work repository -> File Tab -> Click on Export work repository (save it in a folder)
    3. After exporting, you can view the xml files in the folders.
    4. Now, Open the Prod. server and make sure you already replicated mas. rep. details.
    5. Now, right click on model and import source model in synonym mode insert_update (select source model from the folder where your xml file located)
    6. Similarily, import again target then Project.
    Now, check. It should work.
    Thank you.

  • I have about 800 more songs on my nano than itunes, due to a crash. How can I get the songs onto itunes from the ipod, or at least get the new music ive gotten since the crash onto my ipod without deleting all the other songs when it syncs?

    i have about 800 more songs on my nano than itunes, due to a crash. How can I get the songs onto itunes from the ipod, or at least get the new music ive gotten since the crash onto my ipod without deleting all the other songs when it syncs?

    It has always been very basic to always maintain a backup copy of your computer for just such an occasion.  Use your backup copy to put everything back.
    If you have failed to bakup, then you can transfer itunes purchases from an ipod: File>Transfer Purchases

  • Mail -- How can I change the default email account from which my messages go, without having to change it each time I draft a message?  It currently assumes an email account that I rarely use. Thanks.

    How can I change the default email account from which my messages go, without having to change it each time I draft a message?  It currently assumes an email account that I rarely use. Thanks.

    sorry, but I can't find the mail preference in the latest Yosemite OS. Do you know where I can find it?
    Thank you
    Don

Maybe you are looking for

  • Not able to color different rows with different colors in a column of table

    Hi, I am trying to to display different rows with different colors in a column of the table based on some decode condition. I have gone through the following threads : Can we colour the rows in the column of a table Changing Color of a value in a col

  • Keynote presentation with sound

    I made a keynote presentation with sound - uploaded it to icloud and tried to play it thru my ipad mini - the sound will not work = how do I fix this?

  • Cannot invoke servlet from JSP

    I am trying to invoke a servlet from my JSP file. At present I am getting the error: 500 Internal Server Error java.lang.IllegalArgumentException: Resource /servlet/CreateSPSS not found      at com.evermind[Oracle Application Server Containers for J2

  • Google Visualization Chart appears on all browsers except IE

    We have a Google Combochart in our website homepage. http://www.globalforcestn.com/ The chart shows in Chrome, Firefox, Safari, and Opera. But it just won't appear in IE. It appears when I click "InPrivate" browsing though. So it's a big mystery to m

  • How to read .avi files?

    Hello, How can I wacht .avi movie on my mac, I tried with quicktime, it run but no sound no image ? Is somebody can help ?