RMI: can a client support cuncurrent calls from others client?

Hi, I'm trying to build a simple peer 2 peer system.
My clients, when registering to the server, are passing a ResourceList (class that extends Remote) to the server, so that the server has a complete list of all the resources of the connected clients.
When a client search something, the server returns to him the list containing the searched resource(remote reference to the list of the owner client), and the searching client can call a getResource on the remote reference, that returns the Resource (serializable).
Now I'm wondering, if more than one client get the same remote reference to a list, and call getResource at the same time, what will happen?
Since each client for RMI is a thread, it's like n treads are calling the same method, that actually is remote.
So, if I synchronize this (remote) method, I can assure that only one client at time gets the Resource, but what if the client dies while having the lock on the resource?
Thanks in advance for any answer.

Now I'm wondering, if more than one client get the same remote reference to a list, and call getResource at the same time, what will happen? The same what happens in normal (non-remote) application with several threads calling the same method.
Since each client for RMI is a thread, it's like n treads are calling the same method. Right.
So, if I synchronize this (remote) method, I can assure that only one client at time gets the Resource,It depends what you mean by "gets the Resource". By synchronizing a method you assure that the execution of this method will be synchronized, but you cannot say this about the clients using the Resource later.
but what if the client dies while having the lock on the resource?Generally you don't have to worry about it, it will be handled by JVM. Either the client thread will die prematurely (and release the lock) or will execute normally and time out later when trying to send the response back to the client over (proably dead) connection. But in your case the resource will not be locked! You are synchronizing a method which basically assures that just a single thread may execute this method at a time.
Edited by: AdamDyga on Jun 24, 2010 3:59 PM

Similar Messages

  • Can't send or recieve calls from other iphones

    After IOS upgrade to 8.0 on Iphone 5 can not send or receive/ calls or texts from other Iphones, but no problems to andriod phones or blackberry. Tried IOS 8, 8.0.1 and 8.0.2. Due need to go back to IOS 7?

    If you previously backed up your device you may be able to restore from your computer or through iTunes.
    http://www.apple.com/support/iPhone
    Search for how to restore iPhone to previous state, etc.
    Good Luck

  • Autoreaction doesn't work from client 000 but works from other clients

    Autoreaction doesn't work from client 000.
    More details coming.   Having trouble getting the thread to post.

    We set up a new local auto-reaction.   This is not a central auto-reaction.  The auto-reaction writes a
    message to the UNIX system log /var/adm/messages when a "Security"
    alert i.e. - Logon, RFCLogon, TransactionStart, etc.  occurs.
    The RZ20 alerts are being properly generated and can be seen in both
    the CEN system and the local system. On the local system if I view
    all alerts for the MTE using transaction RZ20 and select one of the
    alerts and choose Edit -> Nodes ( MTE ) -> Start methods -> Start auto-
    reaction method. The auto-reaction writes the message to the UNIX
    system log. If I execute the same procedure in client 000 nothing is
    written to the UNIX system log.
    I've also tried triggering a new alert and running SAPMSSY8 from SE38
    while the alert is still in status ACTION_REQUIRED. If I do this from
    client 010, an entry is written to the unix system log. If I do this
    from client 000, nothing is written to the unix system log. In both
    cases, the status of the alert changes from ACTION_REQUIRED to ACTIVE.
    Since the System Cyclic program ( SAPMSSY6 ) that triggers SAPMSSY8
    always runs in client 000, the auto-reaction never writes the messages
    to the UNIX system log.
    I have been working on this issue for days.  There are several posts and notes relevant to a similar situation with e-mail alerts that are not working from client 000 because SAPCONNECT is not set up in client 000.   However, this auto-reaction does not send an e-mail, so SAPCONNECT set-up should not be necessary.   I've searched Service Marketplace and could not find any notes that resolved the problem either.  
    I've also checked CCMS Self-Monitoring and cannot find any alerts or errors relevant to this problem.
    Does anyone know why the auto-reaction only works from a client other than client 000?
    Best regards,
    Dave

  • How can i lookup a session bean from the client side

    how can i lookup a session bean from the client side...........i am using sun appserver..............
    this is my code.................[B]
    private final static String JNDI_NAME="ejb/LmsBean";
    private static String url="ldap://localhost:4848";
    Hashtable h=new Hashtable();
    h.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
    h.put(Context.PROVIDER_URL,url);
    System.out.println("Before Loading Context in Delegate");
    Context ctx=new InitialContext(h);
    System.out.println("Loaded Context in Delegate");
    Object obj=ctx.lookup(JNDI_NAME);
    System.out.println("Loaded Object in Delegate");
    System.out.println("Before Loading Home in Delegate");
    LmsHome home = (LmsHome )PortableRemoteObject.narrow(obj,com.parx.lms.controller.LmsHome.class);
    System.out.println("Loaded Home in Delegate");
    lms = home.create();
    System.out.println("Loaded remote in Delegate");
    [B]and i got the exception........
    Inside Client before calling delegate
    Before Loading Context in Delegate
    javax.naming.CommunicationException: Request: 1 cancelled
    javax.naming.CommunicationException: Request: 1 cancelled
    at com.sun.jndi.ldap.LdapRequest.getReplyBer(LdapRequest.java:60)
    at com.sun.jndi.ldap.Connection.readReply(Connection.java:405)
    at com.sun.jndi.ldap.LdapClient.ldapBind(LdapClient.java:340)
    at com.sun.jndi.ldap.LdapClient.authenticate(LdapClient.java:171)
    at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2640)
    at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:290)
    at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:175)
    at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:193
    at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.ja
    va:136)
    at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.jav
    a:66)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
    62)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243
    at javax.naming.InitialContext.init(InitialContext.java:219)
    at javax.naming.InitialContext.<init>(InitialContext.java:195)
    at com.parx.lms.lmsdelegate.LmsDelegate.getController(LmsDelegate.java:3
    0)
    at com.parx.lms.lmsdelegate.LmsDelegate.addUserDelegate(LmsDelegate.java
    :50)
    at com.parx.lms.client.consoleClient.Client.main(Unknown Source)
    pls go tru the exception and pls help.........

    That url string should be having the server name or ip instead of localhost.

  • I can't complete a facetime call from my iphone 4 to a friend's ipad 2.  any suggestions?

    I can't complete a facetime call from my iphone 4 to my friend's ipad 2.  Any suggestions?

    Hi pacermaker man,
    Thanks for visiting Apple Support Communities.
    I suggest going through the the troubleshooting steps in this article first if you are not able to make a FaceTime call to another iOS device:
    iOS: Troubleshooting FaceTime
    http://support.apple.com/kb/ts3367
    Cheers,
    Jeremy

  • HT6337 How can i receive calls from other devises (non iOS) on my iPad

    I wanna get messages and phone calls from other devices on my iPad
    is it possible?

    Really? I can get calls from anybody on my iPad and Mac using Continuity.
    https://www.apple.com/ios/whats-new/continuity/
    iPad and Mac, now answering the call.
    Sometimes when your iPhone rings, it’s not where you are. Maybe it’s charging in another room. Or it’s buried in your backpack. But your Mac or iPad is sitting right there. Now you can make and receive phone calls on those devices as long as your iPhone running iOS 8 is on the same Wi-Fi network. Incoming calls show the caller’s name, number, and profile picture. Just click or swipe the notification to answer, ignore, or respond with a quick message. And making a phone call from your iPad or Mac is just as easy. Simply tap or click a phone number in Contacts, Calendar, or Safari. It all works with your existing iPhone number, so there’s nothing to set up
    You do need to have an iPhone on the same Wifi network though. But any call from any phone (does not need to be an iPhone) that can come in to your iPhone, can be picked up on a supported iPad or Mac.

  • Can a Stored Procedure be called from a Rule (not using Scripted JDBC Adap)

    Hello smart people,
    Question: Can a stored procedure be called from a Rule without using the Scripted JDBC Resource Adapter?
    What's Desired: The project has very strong sql developers and average at best Java developers. We have been successful at implementing the scripted JDBC Resource Adapter which makes use of Java Bean shells. The custom Java Bean shell contains code that calls a stored procedure. We are cool with that process.
    However we would like to be able to set up a Rule that calls a Stored Procedure without jumping thru the Java Bean Shell layer. The Stored Procedures we will be developing will not access the tables in the Waveset database. Instead the Stored Procedures will be accessing custom tables in a custom database. The custom DBase will be housed on the same dBase server as the Waveset database.
    Environment: Identity Manager 7.1. Oracle 10i, and Unix OS.
    It seems to me that this task is possible, but the posts in this forum make it sound like perhaps it is not.
    Do any of you smart people agree that it should be possible or better yet has anyone implemented such an approach?
    Thanks.

    We did this by putting all of the JDBC calls into a Java class, then instantiated that class and called the methods from within a rule. An example of a rule we used is this:
    <Rule authType='UserMembersRule' name='List UserType'>
      <block>
        <defvar name='adapter'>
          <new class='com.waveset.adapter.ScriptedJdbcResourceAdapter'/>
        </defvar>
        <invoke name='setResource'>
          <ref>adapter</ref>
          <invoke name='getObject' class='com.waveset.ui.FormUtil'>
            <ref>context</ref>
            <s>Resource</s>
            <s>Banner</s>
          </invoke>
        </invoke>
        <defvar name='jdbcHelper'>
          <new class='edu.bates.JDBCHelper'>
            <invoke name='getConnection'>
              <ref>adapter</ref>
            </invoke>
          </new>
        </defvar>
        <defvar name='userList'>
          <new class='java.util.ArrayList'/>
        </defvar>
        <invoke name='addQueryToList'>
          <ref>jdbcHelper</ref>
          <s>SQL QUERY HERE</s>
          <ref>userList</ref>
        </invoke>
        <ref>userList</ref>
      </block>
      <MemberObjectGroups>
        <ObjectRef type='ObjectGroup' id='#ID#Top' name='Top'/>
      </MemberObjectGroups>
    </Rule>

  • Can a report in ERP called from CRM system using RFCs??

    Hi All,
    Please let me know if this is possible, if so , how?
    Can a report in ERP called from CRM system using RFCs??
    Thanks
    Siva

    Yes, you should make an RFC function in ERP and inside the
    function you can call the report with a SUBMIT. Then in CRM you can call the RFC function...
    Best regards,
    Iván
    P.D.: Give points if answer helps!!

  • What is the name of the name of the app that I can use to make free calls from iPhone to iPhone?

    What is the name of the app that I can use to make free calls from iPhone to iPhone ?

    You mean Whatsapp messanger?
    WhatsApp Messenger is a cross-platform mobile messaging app which allows you to exchange messages without having to pay for SMS.
    NO calls.
    FaceTime, Skype and Viber are the most popular. (at least here in Greece)

  • Help!!! I can not make or receive calls! other functions itself. Internet, sms, whatsapp work. I restored as new iphone from the phone and from itunes and still not working.

    I can not make or receive calls! other functions itself. Internet, sms, whatsapp work. I restored as new iphone from the phone and from itunes and still not working.
    Sorry for my english i'm spanish

    I have not tried that...I will look up the process so that I can do it correctly (and still transfer all of my files, contacts, etc).  Any suggestions?  What is the advantage of restoring as a new device..is this more akin to a complete wipe of a hard drive?

  • Can I I place a call from my iPhone 5s using USB connected iMac

    I was pleasantly surprised when I found my iMac (2012-Yosemite 10.10.2) could be notified and answer calls from my USB connected iPhone 5s (OSx8.2).
    Question: Can I also place a call from my iMac; and if so, How? Is there an app for that?

    USB connection has nothing to do with it. They have to be on the same WiFi network. It's part of 'Continuity' in OS X Yosemite and iOS 8. You can place calls using FaceTime on your Mac.

  • I can't receive texts or calls from certain phones

    I can't receive texts or calls from at least 2 AT&amp;T phones and at least one sprint iphone...I've reset the settings, deleted threads, called my carrier (tmobile) to make sure there are no blocks in place. It's weird because I can't even receive texts from tmobile or my bank! My bill is paid and I do get messages from other numbers. Can anyone help?

    Finally got through to talk to a very helpful technician at EE by selecting account query rather than technical problem on the automated answering system on 150. A reset by EE sorted the problem out and the phone is working fine again.

  • Can my MAC automatically Record Calls from my RAZR via BlueTooth ???????

    Can my MAC automatically Record Calls from my RAZR via BlueTooth ?
    That would be so cool !

    well, that only possible if the call comes through the mac
    if it was a landline, then you connect the phoneline into the modem, thru the software, then back out the modem and out to the phone. I have sucessfully done this on a windows machine
    i suppose cellphones can be used as modems, so you could hook it upto the mac and then answer the call thru your mac's speakers and microphone...youll need to develop or find the appropriate software to this tho.

  • When a servlet accepts a call from a client, it receives two objects.what??

    hi,
    When a servlet accepts a call from a client, it receives two objects. What are they???

    How will u pass the argument from one servlet to another servlet??Actually, it's dead simple: Just tell servlet #1 that servlet #2 said something nasty about servlet #1's mother and sister, so servlet #1 will head-butt servlet #2 and you have the argument passed along ...

  • Execution Times of Stored Procedures Called from Other Stored Procedures

    If I execute sys.dm_exec_procedure_stats, it will produce execution times of my stored procedures executed recently.
    However, stored procedures called from other stored procedures do not show up.
    Is there code that can return the execution times of stored procedures even though they are called from other stored procedures.

    Look at the example. It is counting nested execution.
    CREATE PROC z1SP AS SELECT * FROM Production.Product;
    GO
    CREATE PROC z2SP AS SELECT * FROM Production.Product WHERE Color is not null; EXEC z1SP;
    GO
    SELECT object_name(2002822197), object_name(2034822311);
    --z1SP z2SP
    EXEC z1SP; EXEC z2SP;
    GO 10
    SELECT * from sys.dm_exec_procedure_stats
    database_id object_id type type_desc cached_time last_execution_time execution_count
    16 2002822197 P SQL_STORED_PROCEDURE 2014-12-16 13:02:45.170 2014-12-16 13:02:46.717 20
    16 2034822311 P SQL_STORED_PROCEDURE 2014-12-16 13:02:45.460 2014-12-16 13:02:46.687 10
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Database Design
    New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014

Maybe you are looking for