Package net.sf.lipermi.call

Examples of net.sf.lipermi.call.RemoteInstance


      if ((remoteInstance.getInstanceId() == instanceId || (remoteInstance.getInstanceId() != null && remoteInstance.getInstanceId().equals(instanceId))) && remoteInstance.getClassName().equals(cInterface.getName())) {
        throw new LipeRMIException(String.format("Class %s already has a implementation class", cInterface.getName()));         //$NON-NLS-1$
      }
    }
   
    RemoteInstance remoteInstance = new RemoteInstance(instanceId, cInterface.getName());
    exportedObjects.put(remoteInstance, objImplementation);
 
View Full Code Here


          final RemoteCall remoteCall = (RemoteCall) remoteMessage;
          if (remoteCall.getArgs() != null) {
            for (int n = 0; n < remoteCall.getArgs().length; n++) {
              Object arg = remoteCall.getArgs()[n];
              if (arg instanceof RemoteInstance) {
                RemoteInstance remoteInstance = (RemoteInstance) arg;
                remoteCall.getArgs()[n] = getProxyFromRemoteInstance(remoteInstance);
              }
            }
          }
         
View Full Code Here


  final synchronized Object remoteInvocation(final Object proxy, final Method method, final Object[] args) throws Throwable {
    final Long id = callId.getAndIncrement();
    
    RemoteInstance remoteInstance;
    remoteInstance = getRemoteInstanceFromProxy(proxy);
    if (remoteInstance == null)
      remoteInstance = new RemoteInstance(null, proxy.getClass().getInterfaces()[0].getName());

    if (args != null) {
      for (int n = 0; n < args.length; n++) {
        RemoteInstance remoteRef = callHandler.getRemoteReference(args[n]);
        if (remoteRef != null)
          args[n] = remoteRef;
      }
    }

    String methodId = method.toString().substring(15);
   
    IRemoteMessage remoteCall = new RemoteCall(remoteInstance, methodId, args, id);
    sendMessage(remoteCall);
   
    RemoteReturn remoteReturn = null;
   
    boolean bReturned = false;
    do {
      synchronized (remoteReturns) {
        for (RemoteReturn ret : remoteReturns) {
          if (ret.getCallId().equals(id)) {
            bReturned = true;
            remoteReturn = ret;
            break;
          }
        }
        if (bReturned)
          remoteReturns.remove(remoteReturn);
        else {
          try {
            remoteReturns.wait();
          }
          catch (InterruptedException ie) {}
        }
      }
    }
    while (socket.isConnected() && !bReturned);
   
    if (!socket.isConnected() && !bReturned)
      throw new LipeRMIException("Connection aborted"); //$NON-NLS-1$
   
    if (remoteReturn.isThrowing() && remoteReturn.getRet() instanceof Throwable)
      throw ((Throwable) remoteReturn.getRet()).getCause();
   
    if (remoteReturn.getRet() instanceof RemoteInstance) {
      RemoteInstance remoteInstanceReturn = (RemoteInstance) remoteReturn.getRet();
      Object proxyReturn = remoteInstanceProxys.get(remoteInstanceReturn);
      if (proxyReturn == null) {
        proxyReturn = CallProxy.buildProxy(remoteInstanceReturn, this);
        remoteInstanceProxys.put(remoteInstanceReturn, proxyReturn);
      }
View Full Code Here

TOP

Related Classes of net.sf.lipermi.call.RemoteInstance

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.