Is the Remote Object always a singleton?

Hi,
Using .Net Remoting we can export a Remote Objects in three different ways:
1. Singleton: Same instance of a Server-side object is used by all the clients for all the requests.
2. SingleCall: Whenever a new call is received, a new instance of the Server-side object is created and reference is passed to the client. Therefore, for each call to the server, the client gets a new instance of the object.
3. Client Activation: In this, the Client requests to the server for creating a new instance which can be used for multiple calls. The instance activated by a client is not used by other clients. Client-Activated objects can store state information between method calls for its specific client.
Do we have this options in RMI or the Remote Object must always be a Singleton?
What I'm looking for is a way to create one instance of the Remote Object (in the server side) to each client that connects to a server.
thx

Do we have this options in RMI1 and 3 are available. 2 is not.
or the Remote Object must always be a Singleton?No.
What I'm looking for is a way to create one instance of the Remote Object (in the server side) to each client that connects to a server.It's as simple as 'return new MyRemoteObject(...);'.
For example:
public interface Login extends Remote
  public Session login(String username, ...) throws RemoteException;
public interface Session extends Remote
  // your client API here
public class LoginImpl extends UnicastRemoteObject implements Login
  public Session login(String username, ...) throws RemoteException
    // validate username etc. If OK return a session.
    return new SessionImpl();
public class SessionImpl extends UnicastRemoteObject implements Session
  // your client API implementation here, also all the server-side state belonging to that client session
}Note that this is as secure as the login() method. By type safety, nobody can execute Session methods until they have logged in.
I'm deleting your two other threads.

Similar Messages

  • 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.

  • Can we cache the remote object?

    hi,
    can we cache the remote object?
    is this right way of doing?
    please suggest me
    regards
    crr

    Yes, caching EJBHome, EJBObject, and Remote business references is fine. They can also
    be portably stored in an HttpSession. However, when caching in the web tier you must still
    be careful to prevent concurrent access to the same stateful session bean. The fact that
    remote references to stateful session beans can be cached does not guarantee they can
    be accessed by more than one client at a time.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • 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?

  • How to access the remote Objects Without Db_links?

    Hi ,
    I want to know how to access the remote objects without db_link.That is i want to access a object in some other server which has different database.

    SanjayBala, just so you know that it is possible to create a database link in Oracle to non-Oracle databases in some circumstances. Look up Generic Connectivity aslo know as Heterogenous Services. With 11g Oracle has basically renamed the feature and replaced it with somethinkg named ike DG4ODBC.
    I have not spent time studying the details for DB4ODBC but with HS Oracle provided the interface and you had to obtain the necessary ODBC driver on your own. I had Oracle on AIX reading and writing to SQL Server on Windows but the developers chose to write a java program and connect to both via it. On Windows and Linux platforms the necessary ODBC drivers might be available without the requirement to go out and purchase one.
    The Oracle Open Gateway product is an advanced version of the above features with drivers for specific non-Oracle databases included like DB2 or Informix.
    HTH -- Mark D Powell --

  • Can I cache the Remote object

    I am using Stateless session bean. Can I cache the reference of the remote objects to this bean ?
    I read that some containers support the fearture of pre creating the EJB objects in the pool , during startup
    using some custom configuration ( like connection pool ). How is this performed ?`

    I am using Stateless session bean. Can I cache the
    reference of the remote objects to this bean ?No, but you can cache the HomeHandle of the Home interface references - that saves you the overhead of JNDI lookups, which are far more "expensive" time-wise than calling the create method to get the Remote implemenation.
    I read that some containers support the fearture of
    pre creating the EJB objects in the pool , during
    startup using some custom configuration ( like connection pool
    ). How is this performed ?Ask your vendor - it's vendor-specific.

  • Trying to create a local instance of the remote object

    Hi,
    I have a ClassA on which I need to be able to invoke RMI calls. Problem is the interface which ClassA implements does not throw exceptions. To get around this problem I have created a wrapper class ClassWrap which has a ClassA attribute and calls made to ClassWrap are directed to this ClassA object. A facade type design I think it's called.
    ClassWrap implements Remote so it can be used as a Remote object.
    When I create an instance of ClassWrap and deploy it on a server, my client has no problem communicating with the remote ClassWrap object via a remote stub ClassWrap_Stub.
    Problem is I also want my client to be able to use a local instance of ClassWrap. Whan I try to create an instance of ClassWrap in my client I get a remote Exception ... but !! when I have a ClassWrap_Stub object in my classpath then there is no problem creating a ClassWrap object.
    Any ideas why this happens?

    What you are trying to do should work just fine. Do you have the wrapper class file in your client jar?

  • Check on the Remote Object

    Hi All,
    We have a situation where we have multiple RMI Servers for a particular setup. To reduce the response time what we are doing is, everytime we look up for a server for first time we store the referece then onward any call to the same server will not be through look up but through this cached reference.
    The problem is if a referece is cached then if before the second call comes on the same server there is a possibility that the server might have been restarted. Now if i invoke a method on this cached ref then i will get exception. How can i handle this case ?. I want to check whether the reference is still valid, if yes, then invoke the method otherwise lookup and then invoke.
    Any idea ?
    Sachin

    i cann't even do that cause of following.
    <code>
    try
    LookupServer() // This will either look up or if exists in the cache return that otherwise lookup & return
    Remote call /// This could fail
    Extra logic
    catch(Exception e)
    Exception thrown
    go back and lookup and fire the method
    </code>
    or
    <code>
    try
    LookupServer() // This will either look up or if exists in the cache return that otherwise lookup & return
    Remote call /// This could fail
    catch(Exception e)
    Exception thrown
    go back and lookup and fire the method
    Extra logic
    </code>
    Second option is preferable but the problem is that the same has to be repeated @ every method call. Rather i would like to have the logic in method LookupServer() only so it will be taken care once and for all methods.

  • Lookup the remote object in Java EE 5

    How the session bean is looked up In java EE 5. what i heard that no need to use explict JNDI loop up what we did for j2ee 1.4. Can you please tell me how this is happening in java EE 5.
    Thanks

    You may have better luck asking this question in the Enterprise JavaBeans forum:
    http://forum.java.sun.com/forum.jspa?forumID=13
    or the Java EE SDK forum:
    http://forum.java.sun.com/forum.jspa?forumID=136
    This forum is for general questions concerning Java Enterprise System
    (http://ww.sun.com/software/javaenterprisesystem)
    Joe

  • Remote Object - not able to get the returned value from java method

         Hi ,
    I am developing one sample flex aplication that connects to the java code and displays the returned value from the
    java method in flex client. Here I am able to invoke the java method but not able to collect the returned value.
    lastResult is giving null .  I am able to see the sysout messages in server console.
    I am using flex 3.2 and blazeds server  and java 1.5
    Here is the code what I have written.
    <?xml version="1.0" encoding="utf-8"?><mx:WindowedApplication  xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="#FFFFFF" initialize="initApp()">
     <mx:Script><![CDATA[
    import mx.controls.Alert; 
    import mx.binding.utils.ChangeWatcher; 
    import mx.rpc.events.ResultEvent; 
    import mx.messaging.*; 
    import mx.messaging.channels.* 
    public function initApp():void { 
         var cs:ChannelSet = new ChannelSet(); 
         var customChannel:Channel = new AMFChannel("my-amf", "http://localhost:8400/blazeds/messagebroker/amf");     cs.addChannel(customChannel);
         remoteObj.channelSet = cs;
    public function writeToConsole():void {      remoteObj.writeToConsole(
    "hello from Flash client");
          var returnedVal:String = remoteObj.setName().lastResult;     Alert.show(returnedVal);
    //[Bindable] 
    // private var returnedVal:String; 
    ]]>
    </mx:Script>
    <mx:RemoteObject id="remoteObj" destination="sro" /> 
    <mx:Form width="437" height="281">
     <mx:FormItem>  
    </mx:FormItem>  
    <mx:Button label="Write To Server Console" click="writeToConsole()"/>
     </mx:Form>
     </mx:WindowedApplication>
    Java code
    public  
         public SimpleRemoteObject(){  
              super();     }
      class SimpleRemoteObject { 
         public void writeToConsole(String msg) {          System.out.println("SimpleRemoteObject.write: " + msg);     }
         public String setName(){          System.
    out.println("Name changed in Java"); 
              return "Name changed in Java";
    And I have configured destination in  remote-config.xml
    <destination id="sro">
       <properties>    
        <source>SimpleRemoteObject</source>
        <scope>application</scope>
       </properties>
      </destination>
    Please help me .

    You are not able to get the returned value because if you see the Remote object help you will realise you have to use result="resultfn()" and fault = "faultfn()"
    In this you define what you wish to do.
    More importantly in the remote object you need to define which method you wish to call using the method class like this
    <mx:RemoteObject id="remoteObj" destination="sro" result="r1" fault="f1"  >
         <Method name="javaMethodName" result="r2" fault="f2"/>
    <mx:RemoteObject>
    r2 is the function where you get the result back from java and can use it to send the alert.

  • How to call a function/event after a Remote Object's data is loaded?

    I'm making a call to a remote object that is loading a good
    amount of data. I've set up a "please wait" label that is supposed
    to display while the data is being loaded and then clear the label
    when the data finishes loading.
    At the moment I've got it set up like so...
    label = 'Loading data, please wait..."
    remoteObj.read.send();
    label = ''
    The problem with this is that the 'please wait' label doesn't
    even display because the actual call to the remote object I'm
    making finishes so quickly even though the data load does not. So
    what I need is possibly an IF statement to check if the data has
    finished loading. If it hasn't finished loading, the label stays in
    the "please wait" status, or if the data does finish loading, then
    the label clears out.
    What would be ideal is...
    remoteObj.read.send(); // gets the data
    if(data is loaded){
    label = '';
    }else{
    label = 'Please wait'
    I just don't know how to form the statement for the data
    loading in the IF statement.

    You are seeing the difference between data loading and UI
    rendereing.
    Reasonable amounts of data load very fast, expecially with
    RemoteObject. Bur rendering the UI is almost always the bottleneck,
    event with AS3 FP8+, which is about 30 percent faster than AS2!
    I have not found a perfect solution for this myself, but i
    think you will want to look into the component data events, to find
    one that fires after the component is actually rendered.
    Tracy

  • DBMS_SQL.PARSE to access remote objects

    I am using following code in a procedure ...
    DBMS_SQL.PARSE (cur, vSQL, DBMS_SQL.NATIVE);
    where variable vSQL can contain a remote object.
    A DB link (with Fixed User option) exists to access that database.
    The DB link is working. The remote object is accessible outside this procedure.
    When this command is executed, I get ...
    ORA-24374: define not done before fetch or execute and fetch
    ... error.
    Can DBMS_SQL handle remote objects?
    Oracle version is 9.2.0.5.0
    Any help would be greatly appreciated.

    Here is the code I am running ...
    CREATE OR REPLACE PROCEDURE p_sql_valid_or_not_cnt
    (vSQL IN VARCHAR2, vValid OUT NUMBER, vMessage OUT VARCHAR2, vCount OUT NUMBER) IS
    -- Purpose: Returns 0 in vvalid if SQL is valid, else returns -1. Returns row count when SQL is valid.
    -- Parameters:
    -- IN : vSQL
    -- OUT : vValid
    -- OUT : vMessage
    -- OUT : vCount
    cur INTEGER := DBMS_SQL.OPEN_CURSOR;
    fdbk INTEGER;
    BEGIN
    DBMS_SQL.PARSE (cur, vSQL, DBMS_SQL.NATIVE);
    fdbk := DBMS_SQL.EXECUTE (cur);
    vCount := 0;
    LOOP /* Fetch next row. Exit when done. */
    EXIT WHEN DBMS_SQL.FETCH_ROWS (cur) = 0;
    vCount := vCount + 1;
    END LOOP;
    vValid := 0;
    vMessage := 'No errors';
    DBMS_SQL.CLOSE_CURSOR (cur);
    END p_sql_valid_or_not_cnt;
    To run ...
    set serveroutput on
    declare
    i number;
    m varchar2(500);
    c number;
    begin
    p_sql_valid_or_not_cnt('SELECT * FROM TAB where 1 <> 1',i,m,c);
    DBMS_OUTPUT.PUT_LINE(i);
    DBMS_OUTPUT.PUT_LINE(m);
    DBMS_OUTPUT.PUT_LINE(c);
    end;
    This runs fine.
    But when I try to access an object from a remote server using DB link. I get the error ...
    set serveroutput on
    declare
    i number;
    m varchar2(500);
    c number;
    begin
    p_sql_valid_or_not_cnt('SELECT * FROM REMOTE_SCHEMA.T_REMOTE@REMOTE_SERVER where 1 <> 1',i,m,c);
    DBMS_OUTPUT.PUT_LINE(i);
    DBMS_OUTPUT.PUT_LINE(m);
    DBMS_OUTPUT.PUT_LINE(c);
    end;
    declare
    ERROR at line 1:
    ORA-24374: define not done before fetch or execute and fetch
    ORA-06512: at "SYS.DBMS_SYS_SQL", line 1125
    ORA-06512: at "SYS.DBMS_SQL", line 328
    ORA-06512: at "IMEPAS.P_SQL_VALID_OR_NOT_CNT", line 16
    ORA-06512: at line 6
    I can run the SQL that I am passing as vSQL directly in SQLPLUS ...
    This code in itself works.
    SELECT * FROM
    REMOTE_SCHEMA.T_REMOTE@REMOTE_SERVER
    where 1 <> 1;
    The user I am using to logon to my server is also there on REMOTE_SERVER.
    The DB LINK is created by CONNECTED USER option. The user on REMOTE_SERVER has explict select access on the table (not via role) I am accessing.
    Any help would be much appreciated.

  • Mapping: ORA-04052 Remote Object not found

    Hi,
    I created a source module with a table reading from an external Oracle database. I can see data so the connection seems to work.
    In the target module a mapping trying to read from this table can´t be deployed with this errors message:
    - ora-06550: package body, line 0, column 0: ORA 04052: Error while trying to find the remote object: <name of the object> ....... ora-02019: connection description for remote-database not found.
    An equal internal mapping, not adressing an external database, works find.
    Any idea?
    Thanks so much.
    Georg

    oh, of course.
    I could not find dblink, saw some source information. What section/s is /are to be checked?
    I find code like
    SELECT
    /*+ NO_MERGE */
    /* OBJSTAMM.INOUTGRP1 */
    "OBJSTAMM"."OBJEKTNUMMER" "OBJEKTNUMMER"
    FROM
    "VMAN30M"."OBJSTAMM"@"PDORA06@QUELLE_VISMAN_LOCATION" "OBJSTAMM"
    Is there a way to find out the correct "from" path?
    Thanks Georg
    Edited by: georgo on 02.05.2011 16:34

  • 2 CF servers,but different remote object path for flash

    I have 2 CF servers,but different remote object path for flex in each server.
    Eg for one flex program in my dev server I define the remote object as follows
    <mx:RemoteObject id="myService" destination="ColdFusion" source="cfide.flex.path_to_file" showBusyCursor="true">
    But in my live sevrver I have to do this.
    <mx:RemoteObject id="myService" destination="ColdFusion" source="path_to_file" showBusyCursor="true">
    How can I make both the same?

    Thanks mate,
    I tried    <use-mappings>true</use-mappings> and restarted the server but its still not working
    I think this is the spoiler:
    ColdFusion mappings apply only to pages processed by the ColdFusion Server with the cfinclude and cfmodule tags. If you save CFML pages outside of the Web root (or whatever directory is mapped to "/"), you must add a mapping to the location of those files on your server.
    from
    http://www.adobe.com/livedocs/coldfusion/5.0/Installing_and_Configuring_ColdFusion_Server/ basiconfig9.htm
    so that ruins it for flex I guess?

  • Sdk 3b Remote Objects not working with java 1.6.29

    So I am not sure if this is java specific or if there is anything in Flex I can do.
    I am working on a project that communicates with the java back end via the AMF channels / Consumer objects and Remote Objects. Usking SDK 3b
    In Java 1.6.26 and java 1.7 it works fine.  However in java 1.6.29 The remote objects seem to not get called/communicated/execute on the java server side. 
    Interesting thing to note is that the consumer/AMF feeds are still able to function.
    Was there any change that Adobe has documented that may have caused this to happen when they changed the java version? or any solution around this as a requirement is to use 1.6.29?

    So it aprears that it works via MXML however when I try to define it in actionscript it recieves no events, messages, etc.  Looking at the serverside print statements it appears the call never goes through.

Maybe you are looking for

  • Using a ethernet external Maxtor Hard Drive (Network Attached Storage)

    Does anyone know if I can use a NAS (Network Attached Storage - in this case a 1 Tb Maxtor external drive with ethernet connection) and have my iMac G5 and Macbook backup to this drive on the same ethernet segment using Time Machine ? (both computers

  • Programmatically making the ADF page dirty

    In ADF page, I have a form to add one record. When I add one record, it adds record to temporary list to a bean which is in viewscope. The temporary records list will be displayed below the form as a table data. There is button for final commit once

  • Risk Violation at User level in SAP

    How can I do the  Risk Violoations for User in SAP (not in Virsa CC) Is there any Virsa Transaction for it? Please let me know. From PT.

  • RMAN "unrecoverable database"

    Hello, i am getting 2 entries with this check: RMAN> report unrecoverable database; Report of files that need backup due to unrecoverable operations File Type of Backup Required Name 166 full or incremental /u01/oradata/image/datafile34.dbf 167 full

  • Shared Member

    Hi people, I'd like to get some information about sharing members, for example, sharing a base- entity. When you define the properties of an entity, you define a parent too. So, my question is: can the shared member aggregate to both parents? Or it w