⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sonicmqvendoradapter.java

📁 Java有关XML编程需要用到axis 的源代码 把里面bin下的包导入相应的Java工程 进行使用
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
     * @param jmsurl The JMS URL representing the target endpoint address     * @param cfProps The set of connection factory configuration properties     */    public void addVendorConnectionFactoryProperties(JMSURLHelper jmsurl, HashMap cfProps)    {        if (jmsurl.getPropertyValue(BROKER_URL) != null)            cfProps.put(BROKER_URL, jmsurl.getPropertyValue(BROKER_URL));        if (jmsurl.getPropertyValue(DEFAULT_USERNAME) != null)            cfProps.put(DEFAULT_USERNAME, jmsurl.getPropertyValue(DEFAULT_USERNAME));        if (jmsurl.getPropertyValue(DEFAULT_PASSWORD) != null)            cfProps.put(DEFAULT_PASSWORD, jmsurl.getPropertyValue(DEFAULT_PASSWORD));        if (jmsurl.getPropertyValue(PING_INTERVAL) != null)            cfProps.put(PING_INTERVAL, jmsurl.getPropertyValue(PING_INTERVAL));        if (jmsurl.getPropertyValue(RECONNECT_INTERVAL) != null)            cfProps.put(RECONNECT_INTERVAL, jmsurl.getPropertyValue(RECONNECT_INTERVAL));        if (jmsurl.getPropertyValue(RECONNECT_TIMEOUT) != null)            cfProps.put(RECONNECT_TIMEOUT, jmsurl.getPropertyValue(RECONNECT_TIMEOUT));        if (jmsurl.getPropertyValue(CONNECT_ID) != null)            cfProps.put(CONNECT_ID, jmsurl.getPropertyValue(CONNECT_ID));        if (jmsurl.getPropertyValue(CONNECTION_URLS) != null)            cfProps.put(CONNECTION_URLS, jmsurl.getPropertyValue(CONNECTION_URLS));        if (jmsurl.getPropertyValue(LOAD_BALANCING) != null)            cfProps.put(LOAD_BALANCING, jmsurl.getPropertyValue(LOAD_BALANCING));        if (jmsurl.getPropertyValue(MONITOR_INTERVAL) != null)            cfProps.put(MONITOR_INTERVAL, jmsurl.getPropertyValue(MONITOR_INTERVAL));        if (jmsurl.getPropertyValue(PERSISTENT_DELIVERY) != null)            cfProps.put(PERSISTENT_DELIVERY, jmsurl.getPropertyValue(PERSISTENT_DELIVERY));        if (jmsurl.getPropertyValue(SEQUENTIAL) != null)            cfProps.put(SEQUENTIAL, jmsurl.getPropertyValue(SEQUENTIAL));        if (jmsurl.getPropertyValue(PREFETCH_COUNT) != null)            cfProps.put(PREFETCH_COUNT, jmsurl.getPropertyValue(PREFETCH_COUNT));        if (jmsurl.getPropertyValue(PREFETCH_THRESHOLD) != null)            cfProps.put(PREFETCH_THRESHOLD, jmsurl.getPropertyValue(PREFETCH_THRESHOLD));        if (jmsurl.getPropertyValue(SELECTOR_AT_BROKER) != null)            cfProps.put(SELECTOR_AT_BROKER, jmsurl.getPropertyValue(SELECTOR_AT_BROKER));    }    /**     * Check that the attributes of the candidate connection factory match the     * requested connection factory properties.     *     * @param cf the candidate connection factory     * @param jmsurl the JMS URL associated with the candidate connection factory     * @param cfProps the properties associated with the current request     * @return true or false     */    public boolean isMatchingConnectionFactory(javax.jms.ConnectionFactory cf,                                               JMSURLHelper jmsurl,                                               HashMap cfProps)    {        String brokerURL = null;        String connectionURLs = null;        boolean loadBalancing = false;        boolean sequential = false;        if (cf instanceof progress.message.jclient.QueueConnectionFactory)        {            progress.message.jclient.QueueConnectionFactory qcf =                (progress.message.jclient.QueueConnectionFactory)cf;            // get existing queue connection factory properties            brokerURL = qcf.getBrokerURL();            connectionURLs = qcf.getConnectionURLs();            loadBalancing = qcf.getLoadBalancing();            sequential = qcf.getSequential();        }        else if (cf instanceof progress.message.jclient.TopicConnectionFactory)        {            progress.message.jclient.TopicConnectionFactory tcf =                (progress.message.jclient.TopicConnectionFactory)cf;            // get existing topic connection factory properties            brokerURL = tcf.getBrokerURL();            connectionURLs = tcf.getConnectionURLs();            loadBalancing = tcf.getLoadBalancing();            sequential = tcf.getSequential();        }        // compare broker url        String propertyBrokerURL = (String)cfProps.get(BROKER_URL);        if (!brokerURL.equals(propertyBrokerURL))            return false;        // compare connection url list        String propertyConnectionURLs = (String)cfProps.get(CONNECTION_URLS);        if ((connectionURLs != null) && (propertyConnectionURLs != null))        {            if (!connectionURLs.equalsIgnoreCase(propertyConnectionURLs))                return false;            // check sequential if connection urls have been set            String tmpSequential = (String)cfProps.get(SEQUENTIAL);            boolean propertySequential = true;            if (tmpSequential != null)                propertySequential = Boolean.getBoolean(tmpSequential);            if (sequential != propertySequential)                return false;        }        else if ((connectionURLs != null) || (propertyConnectionURLs != null))            return false;        // compare load balancing flag        String tmpLoadBalancing = (String)cfProps.get(LOAD_BALANCING);        boolean propertyLoadBalancing = false;        if (tmpLoadBalancing != null)            propertyLoadBalancing = Boolean.getBoolean(tmpLoadBalancing);        if (loadBalancing != propertyLoadBalancing)            return false;        return true;    }    public boolean isRecoverable(Throwable thrown, int action)    {        //the super class cannot be trusted for on exception because it always        //returns false        if(action != ON_EXCEPTION_ACTION && !super.isRecoverable(thrown, action))            return false;        if(!(thrown instanceof JMSException))            return true;        JMSException jmse = (JMSException)thrown;        switch(action)        {            case CONNECT_ACTION:                if(isNetworkFailure(jmse))                    return false;                break;            case SUBSCRIBE_ACTION:                if(isQueueMissing(jmse) || isAnotherSubscriberConnected(jmse))                    return false;                break;            case ON_EXCEPTION_ACTION:                if(isConnectionDropped(jmse))                    return false;                break;        }        return true;    }    public boolean isConnectionDropped(JMSException jmse)    {        return ErrorCodes.testException(jmse, ErrorCodes.ERR_CONNECTION_DROPPED);    }    private boolean isQueueMissing(JMSException jmse)    {        String message = jmse.getMessage();        if(message != null && message.startsWith("Queue not found"))        {            return true;        }        return false;    }    private boolean isAnotherSubscriberConnected(JMSException jmse)    {        Exception linkedException = jmse.getLinkedException();        if(linkedException != null &&           linkedException instanceof EUserAlreadyConnected)        {            return true;        }        return false;    }    private boolean isNetworkFailure(JMSException jmse)    {        Exception linkedException = jmse.getLinkedException();        if(linkedException != null &&           linkedException instanceof ENetworkFailure)        {            return true;        }        return false;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -