Package java.rmi

Examples of java.rmi.Remote


   * @see #setCacheStub
   * @see java.rmi.Naming#lookup
   */
  protected Remote lookupStub() throws RemoteLookupFailureException {
    try {
      Remote stub = null;
      if (this.registryClientSocketFactory != null) {
        // RMIClientSocketFactory specified for registry access.
        // Unfortunately, due to RMI API limitations, this means
        // that we need to parse the RMI URL ourselves and perform
        // straight LocateRegistry.getRegistry/Registry.lookup calls.
View Full Code Here


   * @see java.rmi.ConnectException
   * @see java.rmi.ConnectIOException
   * @see java.rmi.NoSuchObjectException
   */
  public Object invoke(MethodInvocation invocation) throws Throwable {
    Remote stub = getStub();
    try {
      return doInvoke(invocation, stub);
    }
    catch (RemoteConnectFailureException ex) {
      return handleRemoteConnectFailure(invocation, ex);
View Full Code Here

   * @return the invocation result, if any
   * @throws Throwable in case of invocation failure
   * @see #invoke
   */
  protected Object refreshAndRetry(MethodInvocation invocation) throws Throwable {
    Remote freshStub = null;
    synchronized (this.stubMonitor) {
      this.cachedStub = null;
      freshStub = lookupStub();
      if (this.cacheStub) {
        this.cachedStub = freshStub;
View Full Code Here

        return msg;
    }

    public Object invokeTarget(final Object payload) throws InvocationTargetException, SecurityException,
        NoSuchMethodException, IllegalArgumentException, IllegalAccessException {
        Remote proxy = null;
        final Class<?> remote = remoteMethod.getDeclaringClass();
        final ClassLoader stubClassLoader = remote.getClassLoader();
        // The generated remote interface is not available for the service lookup
        final ClassLoader tccl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
            public ClassLoader run() {
                ClassLoader tccl = Thread.currentThread().getContextClassLoader();
                Thread.currentThread().setContextClassLoader(stubClassLoader);
                return tccl;
            }
        });
        try {
            // The proxy cannot be cached as the remote services can be rebound
            proxy = rmiHost.findService(uri);
        } finally {
            AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
                public ClassLoader run() {
                    ClassLoader current = Thread.currentThread().getContextClassLoader();
                    Thread.currentThread().setContextClassLoader(tccl);
                    return current;
                }
            });
        }

        remoteMethod = proxy.getClass().getMethod(remoteMethod.getName(), remoteMethod.getParameterTypes());

        if (payload != null && !payload.getClass().isArray()) {
            return remoteMethod.invoke(proxy, payload);
        } else {
            return remoteMethod.invoke(proxy, (Object[])payload);
View Full Code Here

      {
         storeLocalConfig(configuration);
         String host = locator.getHost();
         int port = getRegistryPort(locator);
         Registry regsitry = LocateRegistry.getRegistry(host, port);
         Remote remoteObj = regsitry.lookup("remoting/RMIServerInvoker/" + locator.getPort());
         log.debug("Remote RMI Stub: " + remoteObj);
         setServerStub((RMIServerInvokerInf) remoteObj);
         connected = true;
      }
      catch(Exception e)
View Full Code Here

     * @exception NoSuchObjectException if a stub cannot be located for the given server object.
     */
    public Remote toStub (Remote obj)
        throws NoSuchObjectException
    {
        Remote result = null;
        if (obj == null) {
            throw new NullPointerException("invalid argument");
        }

        // If the class is already an IIOP stub then return it.
View Full Code Here

    public void unregisterTargetsForORB(org.omg.CORBA.ORB orb)
    {
        for (Enumeration e = exportedServants.keys(); e.hasMoreElements(); )
        {
            java.lang.Object key = e.nextElement();
            Remote target = (Remote)(key instanceof Tie ? ((Tie)key).getTarget() : key);

            // Bug 4476347: BAD_OPERATION is thrown if the ties delegate isn't set.
            // We can ignore this because it means the tie is not connected to an ORB.
            try {
                if (orb == getTie(target).orb()) {
View Full Code Here

     *            RMIIIOPServerImpl has not been exported yet.
     **/
    public Remote toStub() throws IOException {
        // javax.rmi.CORBA.Stub stub =
        //    (javax.rmi.CORBA.Stub) PortableRemoteObject.toStub(this);
        final Remote stub = IIOPHelper.toStub(this);
        // java.lang.System.out.println("NON CONNECTED STUB " + stub);
        // org.omg.CORBA.ORB orb =
        //    org.omg.CORBA.ORB.init((String[])null, (Properties)null);
        // stub.connect(orb);
        // java.lang.System.out.println("CONNECTED STUB " + stub);
View Full Code Here

        if (orb == null)
            // Wrong kind of context, so just give up and let another StateFactory
            // try to satisfy getStateToBind.
            return null ;

        Remote stub = null;

        try {
            stub = PortableRemoteObject.toStub( (Remote)orig ) ;
        } catch (Exception exc) {
            // XXX log at FINE level?
View Full Code Here

         (StatelessSessionHome)PortableRemoteObject.narrow(
                    getInitialContext().lookup(StatelessSessionHome.JNDI_NAME),
                    StatelessSessionHome.class);
      StatelessSession session = home.create();
      //----------------------------------------------------------------------
      Remote r = session.testRemote("jumps over the lazy dog", session);
      StatelessSession session2 =
         (StatelessSession)PortableRemoteObject.narrow(r,
                                                       StatelessSession.class);
      String s = session2.getString();
      assertEquals(Util.STRING, s);
View Full Code Here

TOP

Related Classes of java.rmi.Remote

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.