@SuppressWarnings("unchecked") private Object readResolve() throws ObjectStreamException { CMIReference ref = getReference(); if(ref.getServerRef().getProtocol().equals("iiop")) { T remote; try { remote = (T) Utility.string_to_remote(ior); } catch (NamingException e) { throw new InvalidObjectException("Cannot get the stub from the ior " + ior); } return new RemoteCMIReferenceableWrapper<T>(ref, remote); } else { return this; } }
private Object writeReplace() throws ObjectStreamException { CMIReference ref = getReference(); if(ref.getServerRef().getProtocol().equals("iiop")) { String ior; try { ior = Utility.remote_to_string(getReferencedObject()); } catch (NamingException e) { throw new InvalidObjectException("Cannot get the ior from the stub " + getReferencedObject()); } return new RemoteCMIReferenceableWrapper<T>(ref, ior); } else { return this; } }
/** * Returns the list of Provider URL. * @param protocolName a name of protocol * @return providers of the cluster view for the protocol with the given name * @throws ServerClusterViewManagerException if none provider exists for the protocol with the given name */ public final List<String> getProviderURLs(final String protocolName) throws ServerClusterViewManagerException { String providerName = CMIConfig.getBindNameForProvider(); ArrayList<String> providerURLs = new ArrayList<String>(); try { for(CMIReference cmiReference : getCMIReferences(providerName, protocolName)) { providerURLs.add(cmiReference.getServerRef().getProviderURL()); } } catch (ObjectNotFoundException e) { LOGGER.error("Cannot get CMIReferences for the provider whith name {0}", providerName, e); throw new ServerClusterViewManagerException( "Cannot get CMIReferences for the provider whith name " + providerName, e); } return providerURLs; }
ServerRef serverRef = cmiReference.getServerRef(); String protocol = serverRef.getProtocol();