Example #1
0
  public static LiveRef read(ObjectInput in, boolean useNewFormat)
      throws IOException, ClassNotFoundException {
    Endpoint ep;
    ObjID id;

    // Now read in the endpoint, id, and result flag
    // (need to choose whether or not to read old JDK1.1 endpoint format)
    if (useNewFormat) {
      ep = TCPEndpoint.read(in);
    } else {
      ep = TCPEndpoint.readHostPortFormat(in);
    }
    id = ObjID.read(in);
    boolean isResultStream = in.readBoolean();

    LiveRef ref = new LiveRef(id, ep, false);

    if (in instanceof ConnectionInputStream) {
      ConnectionInputStream stream = (ConnectionInputStream) in;
      // save ref to send "dirty" call after all args/returns
      // have been unmarshaled.
      stream.saveRef(ref);
      if (isResultStream) {
        // set flag in stream indicating that remote objects were
        // unmarshaled.  A DGC ack should be sent by the transport.
        stream.setAckNeeded();
      }
    } else {
      DGCClient.registerRefs(ep, Arrays.asList(new LiveRef[] {ref}));
    }

    return ref;
  }
Example #2
0
 private AttributeList getAttributes(ObjectName objName, String[] attrNames)
     throws InstanceNotFoundException, ReflectionException, IOException {
   final NameValueMap values =
       getCachedAttributes(objName, new TreeSet<String>(Arrays.asList(attrNames)));
   final AttributeList list = new AttributeList();
   for (String attrName : attrNames) {
     final Object value = values.get(attrName);
     if (value != null || values.containsKey(attrName)) {
       list.add(new Attribute(attrName, value));
     }
   }
   return list;
 }