�possible that the JNI side generates many instances of the native code?

Hi guys,
I asked this in a previous post but maybe with a bad constructed question.
I have C code that generate data (particles) for one client (non multithreading). In my webapp Im gonna have many clients but changing the C side is not initially my best solution.
When one client connects to the server ( calls the C code to generate data) it works ok, because I have only one client. When two or more clients connects to the server,
the data generated by the C side is DIVIDED over all clients. So, I need 'n' replications of the C side, non one C side, this way my data structures in the C side will be replicated
'n' times and could generate data for 'n' clients. Hope I have explained the right way.
Please replies! :).

1. Serialize the requests into the C code so that only one request is active. Save any state elsewhere. (Could be saved in java, could be saved in some C-side structure)Hi bschauwejava,
I think my problem is not concurrency, saving the state in java will mean a lot of overload but its an option.
Do you mean there is no way of having many instances of the C code ? this way I will have my state in each particular instance (one instance per client connected), and I could can forget about state.

Similar Messages

  • I am suddenly unable to receive calls on my iPhone 4S.  Is it possible that the age of the phone will affect its ability to receive calls? HELP!

    I am suddenly unable to receive calls on my iPhone 4S. 
    I have spent 2 hour-long sessions with technical support and although they were very nice, it is still not fixed.
    When I try to call the phone from a land line, it doesn't ring AND it doesn't recognize that a call is coming in (no missed call) BUT if I leave a message, it records it.
    Is it possible that the age of the phone will affect its ability to receive calls?
    HELP!

        MarketingMary,
    I am truly sorry to hear that your are unable to receive calls on your device. Thank you tbo27 for providing great troubleshooting steps. Making sure call forwarding is not active by dial *73 is great. Have you already reset network settings also? http://vz.to/RTz70g Are you able to make calls fine? Make sure Do not Disturb is not active. Settings>Do Not Disturb
    LindseyT_VZW
    Follow us on Twitter @VZWSupport

  • Is it possible that the moment you make your iphone 4s from Japan an openline here in the Philipines changes in Part No., Serial No., IMEI, and gigabyte capacity will change?

    is it possible that the moment you make your iphone 4s from Japan an openline here in the Philipines changes in Part No., Serial No., IMEI, and gigabyte capacity will change?

    Crackbot wrote:
    I awoke after missing several (6-7) phone calls from a single number to find a reminder to call someone back and I didn't create the reminder. And no one else had physical access to my phone. I really hope this isn't anything weird because it seems weird to me.
    It's very easy to accidentally create a reminder to call someone back. When someone calls you, there is a small button over the red "Decline" button labeled "Remind Me". If you tap, the call will be declined and a reminder to call back will be created. Easy enough to do if you're groggy and fumbling for the to make it shut up. If you weren't paying attention or were unaware of the feature, it might seem as if you had simply declined the call.

  • This error (HTTP 404 Not Found) means that Internet Explorer was able to connect to the website, but the page you wanted was not found. It's possible that the webpage is temporarily unavailable. Alternatively, the website might have changed or removed the

    This error (HTTP 404 Not Found) means that Internet Explorer was able to connect to the website, but the page you wanted was not found. It's possible that the webpage is temporarily unavailable. Alternatively, the website might
    have changed or removed the webpage.
    For more information about HTTP errors, see Help.

    check this
    http://social.msdn.microsoft.com/Forums/en-US/5576aba1-d196-42ce-bd62-ad5ddfa3a8fd/this-error-http-404-not-found-means-that-internet-explorer-was-able-to-connect-to-the-website-but?forum=sharepointgeneralprevious

  • Is it possible that the home button can show a light when a message or a phone call has beebn missed?!

    Is it possible that the home button can show a light when a message or a phone call has beebn missed?!

    No.
    There is no light there.

  • How is it possible that the black ipad 2 64 gb is sold out in hole Sweden, Hong Kong, Shanghai, Boston and Memphis at the same time!?

    How is it possible that the black ipad 2 64 gb is sold out in hole Sweden, Hong Kong, Shanghai, Boston and Memphis at the same time!?

    Because Apple can't get enought of them made to cover the demand, obviously. The iPad has been extremely popular and would probably be in short supply in any case, but the various disasters that have struck portions of the supply chain can't have made things any easier.
    Regards.

  • Is there a possibility that the Bluetooth send some content to other mobile phone brands (Nokia, SonyEricsson ...)

    Is there a possibility that the Bluetooth send some content to other mobile phone brands (Nokia, SonyEricsson ...)

    You can only send Top Secret Stolen Documents by bluetooth, nothing else .

  • [JNI Beginner] GC of Java arrays returned by the native code

    Hello all,
    I am beginning with JNI, to integrate a C library that pilots an industrial equipment, into a java UI. This library enables to exchange various proprietary PDUs (protocol data units), with the equipment, up and down (request/replies). Both requests and replies are arrays of bytes (+char*+).
    "Request" byte arrays are constructed by Java code, which passes them to the JNI code that glues with the lib. "Reply" byte arrays are returned to the Java code, which analyzes them.
    The "return reply" part is very similar to this [tutorial example|http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jniexamp.html] , which returns bytes read from a file. However there's something I don't understand with regard to garbage collection of the returned byte array:
    - in this stock example, the C code creates a Java byte array fills it, and simply returns it (example code stripped to highlight only the parts relevant to my question):
        jByteArray=(*env)->NewByteArray(env, size);
        (*env)->SetByteArrayRegion(env, jByteArray, 0, size, (jbyte *)sourceBytes);
        return (jByteArray);What will happen to this Java array (jByteArray) with regard to garbage collection?
    - if it's no more referenced (the example Java code just systemouts it and forgets it), will it be eligible to GC?
    - if it is referenced by a Java variable (in my case, I plan to keep a reference to several replies as the business logic requires to analyze several of them together), do regular Java language GC rules apply, and prevent eligibility of the array to GC as long as it's referenced?
    That may sound obvious, but what mixes me up is that the same tutorial describes memory issues in subsequent chapters: spécifically, the section on "passing arrays states that:
    [in the example] the array is returned to the calling Java language method, which in turn, garbage collects the reference to the array when it is no longer usedThis seems to answer "yes" to both my questions above :o) But it goes on:
    The array can be explicitly freed with the following call:
    {code} (*env)-> ReleaseByteArrayElements(env, jByteArray, (jbyte *)sourceBytes, 0);{code}Under what circumstances would one need to explicitly free jByteArray when it's about to be returned to the Java calling method? Or does this sentence apply to completely different situations (such as, when the array is +not+ returned as is to a Java method)?
    The tutorial's next section has a much-expected +memory issues+ paragraph, from which I quote:
    By default, JNI uses local references when creating objects inside a native method. This means when the method returns, the references are eligible to be garbage collected.I assume this means, +unless the references are assigned, in the Java code, to a Java variable+, right?
    If you want an object to persist across native method calls, use a global reference instead. A global reference is created from a local reference by calling NewGlobalReference on the the local reference.I assume this enables the C code to maintain a global reference to a java object even if it's not referenced anymore from the Java variables, right?
    I also checked the [JNI specification|http://download-llnw.oracle.com/javase/6/docs/technotes/guides/jni/spec/design.html#wp1242] , but this didn't clear the doubt completely:
    *Global and Local References*
    The JNI divides object references used by the native code into two categories: local and global references. Local references are valid for the duration of a native method call, and are automatically freed after the native method returns. Global references remain valid until they are explicitly freed.
    Objects are passed to native methods as local references. All Java objects returned by JNI functions are local references. The JNI allows the programmer to create global references from local references. JNI functions that expect Java objects accept both global and local references. A native method may return a local or global reference to the VM as its resultAgain I assume the intent is that Global references are meant for objects that have to survive across native calls, regardless of whether they are referenced by Java code. But what worries me is that combining both sentences end up in +All Java objects returned by JNI functions are local references (...) and are automatically freed after the native method returns.+.
    Could you clarify how to make sure that my Java byte arrays, be they allocated in C code, behave consistently with a Java array allocated in Java code (I'm familiar already with GC of "regular" Java objects)?
    Thanks in advance, and best regards,
    J.

    jduprez wrote:
    Hello all,
    I am beginning with JNI, to integrate a C library that pilots an industrial equipment, into a java UI. This library enables to exchange various proprietary PDUs (protocol data units), with the equipment, up and down (request/replies). Both requests and replies are arrays of bytes (+char*+).
    "Request" byte arrays are constructed by Java code, which passes them to the JNI code that glues with the lib. "Reply" byte arrays are returned to the Java code, which analyzes them.
    The "return reply" part is very similar to this [tutorial example|http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jniexamp.html] , which returns bytes read from a file. However there's something I don't understand with regard to garbage collection of the returned byte array:
    - in this stock example, the C code creates a Java byte array fills it, and simply returns it (example code stripped to highlight only the parts relevant to my question):
        jByteArray=(*env)->NewByteArray(env, size);
    (*env)->SetByteArrayRegion(env, jByteArray, 0, size, (jbyte *)sourceBytes);
    return (jByteArray);What will happen to this Java array (jByteArray) with regard to garbage collection?It will be collected when it is no longer referenced.
    The fact that you created it in jni doesn't change that.
    The array can be explicitly freed with the following call:
    (*env)-> ReleaseByteArrayElements(env, jByteArray, (jbyte *)sourceBytes, 0);Under what circumstances would one need to explicitly free jByteArray when it's about to be returned to the Java calling method? Or does this sentence apply to completely different situations (such as, when the array is not returned as is to a Java method)?
    Per what the tutorial says it is either poorly worded or just wrong.
    An array which has been properly initialized it a just a java object. Thus it can be freed like any other object.
    Per your original question that does not concern you because you return it.
    In terms of why you need to explicitly free local references.
    [http://download-llnw.oracle.com/javase/6/docs/technotes/guides/jni/spec/design.html#wp16785]
    The tutorial's next section has a much-expected memory issues paragraph, from which I quote:
    By default, JNI uses local references when creating objects inside a native method. This means when the method returns, the references are eligible to be garbage collected.I assume this means, unless the references are assigned, in the Java code, to a Java variable, right?As stated it is not precise.
    The created objects are tracked by the VM. When they are eligible to be collected they are.
    If you create a local reference and do NOTHING that creates an active reference elsewhere then when the executing thread returns to the VM then the local references are eligible to be collected.
    >
    If you want an object to persist across native method calls, use a global reference instead. A global reference is created from a local reference by calling NewGlobalReference on the the local reference.That is not precise. The scope is the executing thread. You can pass a local reference to another method without problem.
    I assume this enables the C code to maintain a global reference to a java object even if it's not referenced anymore from the Java variables, right?
    It enables access to it to be insured across multiple threads in terms of execution scope. Normally you should not use them.

  • I recently bought Photoshop Elements 12 and the system is saying that the Redemption Code is no longer active.  How do I get a new code that will allow access to the software ?

    I recently bought Photoshop Elements 12 and the system is telling me that the Redemption Code is no longer active.
    How do I get a new Code number that will allow met to access the software?

    you need your serial number.  you used your redemption number to redeem your serial number.
    if you don't know your serial number, check the account used to purchase or register your pse 12, Adobe ID

  • When attempting to perform updates, it asks for credit card information. I give it all the information its ask but then it tells me that the security code is invalid. I have rechecked it and rentered it several times still it tells me the code is wrong

    When attempting to perform updates on my iphone, it asks for credit card information. I give them the information directly from the card but then it tells me that the security code is invalid. I have rechecked the information several times which also includes reentering the card info and still it says its wrong. What do I do?

    Contact iTunes store support: http://www.apple.com/emea/support/itunes/contact.html.

  • HT1689 When I go to purchase anything something pops up asking me to confirm my billing information. It's all written in correctly but it insists that the security code is incorrect.

    When I go to purchase anything something pops up asking me to confirm my billing information. It's all written in correctly but it insists that the security code is incorrect.
    Please help

    Is the address on your iTunes account exactly the same (format and spacing etc) as on your credit card bill : http://support.apple.com/kb/TS1646 ? If it is then you could try what it says at the bottom of that page :
    If the issue persists, contact your credit card company and verify that they and any company they use to process credit card authorizations have the correct information on file.
    And/or try contacting iTunes support : http://www.apple.com/support/itunes/contact/ - click on Express Lane, then iTunes > iTunes Store

  • HT4759 In trying to renew iCloud on my iphone I keep getting the response that the security code of my credit card is incorrect. Can you help me with this?

    I have tried to renew my icloud subscription on my iphone. I have been unsuccessful after several attempts. The last time the reason give was that the security code of my credit card is incorrect. It is the number. Can you help?

    Have you tried checking your payment information details to make sure the CVV (security) code is correct (see http://support.apple.com/kb/HT1918)?

  • ATTEMPTED TO REGISTER MY LIGHTROOM 5 TO BE TOLD THAT THE REDEMPTION CODE IS NOT VALID

    I installed Lightroom 5 onto my computer.  Attempted to register by going to the website adobe.com/go/getserial.  After entering my redemption code I received a message stating that the redemption code was not valid.  I double checked the code before submitting.  At this point I need assistance, nothing is working for me.

    Redemption Code Help
    http://helpx.adobe.com/x-productkb/global/redemption-code-help.html

  • I have purchased a digital download of elements 13. I have downloaded it onto my lap top . When I try to download it onto my desk top I am getting a message that the activation code is invalid.

    I have purchased a digital download of elements 13. I have downloaded it onto my lap top . When I try to download it onto my desk top I am getting a message that the activation code is invalid.

    I just figured out a solution.  I connected my ipod to my computer, went to the 'info' tab on the menu for my ipod.  I checked 'Sync Mail Accounts', which were greyed out until I selected them.  That connected me to the Cloud and everything went back to normal.  Hope this helps someone else!

  • HT204350 Trying to activate my one to one and getting a message that the activation code is invalid.  Have tried 3 times and verified the number 3 times

    Trying to activate my one to one and getting a message that the activation code is invalid.  Have tried 3 times and verified the number 3 times

    Apple itself does not respond to questions on the Apple Support Communities forums.  Responses come from other Apple product users like yourself.
    iTunes Customer Service Contact - http://www.apple.com/support/itunes/contact.html > Get iTunes support via Express Lane > iTunes > iTunes Store

Maybe you are looking for

  • Whenever I use Adobe Premiere Pro CC 2014, My macbook occasionally re-boots automatically! Any idea why and how to fix it?

    I am using a Macbook Pro 15" late 2013 model, and it works great. However, when I use Adobe Premiere Pro (which is a lot as I am studying editing) it occasionally freezes for a second then reboots itself. I got the details of the error and pasted the

  • 3D menu not showing

    Hi, I just bought the creative design premium CS5, when i tried to use the 3d option in photoshop extended, i noticed that i dont have the 3D menu. OpenGL is enabled. Can anyone please help me???? Thank You. 

  • Itunes library error

    my itunes tells me the file itunes library can not be read because it was created buy a newer version of itunes yet it was made by the newest one

  • My code has a small problem,pls help me!

    Hi, I have an array that holds double values (0.24,0.3,etc) i tried to rescale the values from 0-255 and display them as an image but because the values are really small the image appears black.I think i should read the array and find the min and max

  • JMS Content Conversion wtih MessageTransformBean

    Hi I'm doing a content conversion in a MQSeries Receiver Channel using the MessageTransformBean. The adpater logs say that the bean has been processed and that the message has been transformed successfully. However, when I look on the queue and in th