Why can I cache method & field ids but not class?

In my efforts to understand JNI, I've been making heavy use of http://java.sun.com/docs/books/jni/.
I'm having trouble reconciling some of the points it makes with regard to caching; in particular, section 4.4.1 has an example of caching a jmethodID in MyNewString().
I don't understand why this is valid, but the example in 5.5.1 which caches the jclass is invalid.
After all, these are both simply jobjects in the end, and isn't the jmethodID cached in 4.4.1 based off the jclass found the first time? Doesn't that become invalid when the jclass becomes invalid?
Thanks,
: jay

The point the author of that book is trying to make is that caching JNI local references of such data like Java method IDs and classes is not valid across successive JNI calls. If you want to cache something the first time you load it and reuse it later, create a global reference via NewGlobalRef(), make this your cached variable, and delete the local reference automatically obtained from the JVM when you first asked for that something. Then you can refer to that cached variable all you want.
Also beware of trying to use references across threads - this is illegal in JNI. (You might want to reread chatper 5 for this and more. My opinion is the book "Essential JNI" is a bit better though not up to date either.)
- Chris

Similar Messages

  • Why can Premiere read DNxHD MOV's but not MXF's?

    I'm in the process of moving from Scratch to Resolve.  From Scratch I've always exported DNxHD QT's as they have been the best balance of quality and file size (and Scratch doesn't offer DNxHD MXF output).  Resolve 8 will only export DNxHD MXF's (version 9 is supposed to add QT export) but Adobe suite can't read them.  To the best of my knowldge the MXF is just a wrapper, the contect is the same so why can't the CS6 suite read them?
    Item for the suggestion box?

    I guess my question is:  Can Premiere/AME CS6 read DNxHD MXF files?
    I am running Win7/64 with CS6 Creative Cloud.  I have the Avid DNxHD codec installed. 
    Both Scratch and Resolve are colour grading applications (see http://www.assimilateinc.com/  and http://www.blackmagic-design.com/products/davinciresolve ).  Scratch would only output DNxHD QT's and Resolve will only output DNxHD MXF's.  I often output one set of files after post-colour but then use AME to transcode them many different ways (screening copies).  Adobe suite has always read the QT's but is not reading the MXF's.  My understanding is that the file types are both just wrappers and the content is the same so I am looking to see if there is an additional download from Adobe to be able to use the MXF's or if this is a feature request?

  • Why can I reach other web sites but not my own!  w/ Airport Extreme?

    I can get on line and reach other sites via Safari and IE with the connection via Airport Extreme. But I can't reach my own web site!!!
    And my Mac Mail is not useable because it says,
    "Connection Failed: There may be a problem with the mail server or network. Check the settings for account "[email protected]" or try again. The server error encountered was: The server "pop.patternglass.com" cannot be contacted on port 110."
    Honestly I've tried! Earthlink hosts my web site and they say its working - and it IS for everyone but me! Comcast is my ISP and they had me disconnect my Airport Extreme and connect my computer directly to the modem. Voila! It all works perfectly. Went back to Airport Extreme and same problem.
    There was no 'event' that signaled the change. One minute it was fine last night and the next minute it was gone. Help me, please!

    An answer to another question I had about Mac Mail fixed this problem (I can get to my web site) but I still can't get mail into my Mac Mail Box!
    I still get "Connection failed. There may be a problem with the mail server or network. Check the settings for account "[email protected]" or try again.
    The server error encountered was: The server "pop.patternglass.com" cannot be contacted on port 110."

  • Why can I chat with a buddy but not add them to my Buddy list?

    I'm using iChat 4.0.2 with OS 10.5.2.
    I add a particular buddy to my list but the name fades in and out and then disappears all together in a few seconds. No matter how many times and ways I try, I cannot add them to my buddy list and get them to stay. I can add other buddies to my list normally.
    During the time I can see this particular buddy's name in my buddy list, if I'm quick enough before they fade out, I can click to connect and chat perfectly. I can also request to view video with them and have them accept and view normally. However, if this buddy sends a video request to me, I hear the ring but then an instantaneous message window appears saying that the buddy "cancelled the invitation".
    Interestingly, after connecting with this particular buddy, I can maintain their text chat window and text chat as normal. This buddy is using iChat 3.1.9 and OS 10.4.11.
    Any help or ideas with how to keep this buddy in my list would be appreciated.

    Interesting.
    I would have gone the iChat > Preferences > Accounts > Security and just checked the Block list first.
    com.apple.ichat.Subnet holds the sort order and Allow/Block lists
    Setting the Preference to Allow All and then checking the Allow option and possibly the Block list would change the Subnet.plist anyway.
    For some the Flashing/disappearing Buddy is a result of iChat 4's response to Feedbag Error 10
    Feedbag errors are AIM codes for problems with the Buddy List.
    In this case it is adding a Screen name with a Real name option and that Real Name is already in the Address Book.
    To restate.
    I would leave the deletion of com.apple.ichat.Subnet.plist (as this will remove all those that may be in your Block list) until all other options have been exhausted.
    8:15 PM Sunday; June 15, 2008

  • Why can I purchase a plane ticket, but not an App with my Debit card?

    I cant believe that Apple continues to not address this issue?!?!? Its been 2 years now that I cannot authorise my Debit card with my iTunes account, to buy a simple App, song or film? I refuse to own a Credit card just so I can purchase items in iTunes.
    Wake up Apple, you are losing the thing you love most, MONEY!

    Apple has not explained why they no longer accept debit cards in the iTunes Store. All we, your fellow users, here know is that apparently they don't. I doubt that Apple doesn't know that they lose sales due to this policy, so clearly they have some good reason. What that reason is we can only guess, and my guess is that they feel that the lost sales are less important than the problems causes when someone hacks an iTunes Store account and drains someone's bank account.
    If you refuse to own a credit card - and personally I think you're taking a risk since debit cards usually give you much less protection against fraud - then perhaps prepaid iTunes cards would be the way to go.
    Regards.

  • Why can a MUCOW have border style,  but not Effects ?

    I know this may be part of a feature request
    As mucows are wrapped inside  DIV sections, is there any reason why you cannot use the Effects (Shadow / Bevel etc.)  It's just awkward having to always creating containing boxes to keep styles alined when it is possible on the parent div section through css.

    Your line must be designated as the "primary" line, and his is the secondary. And late October 2009 would put your upgrade dates right where they are - October 2009 is ONE year and 8 months ago.
    A nice rep MAY, MAY let you upgrade hubby's line early. You said you want the iPhone; you wouldn't be able to get that for your line on the early upgrade anyway (at least it wasn't happening when they first came out...) so here's what I would do . . .
    Use your early upgrade to get the HTC for your husband. You will need to activate it briefly on your line to accept the Terms and Conditions, then go back to your old phone and give hubby the HTC.
    When HIS upgrade comes up the end of June, go ahead and get the iPhone, activate it briefly on his line to accept the Terms and Conditions, then swap it over to your line.
    You both get new phones, upgrade discounts will apply, and your dates will be within a couple of weeks of each other. He gets the Trophy, you get the iPhone.

  • HT3529 I can text some of my contacts, but not all...why?

    I can text some of my contacts, but not all...why?

    excellent question. maybe you could give us some more information such as
    what happens when you try?
    is there anything in common with all the people you can't text (like they all own iphones or they all don't)?

  • Why can I download and install CS6beta but the program does not activate???

    Why can I download and install CS6beta but the program refuses to be activated on the idiotic grounds that either I am not connected to the internet or my computer clock is not showing the right time?  If in New Zealand we're not allowed to use the beta, why does Adobe not have the decency and courtesy of telling us so and why instead of feeding us with those stupid putoffs???    

    I had a note from PS Pattie ; I can't find it here.  Anyhow, these were her questions and my answers:
    Q:Did you download from this location?  http://labs.adobe.com/technologies/photoshopcs6/
    A: Yes
    Q:Did you select TRY and enter your Adobe ID?
    A: I was then asked to "Sign in". I pressed the sign and got the following reaction:
    Please connect to the internet and retry. Either your computer is offline or the clock on your computer is set incorrectly, causing a connection error.  An internet connection is required. Please connect to the internet or adjust your clock and try again.  If this problem persist, please contact Customer Support.  I did so and was told "This page is not available"
    Q: Did you try to download again and install?
    A:  Yes, three times – each time 1.71GB.  I tried many other devices; none worked.
    gw

  • Why can I print from my iPhone and not my iPad? I have been able to do it in the past and have tried a hard reset but it can no longer find the printer.

    Why can I print from my iPhone and not my iPad? I have been able to do it in the past. I have tried a hard reset but it still cannot find the printer.

    In addition to rebooting the router and the iPad, I would reset the printer as well. Unplug the printer from power and do the same with the router. Leave the router unplugged for about 30 seconds. Plug the router in first and let it totally start up, plug the printer in again, and then reboot/reset the iPad.
    Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider if it appears on the screen - let go of the buttons. Let the iPad start up.
    If that doesn't work, you can try resetting all settings. Settings>General>Reset>Reset All Settings. You will have to enter all of your device settings again.... All of the settings in the settings app will have to be re-entered. Your WiFi passwords, location services, device preferences all have to be re-entered. You will not lose any data or media whatsoever.

  • Why is it I can drag audio in landscape orientation but not in portrait orientation?

    Why is it I can drag audio in landscape orientation but not in portrait orientation?

    Because landscape is the default layout mode.
    Portrait, which is book--optional, is for editing already added content, basically.
    Get your audio in and then test to learn how elements operate, and see Publishing With iBooks Author
    http://shop.oreilly.com/product/0636920025597.do 

  • Why can i hear the person talk but they cant hear me?

    why can i hear the person talk but they cant hear me?

    you microphone may be defective, did this happen after an update???

  • Field avaialble in field catalog but not when I try to create the condition

    Hi,
      I wanted to add a new table to a delivery output. I need the fields delivery type/ship point and destination country. I could see that destination country (LAND1) is not available in the field catalog. I added it from the list of available fields (in KOMKBV2) and can see it in the field catalog but not when I try to create the condition table. What else do I need to get this field ?
    Regards,
    Hari.

    Also add your new field to structure KOMBZ
    If you want to use a new field in the field catalog, you must add the field to KOMP or KOMK in the following INCLUDES:
    - header data in INCLUDE KOMKAZ in KOMK
    - item data in INCLUDE KOMPAZ in KOMP
    When you use INCLUDES, the field is automatically added to KOMG and the field catalog.
    The routines for assigning values to the new fields in order processing are found in member MV45AFZZ. Use the following user exits:
    - USEREXIT_PRICING_PREPARE_TKOMK (header fields)
    - USEREXIT_PRICING_PREPARE_TKOMP (item fields)

  • I cannot find my most recent events.  I can see the photos in "photo" but not event.

    Why did my most recent events not appear?
    I can see the photos in "photo" but not in events,and I named them and everything.

    It does you are looking in the wrong place
    either the date of the photo is incorrect or the event sort is wrong (view menu ==> sort events)
    You also can select a photo in "photo view" and show event to find the event
    LN

  • Why can I only see iCloud Drive and not iCloud in Finder?

    Why can I only see iCloud Drive and not iCloud in Finder? The latter is not available either under Favourites or Menu>Go>...
    After a clean install of Yosemite 10.10.3 on a MacBook Pro, I chose not to upgrade from iCloud to iCloud Drive because it would break syncing with my iPhone 4. My docs are still visible in iCloud, according to System Preferences. I can access them on my iPad but I not from my MacBook Pro. Calendars and Contacts sync ok.
    I tried logging out of iCloud, rebooting and logging back in, but that did not remedy the problem.
    What's gone wrong?

    Just so I'm clear. You have enabled iCloud Drive in your iCloud preferences:
    Now, in your Finder's sidebar you still do not see the iCloud Drive showing. In the Finder's preferences is it checked:

  • I can open some older numbers files but not others. I get a message that says I need a newer version of numbers.

    I can open some older numbers files but not other. I get a message saying I need a new version of numbers. Why would some files open and not others?

    SK,
    Here's the deal. If you ever open a Numbers file with Version 3, the file is converted to Version 3 and can't be opened again by Version 2. Version 2 and Version 3 are undoubtedly both on your machine and they look so similar that you may not realize which you are using. So, there are two steps to getting into trouble.
    1. Open a Numbers 2 file with Numbers 3, edit it and Close it.
    2. Try to open that file with Version 2. You ill get the error.
    To always get it right, find the file you want to open in Finder, Right-Click it and choose Open With... and pick Version 3 from the drop down list.
    If you have a file that you prefer to use only in Version 2, always use Open with... Numbers 2.3.
    Jerry

Maybe you are looking for

  • Help required in understanding the flow of control in working with EJB 3.0

    *1. Can anyone help me in understanding the flow after getting an object of InitialContext in using Stateless/Stateful in EJB 3.0 from client i.e. what we are getting in the step Object ref=jndiContext.lookup("CalculateBean/Remote) .* *2. What is the

  • Time capsule problems - please help! Disk errors.

    I bought a 500gb TC after a data loss scare and it has been ticking along doing its thing happily for a couple of months. I have it connected to my router and my iMac and Macbook backup to it wirelessly. Today the backup of my macbook failed (my iMac

  • Since new update - Adobe Media Encoder and CUDA not working

    CUDA not launching - Premier CC says that only software will work. Media encoder crashes on launch. Re-installed both. Nvidia 670 GTX

  • Itunes won't recognize IPhone

    The iPhone is recognized by the USB and the device manager but it won't show up in iTunes. I have uninstalled and re-installed itunes and quicktime multiple times, rebooted, logged on as a different user..seriously, I have tried everything - includin

  • Mail link to this page...question

    When I select the "Mail link to this page" option in Safari, the Mail compose window opens but it opens behind the main Mail application. Does anyone know what I need to change to correct this please? Thanks