How to keep track of client in rmi server

how can I keep track of a disconnected client in a rmi server ?
And what logic do I use to disconnect a client fro mthe server ?

When a RMI client receives a stub to the remote object, RMI client runtime sends a dirty() call to the RMI server runtime which in turn helps the RMI server runtime in updating the client references to the remote object. Client reference is nothing but a unique identification generated by client RMI runtime for that instance of JVM. RMI uses a reference counting algorithm for destroying unreferenced remote objects. Once all references (all clients who are holding the stub to this remote object) to a remote object drops to zero, local garbage collector takes care of freeing this remote object.
RMI client runtime initiates a TCP connection with the remote object only when a method is invoked on the stub. RMI transport layer uses a simple connection pooling mechanism to use already established TCP connections with server objects in further remote method invocations. Let's say the client is invoking a remote method on the remote object's stub fetched from the registry service. Now RMI transport layer initiates a TCP connection with the remote object (exported at ("host1", 4567)). After completion of the remote method, RMI client's transport layer keeps the connection open for some time (some configurable value) to take the advantage of the already established TCP connection in future remote method invocations on remote objects exported on the same host and port ("Host1", 4567"). RMI transport layer also takes care of closing these connections if the connections are idle more than configured value of connection open time.
From the RMI server's perspective, once the RMI server runtime receives a remote method invocation request from the RMI client, it creates a new thread and try to dispatch the method on the designated remote object. After returning the results of the remote method to the client, RMI client's transport layer may not end this conservation with this remote object to take the advantage of this TCP connection in future remote method invocations. So the same thread may be used for dispatching another remote method in future. This is actually the side effect of re-using the established TCP connections on the client side.
RMI server maintains client's reference in the client's reference set of the remote object as long as the client holds a normal reference to remote object's stub in its JVM. Once the client relinquishes the reference to the stub (goes out of the scope or setting it to the null), RMI client automatically sends clean() call to the RMI server runtime to update client reference set of the remote object. There is no public API to lookup or manipulate the client references for a given remote object, but you can always unexport the remote object even some clients are holding stubs to the remote object. Next time when the client invokes the remote method using this stub, client will receive a "connection refused exception" from the server because the remote object is already unexported. Let's say if the RMI server is started again (remote object is exported and registered with registry service), the client once again obtains the stub to the remote object from the registry service instead of using earlier stale stub. (This time remote object may have been exported on different port, so the port details in the old stub may not be valid any more).
At any point of time there can be more than one established TCP connection with the RMI client. This may be the temporary condition; RMI client's transport layer automatically closes these connections if it does not receive any remote method invocation requests with in a pre-determined interval of time (default: 2 min). You can always find out RMI client's host in a given remote invocation by using getClientHost(), but how can you semantically define a "disconnected client in a rmi server" in your application context ? You can always force all the clients to fetch the stub again in future remote method invocations by unexporting the remote object in RMI server. I hope this information helps ...
-- Srinath Mandalapu

Similar Messages

  • How to keep track of how many times a link has been clicked?

    How to keep track of how many times a link has been clicked or accessed? Do I need to use database for this?

    Hi
    Proably something like this can work,
    1> Have a servlet/bean invoked when the link is linked
    2> have a static variable in that servlet/bean wich gets incremented before the control is passed to another desired page..
    The problem with this approach is that care has to be taken that the servlet/bean is not re-instalised, in case of which the static variable will also be instalised and the data would be lost.
    The best thing is to store the count in the database.
    Regards
    Arathi.

  • How to keep track of the users who are all currently logged in

    Hi All,
    I have basic knowledge of Session and Servlets. I am wondering how to keep track of the users who are all currently logged in. There should be some way of achieving it.
    I thought of it and come up with having an Application variable that hold it when ever a user successfully logged in.
    Thanks in advance for any reply.

    You can do this by keeping data in a static veriable in a some class of yours. The variable will need to be a collection.
    Whenever a user loogs in to the site a servlet/jsp should put the users information in to the collection and when logs off or when the session expires the entry should be take off.
    You can achive this by storing the velues in a some sort of a week collection where the entries are automaticaly removed when all the other refferences to the entry goes out of scope.
    You might need to read bit about java.lang.ref package and WeekReference
    Or you can make the entry in the collection contain the last time that the user visited any of the pages and a thread can run time to time and clean up the older entries which have timed out

  • How to keep track of the changes done in ALV GRID Report

    Hi Experts,
    how to keep track of the changed record in ALV GRID Report. how to set the field to be editable even for the entire row also. Can anybody guide along with code also?...
    Valuable answers will be rewarded.
    Thanks,
    Satish.

    Hi,
    Access the table through SM30. It comes blank as standard. Click "New Entries" and make entries for changes to be tracked. For example, whenever an org. unit changes 002 and 003 relationship, you will make entries like:
    01 O 1001 B002 Activate box checked
    01 O 1001 B003 Activate box checked
    Here, 01 is your active plan version, O is org. unit, 1001 is infotype and B002 and B003 are the subtypes. You can also use * for infotype and subtype which means every change will be logged.
    If you then run the report RHCDOC_DISPLAY through SA38, it will pick up all the changes pertaining to B002 and B003 relationship for org. units (in the above example).
    Similarly, you can set up this table for other object types.
    For more information, follow SPRO>Personnel Management>OM>Basic Settings>Activate change documents and go through the documentation for that node. Also, read up the documentation for the report.
    Hope this helps.
    Donnie

  • How to keep Track of the wagetype Changes

    Hi Experts,
    How to keep Track of the Changes after changing the wagetype values.If any body has made changes to the existing wagetype, how do we keep a track of what changes has done, is there any standard Tcode through  which we can get the information.
    Thanks in advance,
    Regards,
    Magesh.S

    Hi,
    Access the table through SM30. It comes blank as standard. Click "New Entries" and make entries for changes to be tracked. For example, whenever an org. unit changes 002 and 003 relationship, you will make entries like:
    01 O 1001 B002 Activate box checked
    01 O 1001 B003 Activate box checked
    Here, 01 is your active plan version, O is org. unit, 1001 is infotype and B002 and B003 are the subtypes. You can also use * for infotype and subtype which means every change will be logged.
    If you then run the report RHCDOC_DISPLAY through SA38, it will pick up all the changes pertaining to B002 and B003 relationship for org. units (in the above example).
    Similarly, you can set up this table for other object types.
    For more information, follow SPRO>Personnel Management>OM>Basic Settings>Activate change documents and go through the documentation for that node. Also, read up the documentation for the report.
    Hope this helps.
    Donnie

  • How to keep track of changes made for a particular Inq Doc number.

    hi all,
    my senario is as follows :
    the requirement is to send mail every time we take print for a sapscript for inquiry ..however the header and the body of the mail will change depending whether the user created a new inquiry doc or changes an existing doc. how to keep track of the changes.
    please give me some suggestion.
    thanks in advance
    Srinivas

    its time cosuming process :
    check table CDHRD/CDPOS tables to keep track of changes.
    Regards
    Prabhu

  • How to keep track of the sequence of the BSP Pages being invoked.

    Hi,
    How to keep track of the sequence of the BSP Pages being invoked.
    I have a BSP Page A.htm. There are two other pages B.HTM and C.HTM in the same BSP Application.
    The page B.HTM has a link A.HTM. The page C.HTM also has a link A.HTM. On clicking  these links the Page A.HTM would be invoked. Is there any way to keep track which BSP Page  (i.e B.HTM or C.HTM) invoked the page A.HTM.
    Any input on this Regard would be of great help.
    Thanks and Regards,
    Pavithra

    Hi Pavithra,
    Declare in page attributes:
    appl_url type string
    In the onClick event of the link that calls the A.htm page , use:
    call method runtime->get_url
    receiving
    URL = appl_url.
    Now appl_url contains the url (also name) of the page that invoked A.htm .
    Hope it helps.
    Anubhav.

  • How to keep track of emails btn Blackberry & Outlook???

    Hi,
    I'm considering buying a Blackberry Curve (Sprint).  My hangup thus far is that I want to have all of my sent emails in my Outlook on my home computer.  My solution thus far has been to use GoToMyPC so that I can connect to my home PC from any computer and take care of my emails.  Also, I work mostly from home, so this isn't a huge problem in terms of convenience and efficiency. 
    Most people tell me that they CC themselves when they send an important email from their Blackberry.  This is how they keep track of important emails sent from their Blackberry.  IS THERE ANOTHER WAY?  A MORE RELIABLE WAY?  IS THERE A WAY TO HAVE ALL EMAILS SYNC'D WITH OUTLOOK WHEN (THEORETICALLY) SYNCING MY BLACKBERRY WITH MY HOME COMPUTER?  IF NOT, WHAT IS THE BEST WAY?
    Thanks in advance,
    Gary 
    Solved!
    Go to Solution.

    I have two (2) EMails addresses; on is my blackberry address, and the other is my Outlook.  I mostly give out my Outlook address so I could have it on my PC at home, and when Isync it is there,. Or, in the field if I inadvertantly delete a message, I know it will still  be on my PC at Home. I think your friend is correct. If she has the Blackberry
    Enterprise System through her IT Dept. at work. I have the BIS (Blackberry Internet Service).
    I hope this helps. It is quite confusing
    Writer~
    Thanks,
    Writer~

  • How to keep track of what I've previously draw

    They said:
    Everytime the paint method is called, everything that was drawn before must be redrawn. The paint method has no way to keep track of what you've previously drawn, it is your responsibility as the programmer to keep track of such things.
    Is this right?
    How can keep track of my random shades of random amounts?
    Is there a simple way to do that?
    In a example, I must use getGraphics to get JPanel's graphics, then I use it to random draw something in the JPanel.
    I just want to keep them in my JPanel when it resizes.I haven't get the answer yet.
    Can you help me?

    Ok I haven't got time to write the code for you, but here's the idea:
    //User drags mouse around to draw on screen
    //use mouseActionListener to catch MouseDragged event
    int x = mouseEvent.getX();
    int y = mouseEvent.getY();
    Point p = new Point(x,y);
    arrayListOfPoints.add(p);
    // end mouse action capture
    //override paint method of component
    public void paint(Graphics g){
        super(g);
        Iterator it = arrayListOfPoints.iterator();
        while(it.hasNext()){
            Point p = (Point)it.next();
            g.drawLine(p.getX(),p.getY(),p.getX(),p.getY())   

  • How to keep track of last song played?

    Hi!
    Does anyone know how to keep track of which song played last time before itunes was closed? I have a big list of songs in my playlist and I play it everyday while I'm working. If I shut down my computer and start it again the next day, I have to manually look for the song I played the previous evening. Is there a way where it will keep track of the last song and play it from that?
    Thanks
    JB

    Subwaygirl, welcome to the Mac family! I'm not sure whether you're asking about beginning to play from the last song played on your iPod or iTunes so I'll answer both.
    From the iPod, simply hit Play and it will begin at the next song. It cannot go back to the last song played.
    From iTunes, use my answer to Chris to add the Last Played column, sort by that and select the song at the top of the list. That is your most recently played song. If you hit the >> or Next button you will then go to the next song in the randomly-sorted list.
    Powerbook G3 Mac OS X (10.3.9)

  • Kicking out a client from rmi server

    I have a few clients on a rmi server .
    how can I disconnect a client from the server?
    the client is an applet.
    I treid calling a method containning System.exit(0)
    from the server on to the client but it throws a
    java.securtiy .. exception?
    so how can I close down the client applet from the server?
    thanks

    please help
    shall I throw a remote exception on the server

  • How to keep track of how many records to display in a page.

    Hi All:
    I am using Weblogic 9.2, Web Services Client, and Struts.
    I have a java client in struts that calls a web services.
    The "ID" field contains a Java integer.
    The "First_Name" is a Java String.
    The "Effective_Date" field is a Java date field.
    The web service returns an arrayList of a class called Result.
    Code for Result.java:
    >
    public class Result
    int id;
    String first_Name;
    Date effective_Date;
    public int getId
    return id;
    public void setId(int id)
    this.id=id;
    public String getFirst_Name()
    return first_Name;
    public void setFirst_Name(String first_Name)
    this.first_Name = first_Name;
    public Date getEffective_Date()
         return effective_Date;
    public void setEffective_Date(Date effective_Date)
         this.effective_Date=effective_Date;
    From the arrayList, I displayed the result as the following:
    ID FIRST_NAME EFFECTIVE_DATE
    3 John 9/10/2007
    2 Andrew 1/11/2006
    5 Peter 3/4/2006
    The "ID" header is a link.
    The "First Name" header is a link.
    The "EFFECTIVE_Date" is a link.
    If I clicked on the link "ID", the first time, it will sort the rows in ascending
    order like the following:
    ID FIRST_NAME EFFECTIVE_DATE
    2 Andrew 1/11/2006
    3 John 9/10/2007
    5 Peter 3/4/2006
    If I clicked on the link "ID", the second time, it will sort the rows in descending
    order like the following:
    ID FIRST_NAME EFFECTIVE_DATE
    5 Peter 3/4/2006
    3 John 9/10/2007
    2 Andrew 1/11/2006
    If I clicked on the "First_Name" field the first time, it will sort the rows in
    desceding order.
    If I clicked on the "First_Name" field the second time, it will sort the rows in
    ascending order.
    This applies the same for the "EFFECTIVE_DATE".
    If the arrayList returns 80 records of class Results.java.
    I needed to displayed only the first 50 records for the first page and 30 records for the second page.
    How do I keep track of that so that when I am in the second page, I know to display only record 51 to 80?
    If I have a arrayList that returns 120 records of class Results.java.
    In the first page, it displayed only 50 records.
    In the second page, it displayed only 50 records.
    In the third page, it displayed only 20 records.
    Assuming I am able to sort the rows by ID, FirstName and Effective_Date by using Results.java implementing the
    Java Comparator class. Is it still possible to keep track of how many records displayed in the first page and how many records should
    be dispalyed in the second page?
    Any hint would be greatly appreciate.
    Yours,
    Frustrated.

    Hi,
    Access the table through SM30. It comes blank as standard. Click "New Entries" and make entries for changes to be tracked. For example, whenever an org. unit changes 002 and 003 relationship, you will make entries like:
    01 O 1001 B002 Activate box checked
    01 O 1001 B003 Activate box checked
    Here, 01 is your active plan version, O is org. unit, 1001 is infotype and B002 and B003 are the subtypes. You can also use * for infotype and subtype which means every change will be logged.
    If you then run the report RHCDOC_DISPLAY through SA38, it will pick up all the changes pertaining to B002 and B003 relationship for org. units (in the above example).
    Similarly, you can set up this table for other object types.
    For more information, follow SPRO>Personnel Management>OM>Basic Settings>Activate change documents and go through the documentation for that node. Also, read up the documentation for the report.
    Hope this helps.
    Donnie

  • How to keep track of status using wrapper class?

    Hi,
    I got the following code on the server side:
    ..........//this method invocation may take a long time to do
    Object methodResult = method.invoke(object, args);
    if (methodResult != null) //method invocation return results
          //convert the methodResult Object into JDOM Element   
         ObjectWriter writer = new SimpleWriter();  
         Element element = writer.write(methodResult); 
         //return result to client--------------------------------------------------------  
         //Results tag to notify incoming result from method invocation on next incoming byte  
         out.println("Results"); 
         //convert the element into String  
        String strXML = Util.convertXMLtoString(element);  
        //send the String xml out to the client. The client will receive the string representation of the xml  
        out.println("strXML):        
    else //there are no results return from method invocation
        //save the result into xml file  
        Util.createFile(element, new File(filename));
    .......................The problem is how to I keep track of the status of the method invocation.
    As can be seen from the above code, Object methodResult = method.invoke(object, args);
    the method invocation will take a long time!
    How do I write a wrapper class to keep track of the status of the method invocation that can be check by the client? I am thinking of using a url to keep track of method invocation so that the client can continously poll the wrapper object to check if the method invocation has finished.
    Can anyone change my code and give advice?
    Thanks a lot!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        

    No,
    I am not using Java threads at all.
    I just need to keep track of the status of the method invocation and report to the client.
    Sometimes, the method invocation can take ages so it is not acceptable for the client to invoke a method and wait a long time without any response: but in fact the server is still in the process of executing the method.
    Please advice.

  • How to keep track of views of a particular mysql entry

    I have a dynamic website through php and mysql. How do I get my website to keep track of the amount of views each entry got (and for the amount of views to be recorded in my mysql table? Is there an easy way to do this with dreamweaver?

    i do have a column for views but i have do not know how the results would be inputed.
    how do i use that "update statement" you mentioned to input increment view amounts in my column?
    table_name has column for views.
    page is a column in table that is used to dynamically display content based on title in URL parameter ie
    website.com/?page=home
    website.com/?page=about_us
    etc.
    Use query to update views+1 where page = the URL parameter that is entered into address bar to display the dynamic page content.
    $page = "-1";
    if (isset($_GET['page'])) {
    $page = $_GET['page'];
    $query_hits = sprintf("UPDATE table_name
    SET views = views+1
    WHERE page = %s", GetSQLValueString($page, "text"));
    $hits = mysql_query($query_hits, $connection) or die(mysql_error());
    best,
    Shocker

  • How to keep tracks together in shuffle mode?

    When playing in shuffle mode you can't hear tracks in line together while they should be, e.g. in conceptalbums.
    Is there a way to overcome this?
    (You can do it with complete albums when downloading in the Library, but what can you do when the tracks are already in the Library?)

    Joepiet wrote:
    The second tab is calles 'Info' as well. Down under you have the possibilty to mark Part of a collection (Deel van verzameling). It should do the trick but it doesn't. I once tried, but I haven't found out what it does.
    In English, that is named as "Part of a compilation" and Google Translates that as "Deel van een compilatie". As far as iTunes is concerned, this means that the album has songs by different artists, albums such as the "Now X" series. It is how iTunes keeps a Various Artists album together.
    Joepiet wrote:
    I want to shuffle works, not tracks..
    Ah! I see what you want now!
    Two possibilities that I can think of (number 2 is the better one):
    Create a Playlist for each "work", by simply adding all the songs from one work to one Playlist and all songs from the next work to another Playlist and so on. Then, if you want to play one complete work, followed by another complete work, you could simply create a further Playlist and add each "work Playlist" you want to this new Playlist. To make the works random, all you could do is choose for yourself as you are adding them. You would need to play this new Playlist in order, not shuffle.
    If you originally imported this music from a CD, you could import from the CD again. But this time, combine the tracks that make up one work, as one track. iTunes names this as "Join CD Tracks" (or CD-tracks samenvoegen in the Dutch iTunes).
    In the screenshot above, I have selected tracks one, two and three and then used the options menu to find Join CD Tracks. This third option will not be visible until you select two or more adjacent tracks, as shown above.
    In the screenshot below, I have joined tracks one, two and three as one "work". Then joined tracks four, five and six as a separate work. Finally, I've joined tracks seven through twelve as a third work.
    Notice in the screenshot that the Options menu says "Unjoin CD Tracks". That is because the highlighted ones (7-12) are currently joined.
    And here it is in Dutch:
    With this second method, a work (of several tracks) will always be played as one track (or song). You can then simply add all the individual works to one Playlist, and play the Playlist in Shuffle Songs mode. That way, each work would be played in full, followed, at random, by another work.)
    And if you really need to - import the CD this second time with a slightly different album name, so that you then have two copies. One, where each song (or track) is the individual song on the album and the second where each "song" is a work.
    Now, lets hope I can get my iTunes back into "English" English, as my Dutch is not too good, even though I'm just the other side of the North Sea from you!

Maybe you are looking for

  • OutofMemory Error while sending file to database using Web services

    I have a file of 30MB to be written to the MySQL database. I am doing this in Axis web services and it gives me the following error: (I am using Tomcat as the application server and Apache as the web server, Axis 1.3 and MySQL standard 5.0.21 version

  • Add Custom Field to VA01

    Hi Experts, I have to add one field to screen in transaction VA01. I have the below details: Program Name: SAPMV45A Screen Number where field is tobe added: 8459 ( Its properties says as Subscreen) I didnot find a enhancement name that include a scre

  • Lost Synch Data

    I had a poor internet connection so I was unable to update itunes on my laptop using APPLE SOFTWARE UPDATE - which fails if there are interuptions in your signal. Instead I downloaded the new itunes from apple.com and installed it - not realizing tha

  • Macbook & iTunes Will Not See, Sync or Charge iPhones

    After months of no real problems, my Macbook (OS X 10.4.11) and iTunes (9.03(15)) refuse to recognize my iPhone or my wife's iPhone. No sync, no charge, nothing in the Finder window. One time it did recognize my iPhone but then gave an error message

  • TS3772 puedo descargar photo de mi ordenador in mi iphone con este program?

    puedo descargar photo e muzic de mi ordenador in mi Iphone?