Пример #1
0
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
      final boolean logDebug = LOG.isDebugEnabled();
      long startTime = 0;
      if (logDebug) {
        startTime = System.currentTimeMillis();
      }

      ObjectWritable value = null;
      try {
        value =
            (ObjectWritable)
                client.call(
                    new Invocation(method, args), getAddress(), protocol, ticket, rpcTimeout);
      } catch (RemoteException re) {
        throw re;
      } catch (ConnectException ce) {
        needCheckDnsUpdate = true;
        throw ce;
      } catch (NoRouteToHostException nrhe) {
        needCheckDnsUpdate = true;
        throw nrhe;
      } catch (PortUnreachableException pue) {
        needCheckDnsUpdate = true;
        throw pue;
      } catch (UnknownHostException uhe) {
        needCheckDnsUpdate = true;
        throw uhe;
      }
      if (logDebug) {
        long callTime = System.currentTimeMillis() - startTime;
        LOG.debug("Call: " + method.getName() + " " + callTime);
      }
      return value.get();
    }
Пример #2
0
 public void write(DataOutput out) throws IOException {
   ObjectWritable.writeStringCached(out, methodName);
   out.writeInt(parameterClasses.length);
   for (int i = 0; i < parameterClasses.length; i++) {
     ObjectWritable.writeObject(out, parameters[i], parameterClasses[i], conf);
   }
 }
Пример #3
0
 public void readFields(DataInput in) throws IOException {
   methodName = UTF8.readString(in);
   parameters = new Object[in.readInt()];
   parameterClasses = new Class[parameters.length];
   ObjectWritable objectWritable = new ObjectWritable();
   for (int i = 0; i < parameters.length; i++) {
     parameters[i] = ObjectWritable.readObject(in, objectWritable, this.conf);
     parameterClasses[i] = objectWritable.getDeclaredClass();
   }
 }
Пример #4
0
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
      long startTime = 0;
      if (LOG.isDebugEnabled()) {
        startTime = Time.now();
      }

      ObjectWritable value =
          (ObjectWritable)
              client.call(RPC.RpcKind.RPC_WRITABLE, new Invocation(method, args), remoteId);
      if (LOG.isDebugEnabled()) {
        long callTime = Time.now() - startTime;
        LOG.debug("Call: " + method.getName() + " " + callTime);
      }
      return value.get();
    }
Пример #5
0
 @SuppressWarnings("deprecation")
 public void readFields(DataInput in) throws IOException {
   rpcVersion = in.readLong();
   declaringClassProtocolName = UTF8.readString(in);
   methodName = UTF8.readString(in);
   clientVersion = in.readLong();
   clientMethodsHash = in.readInt();
   parameters = new Object[in.readInt()];
   parameterClasses = new Class[parameters.length];
   ObjectWritable objectWritable = new ObjectWritable();
   for (int i = 0; i < parameters.length; i++) {
     parameters[i] = ObjectWritable.readObject(in, objectWritable, this.conf);
     parameterClasses[i] = objectWritable.getDeclaredClass();
   }
 }
Пример #6
0
 @SuppressWarnings("deprecation")
 public void write(DataOutput out) throws IOException {
   out.writeLong(rpcVersion);
   UTF8.writeString(out, declaringClassProtocolName);
   UTF8.writeString(out, methodName);
   out.writeLong(clientVersion);
   out.writeInt(clientMethodsHash);
   out.writeInt(parameterClasses.length);
   for (int i = 0; i < parameterClasses.length; i++) {
     ObjectWritable.writeObject(out, parameters[i], parameterClasses[i], conf, true);
   }
 }