Calling a method on a remote object to ping the server

I need a generic way of pinging a server to check if it is still there. Assuming I don't know the methods defined in the remote interface of the server, one way to achieve this would be to invoke one of the Object methods on the server and catch any exceptions. To do this I could call invoke on the RemoteRef interface, but this requires the opnum of the method, and I don't know what these are for the Object methods. Can anyone help, or suggest a better method for pinging the server ?
William
For example:
// my remote service
Remote service;
// obtain remote ref
RemoteRef ref = ((RemoteObject) service).getRef();
// invoke Object method e.g. hashCode
ref.invoke( ... );

if you mean a real ping like windows/unix send from the ping command then it can not be done from jave. you can either connect to the echo port and test it that way or you would have to make a native call.

Similar Messages

  • Calling a method that returns an object Array

    Hello.
    During a JNICALL , I wish to call a method which returns an object array.
    ie my java class has a method of the form
    public MyObject[] getSomeObjects(String aString){
    MyObject[] theObjects=new MyObject[10];
    return theObjects
    Is there an equivalent to (env)->CallObjectMethod(...
    which returns a jobjectArray instead of a jobject, and if not could somebody suggest a way around this.
    Thanks,
    Neil

    I believe an array oj jobjects is also a jobject. You can then cast it to another class.

  • Calling parent method from within child object

    Hello,
    A quick question! Is it possible to call a method in a parent object from within a child object.By child object I mean an object that was instantiated within the parent object.
    Thanks.

    A quick question! Is it possible to call a method in a
    parent object from within a child object.By child
    object I mean an object that was instantiated within
    the parent object.Since you are using ambiguous terminology, it would be much better if you provided a small sample of your code to avoid confusion. I am guessing that you are actually talking about an inner class when you say child class.
    If that is correct, then you can do something like this:
    class Parent {
      void foo() {}
      void bar() {}
      class Child {
        void foo() {}
        void test() {
          bar(); // No conflicts, just call the Parent method
          Parent.this.foo(); // Use explicit qualification to avoid conflicts.

  • [svn:bz-trunk] 5137: Fix failing security tests on BlazeDS/ trunk by using a remote object to invalidate the FlexSession at the end of each test method which should cause each test method to run with a new /clean session.

    Revision: 5137
    Author: [email protected]
    Date: 2009-03-02 10:28:59 -0800 (Mon, 02 Mar 2009)
    Log Message:
    Fix failing security tests on BlazeDS/trunk by using a remote object to invalidate the FlexSession at the end of each test method which should cause each test method to run with a new/clean session. It looks like some test methods were leaving some things in a bad state which was causing the next test that ran to fail. These may be legitimate bugs/issues so we should investigate further to see what sequence of events gets things into a bad state but for these tests we want all of the test methods to run in isolation.
    Modified Paths:
    blazeds/trunk/qa/apps/qa-manual/WEB-INF/flex/services-config.mods.xml
    blazeds/trunk/qa/apps/qa-regress/WEB-INF/flex/remoting-config.mods.xml
    blazeds/trunk/qa/apps/qa-regress/testsuites/mxunit/tests/messagingService/security/stream ing-amf/JMSAuthSendSubscribeConstraintTest.mxml
    blazeds/trunk/qa/apps/qa-regress/testsuites/mxunit/tests/messagingService/security/stream ing-amf/MessagingAuthProSendTest.mxml
    blazeds/trunk/qa/apps/qa-regress/testsuites/mxunit/tests/messagingService/security/stream ing-http/JMSAuthSendSubscribeConstraintTest.mxml
    blazeds/trunk/qa/apps/qa-regress/testsuites/mxunit/tests/messagingService/security/stream ing-http/MessagingAuthProSendTest.mxml
    Added Paths:
    blazeds/trunk/qa/apps/qa-regress/WEB-INF/src/qa/messaging/SessionManager.java

    In general theory, one now has the Edit button for their posts, until someone/anyone Replies to it. I've had Edit available for weeks, as opposed to the old forum's ~ 30 mins.
    That, however, is in theory. I've posted, and immediately seen something that needed editing, only to find NO Replies, yet the Edit button is no longer available, only seconds later. Still, in that same thread, I'd have the Edit button from older posts, to which there had also been no Replies even after several days/weeks. Found one that had to be over a month old, and Edit was still there.
    Do not know the why/how of this behavior. At first, I thought that maybe there WAS a Reply, that "ate" my Edit button, but had not Refreshed on my screen. Refresh still showed no Replies, just no Edit either. In those cases, I just Reply and mention the [Edit].
    Also, it seems that the buttons get very scrambled at times, and Refresh does not always clear that up. I end up clicking where I "think" the right button should be and hope for the best. Seems that when the buttons do bunch up they can appear at random around the page, often three atop one another, and maybe one way the heck out in left-field.
    While I'm on a role, it would be nice to be able to switch between Flattened and Threaded Views on the fly. Each has a use, and having to go to Options and then come back down to the thread is a very slow process. Jive is probably incapable of this, but I can dream.
    Hunt

  • Creating remote objects and passing the retrieved data to modules

    I found at this Adobe tutorial a nice "RemoteService" class that  creates a RemoteObject and contains the functions for handling the  result and fault events. If I wanted to use this approach, how could I  pass the data from the result handler to interfaces that modules from  the main application could use?
    I could put the RemoteService/RemoteObject in the modules, but (in my  opinion- and I could be wrong) the best design seems to be using the  remote calls in the main app and passing the data along to the modules.
    Ultimately, I would like to know what the "best practices" are for creating remote objects and passing the retrieved data to modules
    Thanks!

    public void mouseClicked(MouseEvent e) {
      X x = new X(e.getX(), e.getY());
    }I don't see the difficulty.

  • The Remote object used on proxy server?

    Hai,
    Iam attended for one interview they asked me one question
    could send me the answer
    The Remote object used on proxy server?

    That's not even a question. What did they really ask you?

  • RMI server calling a method on a client object ?

    Hi All,
    I am writing a client - server application and my intention is to use RMI for comunication.
    When the client has to retrive datas from the server it's easy, but let's suppose that the server has to inform the client about some updates about the data, how can I do that?
    I do not want the client keeping calling methods on the server to see if there is something of new :(
    Is there some way to pass an OutputStream to the client, so when the server writes someting, the client reads it ? ( the client should have a thread which keeps reading)
    Or maybe I could pass a reference of a client class to the server so when the server needs to inform the client, it calls a method on this class?
    thanks, Fab

    The client can be a Remote Object to, passed as a remote reference when calling the server.
    Basically all you'll have to do is "register" the client on the serverside.
    Your serverside class would the have a:
    register(RemoteClient client) method.
    The server could the use this remote reference for callbacks.
    So, all you have to do is declare the Remote Interface for the client and implement it, and the call the servers myRemoteServer.register(this).
    If you've already implemented the server, it's a peace of cake to enhance your client.

  • Calling a method from a UICommand Object

    How do I call an action method from a UICommand object?
    I create a HtmlCommandLink in my backing bean, and I think I should be setting the action, but with what? The method takes a MethodBinding but I can't find much detail on how to get that. I just want to call a method like linkAction1_action() in the example below, but you cannot pass a method.
    public class Page1 extends AbstractPageBean {
      private HtmlPanelGroup panel = new HtmlPanelGroup();
      public HtmlPanelGroup getPanel() {
        return panel;
      public void setPanel(HtmlPanelGroup panel) {
        this.panel = panel;
      public Page1() {
        HtmlCommandLink link = new HtmlCommandLink();
        link.setAction(/* what do I put here */);
        this.panel.getChildren().add(link);
      public String linkAction1_action() {
        return "GoBack";
    }

    OK. A couple days later and I am able to answer my
    own question. Anyway, I will lay it out there for
    anyone interested. This worked for me...
    public class Page1 extends AbstractPageBean {
    private HtmlPanelGroup panel = new HtmlPanelGroup();
    public HtmlPanelGroup getPanel() {
    return panel;
    public void setPanel(HtmlPanelGroup panel) {
    this.panel = panel;
    public Page1() {
    HtmlCommandLink link = new HtmlCommandLink();
    link.setAction(
    FacesContext.getCurrentInstance()
    .getApplication()
    .createMethodBinding("#{Page1.linkAction1_action}",
    new Class[0]));
    this.panel.getChildren().add(link);
    public String linkAction1_action() {
    return "GoBack";
    Since you're setting the action from within the Page1 object, why don't you create a method binding manually? This will be much more performant that using the application to create and EL-based binding.
    Try:
    link.setAction(new MethodBinding()
          public Object invoke(FacesContext facesContext, Object[] objects) throws EvaluationException, MethodNotFoundException
            return linkAction1_action();
          public Class getType(FacesContext facesContext) throws MethodNotFoundException
            return String.class;
    });Note that you also avoid any naming convention - you do not require your Page1 object to be configured as a managed bean "Page1".

  • Generic approach to call a method for any business object

    My requirement is to call the DISPLAY method of a business object when I have the objectType and objectId.
    Say I have BUS2012 and Id 4500001111, now I want to call a method which invoke the DISPLAY method for this object with objectId (say ME_DISPLAY_PURCHASE_DOCUMENT for purchase order). I even have the key fields for the business object.
    Is it possible ?
    Thanks in advance !
    Ruhi Hira

    Hi Ruhi,
               Yes you can call the method for display.Before we can do that we need to fix the procedure for the calling of the method.If you want to call it programitically or you want to call it in task builder or you want to use it as a activity in the work item.we can check for the BUSXXXXXX what ever number is there and we can also check for the activity type pre defined by SAP for it.If suppose you dont have the activity we can create the method for the BOR object type using SWO1.May be it helps your query.
    Have a best day ahead.

  • How does the remote object connect to the correct host

    i have had a small doubt on how the remote reference manages to find the correct host to call the subsequent methods after a sucessful lookup.
    given a rebind or bind to the registry, the registry only stores the alias and the remote reference, now imagine a client calling a lookup on the registry would only get the remote reference, and not in which machine the remote object is found.
    what i wanted to know is how does the client or atleast the remote reference returned by the registry correctly connects to the machine where the remote object is located. i dont think its stored in the stub bcos the stub is a complie time stuff.
    i would be pleased to have a comprehensive answer for this.

    The membership in the group communication framework is always accurate and upto date.Up to date to the moment when you check. Not up to date to the moment when you make the RMI call.
    i could basically chk if this ip is available in the membership list.Complete waste of time. It doesn't matter what you check ahead of time, you are still trying to predict the future.
    And you still have to deal with ConnectException etc from the actual remote method call. And the way you will deal with that in your situation is exactly the same as what you were going to do if your ahead-of-time check failed.
    So just catch the exception(s) and deal with the problem there.

  • Calling a method of one class from another withing the same package

    hi,
    i've some problem in calling a method of one class from another class within the same package.
    for eg. if in Package mypack. i'm having 2 files, f1 and f2. i would like to call a method of f2 from f1(f1 is a servlet) . i donno exactly how to instantiate the object for f2. can anybody please help me in this regard.
    Thank u in advance.
    Regards,
    Fazli

    This is what my exact problem.
    i've created a bean (DataBean) to access the database. i'm having a servlet program (ShopBook). now to check some details over there in the database from the servlet i'm in need to use a method in the DataBean.
    both ShopBook.java and DataBean.java lies in the package shoppack.
    in ShopBook i tried to instantiate the object to DataBean as
    DataBean db = new DataBean();
    it shows the compiler error, unable to resolve symbol DataBean.
    note:
    first i compiled DataBean.java, it got compiled perfectly and the class file resides inside the shoppack.
    when i'm trying to compile the ShopBook its telling this error.
    hope i'm clear in explaining my problem. can u please help me?
    thank u in advance.
    regards,
    Fazli

  • Call C# method from javascript in WebView and retrieve the return value

    The issue I am facing is the following :
    I want to call a C# method from the javascript in my WebView and get the result of this call in my javascript.
    In an WPF Desktop application, it would not be an issue because a WebBrowser
    (the equivalent of a webView) has a property ObjectForScripting to which we can assign a C# object containg the methods we want to call from the javascript.
    In an Windows Store Application, it is slightly different because the WebView
    only contains an event ScriptNotify to which we can subscribe like in the example below :
    void MainPage_Loaded(object sender, RoutedEventArgs e)
    this.webView.ScriptNotify += webView_ScriptNotify;
    When the event ScriptNotify is raised by calling window.external.notify(parameter), the method webView_ScriptNotify is called with the parameter sent by the javascript :
    function CallCSharp() {
    var returnValue;
    window.external.notify(parameter);
    return returnValue;
    private async void webView_ScriptNotify(object sender, NotifyEventArgs e)
    var parameter = e.Value;
    var result = DoSomerthing(parameter);
    The issue is that the javascript only raise the event and doesn't wait for a return value or even for the end of the execution of webView_ScriptNotify().
    A solution to this issue would be call a javascript function from the webView_ScriptNotify() to store the return value in a variable in the javascript and retrieve it after.
    private async void webView_ScriptNotify(object sender, NotifyEventArgs e)
    var parameter = e.Value;
    var result = ReturnResult();
    await this.webView.InvokeScriptAsync("CSharpCallResult", new string[] { result });
    var result;
    function CallCSharp() {
    window.external.notify(parameter);
    return result;
    function CSharpCallResult(parameter){
    result = parameter;
    However this does not work correctly because the call to the CSharpResult function from the C# happens after the javascript has finished to execute the CallCSharp function. Indeed the
    window.external.notify does not wait for the C# to finish to execute.
    Do you have any solution to solve this issue ? It is quite strange that in a Window Store App it is not possible to get the return value of a call to a C# method from the javascript whereas it is not an issue in a WPF application.

    I am not very familiar with the completion pattern and I could not find many things about it on Google, what is the principle? Unfortunately your solution of splitting my JS function does not work in my case. In my example my  CallCSharp
    function is called by another function which provides the parameter and needs the return value to directly use it. This function which called
    CallCSharp will always execute before an InvokeScriptAsync call a second function. Furthermore, the content of my WebView is used in a cross platforms context so actually my
    CallCSharp function more look like the code below.
    function CallCSharp() {
    if (isAndroid()) {
    //mechanism to call C# method from js in Android
    //return the result of call to C# method
    } else if (isWindowsStoreApp()) {
    window.external.notify(parameter);
    // should return the result of call to C# method
    } else {
    In android, the mechanism in the webView allows to return the value of the call to a C# method, in a WPF application also. But I can't figure why for a Windows Store App we don't have this possibility.

  • Urgent: Failed to get the object returned from the server

    Hi there,
    I'm debugging someone's code which make use of RMI to implement the client/server.
    I found that when the client request the object from the server, the server return the object properly. But on the client side, it returned "java.io.EOFException". Don't know how to resolve it. Pls HELP !!
    Thanks.
    -Maggie
    ==============
    Here is the output:-
    java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
         java.io.EOFException
    java.io.EOFException
         at java.io.DataInputStream.readInt(DataInputStream.java:343)
         at java.io.ObjectInputStream.readInt(ObjectInputStream.java:1980)
         at javax.swing.ImageIcon.readObject(ImageIcon.java:371)
         at java.lang.reflect.Method.invoke(Native Method)
         at java.io.ObjectInputStream.invokeObjectReader(ObjectInputStream.java:2214)
         at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1411)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
         at java.util.Hashtable.readObject(Hashtable.java:792)
         at java.lang.reflect.Method.invoke(Native Method)
         at java.io.ObjectInputStream.invokeObjectReader(ObjectInputStream.java:2214)
         at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1411)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
         at java.io.ObjectInputStream.inputClassFields(ObjectInputStream.java:2263)
         at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:519)
         at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1412)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
         at java.io.ObjectInputStream.inputClassFields(ObjectInputStream.java:2263)
         at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:519)
         at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1412)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
         at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:300)
         at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:134)
         at com.ptec.rms.app.olap.modelbuilder.OlapMBServiceImpl_Stub.getPanel(Unknown Source)
         at com.ptec.rms.app.sc.SystemConsoleDesktop.changeService(SystemConsoleDesktop.java:141)

    at least you have the benefit of the code to work with! :)

  • Invoke EJB methods from RMI client -- OutOfMemory error on the server

    Each time I tried to invoke a method of my session bean, on the server I have an
    error : java.lang.OutOfMemoryError
    And the client doesn't receive any answer !
    Do you have an idea ?
    (everything before seems OK - context, narrow, home.create() ...)
    Config : WL6.1 SP1 on Solaris 2.8 / client Win2000 jdk 1.3.1

    "Sabine" <[email protected]> writes:
    Each time I tried to invoke a method of my session bean, on the server I have an
    error : java.lang.OutOfMemoryError
    And the client doesn't receive any answer !
    Do you have an idea ?
    (everything before seems OK - context, narrow, home.create() ...)
    Config : WL6.1 SP1 on Solaris 2.8 / client Win2000 jdk 1.3.1Are you using RMI-IIOP? If so I suggest you try SP3.
    andy

  • Calling a method in an owning object

    I have an application that involves an object (B) that is a member (not a sub-class) of another object (A). Within the owned object (B) I want to call up a method from the owning object A. E.g I would like to do something like this:
    class A
    object B; // B is a member of A
    methodX( )
    class B
    owner.methodX( ); // invoke the methodX that is a member of object A.
    Is this possible and how can i do it?

    No, there is no implicit reference to an "owning" object. Think about the following code:
    class Parent {
      Child child
      Parent(Child child) { this.child = child; }
      void doSomething() {}
    class Child {
    class Test {
    public static void main(String[] args) {
       Child child = new Child();
       Parent p1 = new Parent(child);
       Parent p2 = new Parent(child);
    }So the two instances of Parent both have a reference to the same instance of Child. Which one is the "owner"?
    You'll have to explicitly give your "child" object a reference to the "owner" object in order to call methods on it

Maybe you are looking for

  • How to process a Blanket Purchase order?

    Hi, Can you please let me know how to process a blanket purchase order received from a customer? Can we create a sales order based on the customer's blanket purchase order? Please help me out with this issue. Sincerely, Puja

  • Shared photo-stream, makes long file names with 42 random characters

    Windows icloud 3.1, in a shared photo-stream, makes file names with 42  random characters long. It didn't do this in iCloud  2. I have installed  iCloud 3.1 on a windows 8.0 and 8.1 machine and two Windows 7 machines.  They all do the same thing.  It

  • 3 incompatible headsets...any way around this?

    OK, this is probably a strange question... I have 3 phones with 3 incompatible headsets: iPhone (3.5mm I think), office phone (2.5mm I think) and SIP (skype, USB headset). So, depending on which phone I am using, I am constantly changing headsets. Is

  • Jump from (RRI) BEx query parsing infoobject without MD to source system

    Hi! I have a snag that I hope someone out there will be able to help me with. I have a query that cointains purchasing line items. I want to jump from a purchasing order number in the query to transaction me23n (display purchasing order) in the sourc

  • Changing the default password when configuring.

    Hi, can anyone tell me how to change the default password and username when you are first configuring your router?  You know when you go to http://192.168.1.1/? I know the default password is admin and there is no user name but I would like to change