Loading lib per object and not per class possible?

Hello, I have a problem with JNI and some libs I want to use.
On the Java side I have a class called FeedController that uses a class SenderJNI to communicate with a native lib, that implements the interface of SenderJNI. I have several native libs that all have different implementations of the interfaces.
What I want to do is to load a specific native lib for a specific SenderJNI object. I thought it could work with the following code.
public class SenderJNI {
     public native void init(String host, int port, String streamname);
     public native void send(String csvString);
     public native void close();
     public SenderJNI(String libName) {
           Runtime.getRuntime().load(libName);
}The problem I've encountered is, that loading libA.so for SenderJNI object A works fine, but if I want to load libB.so for SenderJNI object B, I still get the implementation of libA.so. So loading seems to be on a class based level.
Is there any way to load those two libs for different SenderJNI objects?

This might work.
Load all three libraries in your SenderJNI. Create three sub classes of your SenderJNI java class. They can just be stubs that dont implement anything.
Implement the native methods just once between the three libraries.
In your navtive methods, use IsAssignableFrom to determine which instance of the class was used, and call the proper library function based on the instance type that the call originated from.
jboolean IsAssignableFrom(JNIEnv *env, jclass clazz1,jclass clazz2);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • When I download a cd it loads as separate songs and not a single album

    When I download one particular  CD to I Tunes on my Mac Book Pro it loads as separate songs and not a single a single album.

    You may need to add the artwork manually. Google can help you find good quality album covers.
    Are these compilation albums with multiple artists? If so and you have entered individual artists in the Artist field the albums will show up in the iTunes Browser as you describe. To fix it set the Album Artist to "Various Artists" (without the quotes) and this album should display properly; or, highlight the full album, do a Get Info and click the Options tab and make "part of a compilation" YES.

  • Why when i connect my phone to my laptop do my recent photos load as image files and not jpeg

    why is it that when i connect my phone to my laptop my recent photos load
    as image files and not jpeg as they used to.Is this another issue with ios 8

    Thank you. I did that and made sure my phone was open to the camera roll. I was able to locate the import command and the photos appeared. Thanks so much!

  • Apps downloaded are appearing as "loading" on ipad 2 and not working

    I have downloaded couple of application through iTunes and loaded them to ipad2 64gd wifi 4g. They are appearing as "loading" on ipad 2 and not working. Tried to restore ipad to presious version os and reboot etc. but nothing worked. Can someone help please.

    Check iTunes and see if you have a pending or stalled download in there. If you do, finish that download or delete it if you can. If you can't finish or delete the download on the iPad, do it in iTunes on your computer and then sync the iPad. Then go back to the apps and see if they will download.
    If that doesn't work or if that was not the problem, go to Settings>Store >Apple ID, tap your ID and sign out. Then reboot 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 - let go of the buttons.
    Then go back to Settings>Store>Sign in and sign in again and see if the apps will update.

  • I down loaded an audio book and not all of it downloaded

    I down loaded an audio book and not all of it downloaded, it gets just over an hour into the book and the timer keeps going but no sound

    How to report an issue with Your iTunes Store purchase

  • Delete only the child object and not the parent object

    Hi,
    I have the below code:-
    TAnswer
    @ManyToOne(fetch = FetchType.LAZY)
         @JoinColumn(name = "question_id", nullable = false)
    //     @Cascade(value=CascadeType.ALL)
         public TQuestion getTQuestion() {
              return this.TQuestion;
         }     TQuestion
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "TQuestion", orphanRemoval = true)
         @Cascade(value=CascadeType.ALL)
         /*@Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE,
                org.hibernate.annotations.CascadeType.DELETE,
                org.hibernate.annotations.CascadeType.MERGE,
                org.hibernate.annotations.CascadeType.PERSIST,
                org.hibernate.annotations.CascadeType.DELETE_ORPHAN})*/
         public List<TAnswer> getTAnswers() {
              return this.TAnswers;
                   In Java:-
         public void removeAnswers(TQuestion question)
                        throws ApplicationException {
                   List<TAnswer> answerList =  question.getTAnswers();
                   deleteall(answerList);
         public void deleteall(Collection objects) {
                   try {
                        getHibernateTemplate().deleteAll(objects);
                        getHibernateTemplate().flush();
                   } catch (Exception e) {
                        throw new ServerSystemException(ErrorConstants.DATA_LAYER_ERR, e);
         }               Here the "deleteall" will delete both the answer records and question records, I don't want the questions
         records to be deleted. I have tried making the question as null when we set the answer object to be passed for delete
         bit still it is     deleting the question records as well.How to achieve the above in deleting only the answer (child) records
         and not the question(parent) record? Is there any thing we need to do with @Cascade for Question object? Please clarify.
    Thanks.

    What does deleteAll do, it doesn't look like a JPA method. You might want to ask your question on your provider forum, or use straight JPA methods as a simple EntityManager.remove(answer) on each answer in the collection should work.
    Regards,
    Chris

  • Safari is loading webpages extremely slow and not loading images...

    Not loading webpages a lot of the time and not loading images on sites such as Facebook, Twitter, etc. I'm new to Mac and I'm running Safari on a Mac Mini. Help? Also deleted ~/Libraries/Safari and it didn't work.

    Please answer as many of the following questions as you can.
    1. Have you restarted your router and broadband modem since you first noticed the problem? If the answer is no, do that now and see whether there's any change.
    2. Are any other web browsers installed, and are they also slow?
    3. What about other Internet applications, such as iTunes and the App Store?
    4. Are there any other devices on the same network that can browse the Web, and are they also slow?
    5. If you can test Safari on another network, is it slow there too?
    6. If you connect to your router with Wi-Fi and you can also connect with Ethernet, do that and turn off Wi-Fi. Any difference?

  • Can we lock down the system for BW object and not bex objects

    Hello,
    I have a question about object changeability. We want to lock down the BW production system but leave it open for adhoc query. Can we lock down the BW system only for few objects like Cubes, ODS, Infoobjects, Infosets, Multiproviders, and keep the system open for Bex objects like Query, varaibles and also for Infopackges and DTP's.
    Which tcode can we use for this ?
    Thanks,
    Message was edited by:
            Kiran Mehendale

    hi, usaully production system will be non changeable for all objects.. but as far as SAP BW is concerned we can make certain objects changeable by setting as follows..
    in production go to RSA1 - Transport Connection, select Object changeability button from tool bar, here you will find a list of objects which can be made changeable in a closed system.. just click on required objects and set it to Everything Changeable..
    Reg,
    Pradhiba
    <REMOVED>

  • I purchased lightroom upgrade 5.  I loaded into trail 4, and not 4 I purchased and have all work in.

    What do I do to reload my upgrade lightroom 5 into Lightroom 4 I purchased and not the trail app that I don't use.

    you purchased a lightroom 5 upgrade and you also own lightroom 4?

  • Transform handles are moving the object and not scaling.

    I've been running into trouble with the transform handles on objects moving the object instead of scaling/stretching the object. It seems to happen on the bottom and right sides vs the top and left sides. When I have the mouse over the handle it shows the scaling icon, but when I press the mouse it turns into the black selection arrow. Is anyone else experiencing this and know how to fix it?

    kjredin,
    I am afraid you have come across the Live Rectangle bug which is limited to the MAC versions starting with 10.7 and 10.8, but not 10.9 (Mavericks) or 10.10 (Yosemite). Hopefully, the bug will be fixed soon.
    So a switch to Mavericks or Yosemite with a reinstallation might be the way to solve it here and now.
    To get round it in each case, it is possible to Expand the Live Rectangles to get normal old fashioned rectangles, or to Pathfinder>Unite, or to use the Scale Tool or the Free Transform Tool.
    A more permanent way round that is to create normal old fashioned rectangles, after running the free script created by Pawel, see this thread with download link:
    https://forums.adobe.com/thread/1587587

  • Unlocking Objects and NOT layers

    Hi all.
    Question: in CS4, why is it that when I go to unlock all objects, it also unlocks layers?  That never used to be the case, and I find it extremely frustrating, especially since I want those particular layers to stay locked while I work on others.
    Any way around this?
    Thanks so much,
    B.

    FGP,
    To work (properly) with Illy, you need to think differently: she is very helpful, but she has her ways, and they are different.
    Fundamentally, you cannot just throw everything together in one image as you can with raster artwork which basically consists of coloured pixels.
    Vector artwork consists of clearly defined objects to a great extent defined mathematically. If their characteristics match, you can merge multiple objects into one in different ways, with one set of characteristics (such as fill colour and stroke colour and weight (thickness)).
    You can open multiple Layers with visibility (the eye icon) and select objects across layers, then perform certain operations such as Pathfinder Unite/Divide/whatever and such as Object>Compound Path>Make, and in each instance it will give you one object on the topmost Layer.

  • How can HitTestObject can trigger around the Object and not the rectangle of selection of the object ?

    Hi !
    I am doing a little mini-game but i have a problem with HitTestObject and his hitbox
    Look at those images :
    Here HitTestOject == 1 but it should be i want HitTestOject to react like this :
    This is weird because for me the wall is well cropped, because if i select a space near the rectangle it doesn't trigger it.
    Thanks !

    http://www.mikechambers.com/blog/2009/06/24/using-bitmapdata-hittest-for-collision-detecti on/

  • Why am I having a hard time loading some web pages and not other

    My Home page

    only in safari ?
    tried other browsers?
    if only in safari
    then the safari forum may have more safari experts who may not read posts here
    https://discussions.apple.com/community/mac_os/safari

  • Why are systemd startup scripts under /usr/lib and not /etc? [SOLVED]

    Just out of curiosity: why are systemd configuration files (startup scripts, or whatever they are called) in /usr/lib/systemd/system/ and not somewhere under /etc?
    After all, they are configuration files and not libraries.
    It may simply be my lack of knowledge of the standard linux filesystem layout, so please enlighten me.
    Last edited by louic (2015-04-09 09:12:11)

    https://wiki.archlinux.org/index.php/Sy … unit_files

  • Ojvmtc reports xy.jar is not a class or jar file

    Hi
    I am a little bit confuced because ojvmtc reports an error I can not imagine about:
    oracle@cikic-desktop:~/Downloads/dom4j-1.6.1$ ojvmtc /u01/app/oracle/product/11.1.0/mds/jdk/jre/lib/jce.jar
    /u01/app/oracle/product/11.1.0/mds/jdk/jre/lib/jce.jar is not a class or jar file
    The set is closed
    But jce.jar is a jar file and I can inflate it:
    oracle@cikic-desktop:/tmp/fo$ jar -xf /u01/app/oracle/product/11.1.0/mds/jdk/jre/lib/jce.jar
    oracle@cikic-desktop:/tmp/fo$ ls -l
    total 8
    drwxr-xr-x 3 oracle oinstall 4096 2010-05-03 19:40 javax
    drwxr-xr-x 2 oracle oinstall 4096 2010-05-03 19:40 META-INF
    And if I do a ojvm on a class file everything is working like expected:
    oracle@cikic-desktop:/tmp/fo$ ojvmtc javax/crypto/Mac.class
    The set is not closed
    96 classes are missing
    So It must be a configuration mistake somewhere ...
    Can you please help me out.
    Thanks
    Christian Maier

    Coole thanks, this works pretty well!
    Chris
    oracle@cikic-desktop:~$ cp /u01/app/oracle/product/11.1.0/mds/jdk/jre/lib/jce.jar /tmp/
    oracle@cikic-desktop:~$ ojvmtc /tmp/jce.jar
    The set is not closed
    131 classes are missing

Maybe you are looking for

  • Solution Manager 4.0 Configuration: SLDAPIUSER role

    In SPRO, SAP Reference IMG -> SAP Solution Manager -> Basic Settings -> SAP Solution Manager System -> System Landscape -> Automatic System Landscape Data Capture -> Connection of System Landscape Directory to Solution Manager -> Generate authorizati

  • Ghost image in InDesign CS5

    I opened a file that was created in CS4 in InDesign CS5. I have been working on it for a few days. I am now on page 39 and I am encountering a very annoying and puzzling problem. On that page, I had an image with a caption behing a text box that runs

  • Cannot drag and drop in my playlist to rearrange the song order???

    I have created a playlist in my iTunes 10 and all I want to do is change the order up a bit, so that all the same artists are not lumped together.  Help says I should be able to just drag and drop to reorder my songs in the play list.  However, it wo

  • Problem with the Catalog Data

    Hi All, It has been observed that the Catalog Data object sometimes goes for a toss and doesnt fetch any data anymore. In that case, we used to simply logout and login again. But now we have moved to IConnector Services and can't logout and login aga

  • Invalid Checksum Error for Photoshop Elements 10 installation

    I have tried installing Photoshop Elements 10 on my Macbook but I got an "invalid checksum" error (saying that the following disk images couldn't be opened).  Was there a previous solution to this type of problem?