Marshals the instance using Protobuf.

@param instance never null
@return the converted/decorated instance
962561
@Override
   protected Object convert(Object instance) {
      try {
         return ProtobufUtil.toWrappedByteArray(serializationContext, instance);
      } catch (IOException e) {
         throw new CacheException(e);
      }
   }
213942
public static Class<?> getInstanceClass(Object instance) {
        Class<?> clazz = instance.getClass();      
        return (instance instanceof Hooked) ? clazz.getSuperclass() : clazz;
    }
97780
public static Matching getInstance() throws Exception
  {
    if (tc.isEntryEnabled())
      tc.entry(cclass, "getInstance");

    if (instance == null)
      throw createException;

    if (tc.isEntryEnabled())
      tc.exit(cclass, "getInstance", "instance=" + instance);
      
    return instance;
  }
828458
private static DataNode marshalObject(Map<String, AbstractDataMarshaller<?>> marshallerMap, Object object) {
        //can't be null here because it is not resolved: meaning, it is an instance of an unknown class
        final Class<?> clazz = object.getClass();

        final AbstractDataMarshaller<Object> serializer = (AbstractDataMarshaller<Object>) marshallerMap.get(clazz.getCanonicalName());
        if (serializer != null) {
            final DataNode node = serializer.marshal(object);
            node.setObject(META_CLASS_NAME, serializer.getDataClassName());
            return node;
        }
        return null; //no marshaller - let others decide what to do with that info
    }
750290
public static JavaCompiler instance(Context context) {
        JavaCompiler instance = context.get(compilerKey);
        if (instance == null)
            instance = new JavaCompiler(context);
        return instance;
    }
1077402
public static Image getInstance(Image image) {
		if (image == null)
			return null;
		try {
			Class cs = image.getClass();
			Constructor constructor = cs
					.getDeclaredConstructor(new Class[] { Image.class });
			return (Image) constructor.newInstance(new Object[] { image });
		} catch (Exception e) {
			throw new ExceptionConverter(e);
		}
	}
1309880
public static PojoDescriptorBuilderFactory getInstance() {

    PojoDescriptorBuilderFactory instance = AbstractPojoDescriptorBuilderFactory.getInstance();
    if (instance == null) {
      synchronized (PojoDescriptorBuilderFactoryImpl.class) {
        if (instance == null) {
          PojoDescriptorBuilderFactoryImpl impl = new PojoDescriptorBuilderFactoryImpl();
          instance = impl;
          setInstance(impl);
          impl.initialize();
        }
      }
    }
    return instance;
  }
1227469
private static Collection<InstanceContextBean> descendantInstances( final InstanceContextBean instance ) {

		final Collection<InstanceContextBean> result = new ArrayList<InstanceContextBean>();
		for (final InstanceContextBean child : instance.getChildren()) {
			result.add( child );
			result.addAll( descendantInstances( child ) );
		}

		return result;
	}
274529
public static InstanceFields declaredFieldsOf(Object instance) {
        List<InstanceField> instanceFields = new ArrayList<InstanceField>();
        instanceFields.addAll(instanceFieldsIn(instance, instance.getClass().getDeclaredFields()));
        return new InstanceFields(instance, instanceFields);
    }
701281
public EntityInstanceWrapper buildInstanceWrapper(final Object instance) throws PMException {
        final EntityInstanceWrapper wrapper = new EntityInstanceWrapper(instance);
        if (hasEntity() && !getEntityContainer().isSelectedNew()) {
            wrapper.setInstanceId(getDataAccess().getInstanceId(this, wrapper));
        }
        return wrapper;
    }
482785
protected static Object newInstance(String className) {
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        log.debug("Conversion utils classloader: {}", cl);
        Object instance = null;
        try {
            Class<?> clazz = cl.loadClass(className);
            instance = clazz.newInstance();
        } catch (Exception ex) {
            log.error("Error loading class: {}", className, ex);
        }
        return instance;
    }
597943
public static Instance findRootInstance( Instance instance ) {

		Instance rootInstance = instance;
		while( rootInstance.getParent() != null )
			rootInstance = rootInstance.getParent();

		return rootInstance;
	}
475085
@Override
    public Object getObjectInstance(Object obj, Name name, Context context, @Sensitive Hashtable<?, ?> environment) throws Exception {

        if (!(obj instanceof Reference)) {
            return null;
        }

        Reference ref = (Reference) obj;

        if (!ServiceRefObjectFactory.class.getName().equals(ref.getFactoryClassName())) {
            return null;
        }

        // Retrieve our service-ref metadata from the Reference object.
        WebServiceRefInfo wsrInfo = null;
        WebServiceRefInfoRefAddr wsrInfoRefAddr = (WebServiceRefInfoRefAddr) ref.get(WebServiceRefInfoRefAddr.ADDR_KEY);
        if (wsrInfoRefAddr != null) {
            wsrInfo = (WebServiceRefInfo) wsrInfoRefAddr.getContent();
        }

        // Make sure we found the WebServiceRefInfo object that contains the service-ref metadata.
        if (wsrInfo == null) {
            throw new Exception("Internal Error: Can not found the WebServiceRefInfo.");
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Service Ref JNDI name: " + wsrInfo.getJndiName());
        }

        // Get the client metadata
        JaxWsClientMetaData declaredClientMetaData = wsrInfo.getClientMetaData();
        //146981
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(tc, "declaredClientMetaData: " + declaredClientMetaData);
        JaxWsClientMetaData currentClientMetaData = JaxWsMetaDataManager.getJaxWsClientMetaData();
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(tc, "currentClientMetaData: " + currentClientMetaData);
        if (declaredClientMetaData == null) {
            declaredClientMetaData = currentClientMetaData;
        }

        // If we didn't find the ClientMetaData, we have a problem.
        if (declaredClientMetaData == null) {
            throw new IllegalStateException("Internal Error: Can not found the JaxWsClientMetaData");
        }

        mergeWebServicesBndInfo(wsrInfo, declaredClientMetaData);

        //1. The Bus from client module which declares the serviceRef is used for locating WSDL or other usage.
        //2. The classLoader from current client module is used for loading service interface or other related stub classes.
        //The scenario is that, different modules could packge the same stub classes in their own classpaths.
        Bus originalThreadBus = BusFactory.getThreadDefaultBus(false);
        try {
            BusFactory.setThreadDefaultBus(declaredClientMetaData.getClientBus());
            // Collect all of our module-specific service-ref metadata.            
            TransientWebServiceRefInfo tInfo = new TransientWebServiceRefInfo(declaredClientMetaData, wsrInfo, declaredClientMetaData.getModuleMetaData().getAppContextClassLoader());
            Object instance = getInstance(tInfo, wsrInfo);
            return instance;
        } finally {
            BusFactory.setThreadDefaultBus(originalThreadBus);
        }
    }
594364
public static <T> String marshal(T obj) throws JAXBException {
    StringWriter sw = new StringWriter();
    marshal(obj, sw);
    return sw.toString();
  }
829133
Instance marshall(ServiceInstance serviceInstance) {
		String hostname = serviceInstance.getHost();
		String managementPort = serviceInstance.getMetadata().get("management.port");
		String port = managementPort == null ? String.valueOf(serviceInstance.getPort())
				: managementPort;
		String cluster = getClusterName(serviceInstance);
		Boolean status = Boolean.TRUE; // TODO: where to get?
		if (hostname != null && cluster != null && status != null) {
			Instance instance = getInstance(hostname, port, cluster, status);

			Map<String, String> metadata = serviceInstance.getMetadata();
			boolean securePortEnabled = serviceInstance.isSecure();

			addMetadata(instance, hostname, port, securePortEnabled, port, metadata);

			return instance;
		}
		else {
			return null;
		}
	}
508006
public T requestInstance() {
		T a;
		if( unused.size() > 0 ) {
			a = unused.pop();
		} else {
			a = createInstance();
		}
		return a;
	}
452037
public static NoProxyPortSelector getInstance()
    {
        if( _instance == null )
        {
            synchronized( NoProxyPortSelector.class )
            {
                if( _instance == null )
                {
                    _instance = new NoProxyPortSelector();
                }
            }
        }

        return _instance;
    }