class DirectRegistry extends AbstractRegistry {

    private ConcurrentHashMap<URL, Object> subscribeUrls = new ConcurrentHashMap();
    private List<URL> directUrls = new ArrayList<URL>();

    public DirectRegistry(URL url) {
        super(url);
        String address = url.getParameter("address");
        if (address.contains(",")) {
            try {
                String[] directUrlArray = address.split(",");
                for (String directUrl : directUrlArray) {
                    parseDirectUrl(directUrl);
                }
            } catch (Exception e) {
                throw new MotanFrameworkException(
                        String.format("parse direct url error, invalid direct registry address %s, address should be ip1:port1,ip2:port2 ..."));
            }
        } else {
            registerDirectUrl(url.getHost(), url.getPort());
        }
    }

    private void parseDirectUrl(String directUrl) {<FILL_FUNCTION_BODY>}

    private void registerDirectUrl(String ip, Integer port) {
        URL url = new URL(MotanConstants.REGISTRY_PROTOCOL_DIRECT,ip,port,"");
        directUrls.add(url);
    }

    private void parseIpAndPort(String directUrl) {
    }

    @Override
    protected void doRegister(URL url) {
        // do nothing
    }

    @Override
    protected void doUnregister(URL url) {
        // do nothing
    }

    @Override
    protected void doSubscribe(URL url, NotifyListener listener) {
        subscribeUrls.putIfAbsent(url, 1);
        listener.notify(this.getUrl(), doDiscover(url));
    }

    @Override
    protected void doUnsubscribe(URL url, NotifyListener listener) {
        subscribeUrls.remove(url);
        listener.notify(this.getUrl(), doDiscover(url));
    }

    @Override
    protected List<URL> doDiscover(URL subscribeUrl) {
        return createSubscribeUrl(subscribeUrl);
    }

    private List<URL> createSubscribeUrl(URL subscribeUrl) {
        URL url = this.getUrl();
        List result = new ArrayList(directUrls.size());
        for (URL directUrl : directUrls) {
            URL tmp = subscribeUrl.createCopy();
            tmp.setHost(directUrl.getHost());
            tmp.setPort(directUrl.getPort());
            result.add(tmp);
        }
        return result;
    }

    @Override
    protected void doAvailable(URL url) {
        // do nothing
    }

    @Override
    protected void doUnavailable(URL url) {
        // do nothing
    }
}

        String[] ipAndPort = directUrl.split(":");
        String ip = ipAndPort[0];
        Integer port = Integer.parseInt(ipAndPort[1]);
        if (port < 0 || port > 65535) {
            throw new RuntimeException();
        }
        registerDirectUrl(ip, port);
    
<methods>public void <init>(com.weibo.api.motan.rpc.URL) ,public void available(com.weibo.api.motan.rpc.URL) ,public List<com.weibo.api.motan.rpc.URL> discover(com.weibo.api.motan.rpc.URL) ,public Collection<com.weibo.api.motan.rpc.URL> getRegisteredServiceUrls() ,public Map<java.lang.String,java.lang.Object> getRuntimeInfo() ,public com.weibo.api.motan.rpc.URL getUrl() ,public void register(com.weibo.api.motan.rpc.URL) ,public void subscribe(com.weibo.api.motan.rpc.URL, com.weibo.api.motan.registry.NotifyListener) ,public void unavailable(com.weibo.api.motan.rpc.URL) ,public void unregister(com.weibo.api.motan.rpc.URL) ,public void unsubscribe(com.weibo.api.motan.rpc.URL, com.weibo.api.motan.registry.NotifyListener) <variables>private Set<com.weibo.api.motan.rpc.URL> registeredServiceUrls,protected java.lang.String registryClassName,private com.weibo.api.motan.rpc.URL registryUrl,private ConcurrentHashMap<com.weibo.api.motan.rpc.URL,Map<java.lang.String,List<com.weibo.api.motan.rpc.URL>>> subscribedCategoryResponses