Communication between different JVM in one computer

hi
I need to communicate a java program with another java program,
I use a file to realize this. But my two program should read the file periodicaly, I use timer.
But it is not good. It will ocuppy some CPU time.
I look for some good way in JDK DOC, I can not find some one.
So what are methods to commucate between JVM

My A application it will need to transfer some data into another B application.
And only A application find some data need to transfer to B application, or invoked by user that there is need to transfer data, it wlll write the data to B application.
In other case, B application still run it's service and task.

Similar Messages

  • Communication between different JVMs

    Hallo,
    is there a simple way, to exchange data between different java sessions? At the moment I store the needed data to a table and load it in my java procedures when ever I need them.
    But because this data is temporary, it wouldn't really be necessary to store the data. It's just for communication between the different JVMs. Is there an other way to do this, too?
    Thanks, Christian

    Christian, I may have misunderstood your question, but, until java version 1.4, the only way for different JVMs to communicate was via sockets, or secondary storage (the file system -- which includes databases).
    In java version 5.0 (previously version 1.5), there is a new feature known as class data sharing.
    But since you posted to the "Database >> JVM" forum, I can't help thinking that you are referring to different database JVMs. Is that correct? In any case, sockets and secondary storage are your only options there as well.
    Good Luck,
    Avi.

  • How can you share picture between different user on one computer

    I am trying to move pictures from one user I photo to another user on the same computer but not sure how to do it can anyone help?

    Just the Photos?
    Export from one user (File -> Export) to the FInder. Drag the images to the Users/Shared folder. Change user and then import from there.
    Or use iPhoto Sharing:
    For iPhoto 09 (version 8.0.2) and later:
    Enable Sharing in your iPhoto (Preferences -> Sharing), leave iPhoto running and use Fast User Switching to open the other account. In that account, enable 'Look For Shared Libraries'. Your Library will appear in the other source pane.
    Any user can drag a pic from the Shared Library to their own in the iPhoto Window.
    Remember iPhoto must be running in both accounts for this to work.

  • Communication between multiple JVMs

    We have a Java toolkit that is shipped as a JAR file. The toolkit is ported from a C++ DLL running on Windows. Therefore, in both instances (Java and C++), we can't control who loads us or when.
    I need to communicate between different JVMs running on the same machine. The communication is very simple: "Is this user logged on in your JVM?" I send a string to the other JVM and I get back a boolean. I don't need to worry about crossing machine boundaries. Also, I'm not expecting to have a huge number of JVMs running. Maybe 3 or 4 could be likely. However, the solution does need to scale in case there are more than that. I'm not setting a limit on the number of JVMs either.
    The C++ code handled this situation very easily and elegantly. It created a named system semaphore (mutex) whenever a user logged on. The name of the mutex was the username. So, if there were multiple instances of the DLL running in separate processes (EXEs), we could easily tell if this user was logged on in another instance. We'd try to create the system semaphore - it would fail saying the name already exists. Therefore, we'd know the user was already logged on. The named system semaphore provided the means for a machine-global list - which is exactly what we wanted. It also had this extra benefit: if the process terminates normally or abnormally, the system semaphore is removed from memory. This means: the application is terminated, the user is no longer logged on, and we can relog this user on.
    Therefore, I have 2 requirements:
    1) A machine-global list where we can place a string. Keep in mind, it doesn't absolutely have to be a machine-global list. A suitable means to talk to other JVMs is acceptable too.
    2) If the process exits normally or abnormally, the string(s) get removed (for this JVM) from the list. Abnormal termination is the more important one to focus on because lots of people of varying skill levels use our toolkit. Abnormal terminations can be common.
    The first thought is to store these in a file. That solves #1, but not #2. I've seen the JIPC package. However, I'm not too crazy about requiring 3rd party developers to start up another program (JIPC) before they start up their application. As I said, we're just a toolkit so we can't control when or who loads us. It's not totally out of the question, but I'd prefer something else.
    I have a fairly involved solution that involves sockets. The first JVM creates a ServerSocket on a specific port and becomes the server. Subsequent JVMs also try to create the ServerSocket on the same port. They get a BindException because the ServerSocket already exists, so they know they're clients. Then, they create a client socket and talk to the server that way. This gets a little hairy when the server goes away. The clients will scramble to become the server and then all the other clients need to reconnect to the new server.
    This proposed solution sounds like it will address both requirements. However, I'm looking for something simpler. I'm asking this forum for help in case there's an easier way to do this. I don't have the breadth of experience with Java yet to know if there's a simpler way to fix this. If I have to go with the socket solution, I will. I just didn't want to overlook something simple that is already built into Java.
    Thanks for any tips or suggestions

    Thanks for the response.
    FileLock. We still have to target JDK 1.3 so we can't use FileLocks (at this point)
    JNI: That's an interesting idea. I suspect many people are using our software on Windows. Therefore, we could probably fix it in Windows the same as in the C++ code. If they're not on Windows, we could use the Sockets approach.
    I also had another idea: how about hashing the username string into some integer (or long) value. Then use the hashed value to lock some other resource: like the port number passed to ServerSocket. I know ServerSocket only accepts 0 - 0xFFFF so this obviously won't work. But is there some other system-wide thing we could lock given an integral value?

  • How do you set up two different ipads on one computer ?

    I purchased a new ipad for my wife and want to get her started but we both use one imac as our desktop system.  How do you set up two different uses on one computer.
    Thanks,
    Dave

    Other options not covered in the article:
    1) You can plug both in under the same computer username and same iTunes Apple ID and give each device it's own name. You should be able to manage them as separate devices with different media, apps and screen layouts. All of your media would be in a common pool, though.
    2) Under one computer username, you can login and logout of two different iTunes Apple IDs. This option is cleaner with two computer usernames but it can be done with one.

  • Two phones with different contacts and one computer?

    how do i go about syncing two phones, with different contacts, to one computer?

    If you are using Microsoft Outlook and syncing different contacts is your concern, you can set up a new Contacts folder for your iPhone (like "Jeff's Contacts") and set iTunes to sync that folder only to your iPhone. Create a second new Contacts folder for the other iPhone's contacts and do the same thing. Works great for my iPhone and my wife's iPhone, both synced to our home computer.

  • Can you have 2 different iPhones on one computer?

    Can I have 2 different iphones linked to one computer?

    Yes, you can.  Be sure to give each a distinctive name so you can differentiate between them.
    Here are some other tips:  How to use multiple iPods, iPads, or iPhones with one computer, http://support.apple.com/kb/HT1495

  • Putting 2 different ipods on one computer

    i have 2 ipods on one computer its windows Xp and when i hook my ipod up it tells me "another user on this computer is using the ipod software, so itunes is unable to communicate with this ipod. please ask the other user to log out." i dont know how to fix this

    Are you using more than one log on account? read this:
    iTunes: How to share music between different accounts on a single computer:
    http://docs.info.apple.com/article.html?artnum=93195

  • Sync few different iPhones on one Computer?

    Hello from Germany,
    my wife and I have two different iPones 4 and we also have different settings and of course different music taste but we use just one computer with iTunes together. If we sync our iphones the computer see the different names but will sync both phones in the same way. Is there a way to have different settings to sync every iPhone individual (music, emails, contacts and so on)???
    Thank you for help
    Markus

    The absolute best way to do this is to create separate computer logins. That way there is absolutely no way your data can become intermingled. You can still use the same iTunes account under each login, and transfer iTunes content(using your phones) between logins, without syncing. If you disable auto-sync under preferences, you can connect each others phone and use the File>Transfer Purchases command to transfer iTunes content between logins. Doing things this way will insure your contacts, mail, etc., are completely separate. Make sure you authorize the computer under each login: Store>Authorize this Computer.

  • Communication between two jvm (client and server)

    Hi ,
       I want to access the UME service of the SAP J2EE Container using a stanalone client application.
    So the client would be running on remote JVM.
    Here we use the JNDI service to communicate between the client and server.
    p.put(Context.INITIAL_CONTEXT_FACTORY,"com.sap.engine.services.jndi.InitialContextFactoryImpl");
                        p.put(Context.PROVIDER_URL, providerURL.trim());
                        p.put(Context.SECURITY_PRINCIPAL, securityPrinciple.trim());
                        p.put(Context.SECURITY_CREDENTIALS, securityCredentials.trim());
                        Context ctx = (Context) new InitialContext(p);
                        Object objRef = ctx.lookup(ejbName.trim());
    I want to know that is the communication between the client and server secured in this scenario
    Best Regards
    Manoj

    Okay, the client and server VMs are different implementations of the Hotspot engine. Hotspot basically takes the Java bytecode from your .class files and turns it into native machine instructions at runtime. (The optimizations are actually much more complex than that, but that's the basic concept.)
    The client VM is so named because it's designed to be used for GUI-type applications interacting with the user. It is designed to have a quicker startup and smaller memory footprint.
    The server VM uses more memory and is typically slower at starting up than the client VM, but can often perform ridiculously fast. This of course depends completely on the particular code being run, and you should probably profile and see which VM works better for your application.
    Some interesting optimizations are performed by the 1.4.1 server VM, such as: removal of array-bounds checks (when it determines that the index can't become out of bounds), inlining of methods, and more.
    Here is a link to more info if you're interested:
    http://java.sun.com/products/hotspot/docs/whitepaper/Java_HotSpot_WP_Final_4_30_01.html

  • How can I consolidate all photos from different users on one computer?

    We just enable one computer to be the "Family" computer. I want to be able to consolidate all photos from the different users into one location. That way no matter wich user is login they can see and browse all the family photos. How can I do that? Do I need and external drive?
    Thanks in advance?
    MoMa

    Move the iPhoto Library to the Users/Shared folder, or you can use an external disk formatted Mac OS Extended (Journaled).
    Merge the Libraries as Larry says, with the paid version of Library Manager.
    In each account in turn: Double click on the Library to open it. (You may be asked to repair the Library Permissions.) From that point on, this will be the default library location. Each account will have full access to the library, in fact, each account will 'own' it.
    However, there is a catch with this system and it is a significant one. iPhoto is not a multi-user app., it does not have the code to negotiate two users simultaneously writing to the database, and trying will cause db corruption. So only one user at a time, and back up, back up back up.

  • Is it possible to have 2 different Ipods on one computer?

    I have a Ipod mini first generation and just got a new 30G Ipod.
    I downloaded all my music on to the new Ipod and when to Clean out the old one to download music for my mom on it.
    After I was done downloading the old Ipod with my mom music I went to put some new music on the New 30G. When I connected the Ipod to USB port I lost all the music I already had and it put my mom's music on it?
    Is there any way to have 2 i pod playlist on the same Itunes and not lose my music?

    We have 2 minis (my brother and me) , one computer two different tastes in music. The link to help with this is no longer available. I need a way to have one iTunes, but not mix music or have the downloads mix/delete etc. Is there an easy way? I understand about having different users under user accounts, which we do and have disabled fastswitching. I'm not the brightest iPod user so if you have simple instructions it will be very much appreciated!

  • How do i share music between 2 users on one computer with ipod nano 7th generation

    How do I share music on itunes between 2 users on 1 computer and get the music from the computer onto my ipod nano 7th generation?

    Hi kstrenge,
    Welcome to the Apple Support Communities!
    I understand you want to share iTunes music on the same Windows XP computer between two different user accounts. To accomplish this please read over and follow the steps in the attached article.
    iTunes: How to share music between different user accounts on a single computer
    http://support.apple.com/kb/HT1203
    Once the music is shared and you are ready to sync your music from the computer to your iPod nano, please follow the steps in this article.
    iTunes: Syncing media content to iPod
    http://support.apple.com/kb/HT1351
    Have a great day,
    Joe

  • Can I have two different accounts on one computer?

    EXAMPLE I HAVE THE IPOD CLASSIC AND THE IPHONE5, I WANT TO HAVE SEPERATE ACCOUNTS FOR EACH ON THE SAME PC. IS THAT POSSIBLE?????????

    Sure... How to Use Multiple iDevices with One Computer
    Also... have a read here...
    https://discussions.apple.com/message/18409815?ac_cid=ha

  • Can you have 2 different iTunes on one computer?

    I own an iPod classic and I have my itunes account loaded on my pc and also on my macbook. I am thinking of getting my bfriend a nano for Xmas and wondered if I do this, can a second itunes (with his account) be loaded on the same pc? If not, we do have an additional pc. Let me know if this is possible, thank you!

    Read through this article; it will give you several options:
    How to use multiple iPods with one computer
    Regards.

Maybe you are looking for