Search in sources :

Example 1 with TransportSender

use of org.apache.axis2.transport.TransportSender in project wso2-axis2-transports by wso2.

the class XMPPSender method getConnectionDetailsFromAxisConfiguration.

/**
 * Extract connection details from axis2.xml's transportsender section
 * @param serverCredentials
 * @param transportOut
 */
private void getConnectionDetailsFromAxisConfiguration(TransportOutDescription transportOut) {
    if (transportOut != null) {
        Parameter serverUrl = transportOut.getParameter(XMPPConstants.XMPP_SERVER_URL);
        if (serverUrl != null) {
            serverCredentials.setServerUrl(Utils.getParameterValue(serverUrl));
        }
        Parameter userName = transportOut.getParameter(XMPPConstants.XMPP_SERVER_USERNAME);
        if (userName != null) {
            serverCredentials.setAccountName(Utils.getParameterValue(userName));
        }
        Parameter password = transportOut.getParameter(XMPPConstants.XMPP_SERVER_PASSWORD);
        if (password != null) {
            serverCredentials.setPassword(Utils.getParameterValue(password));
        }
        Parameter serverType = transportOut.getParameter(XMPPConstants.XMPP_SERVER_TYPE);
        if (serverType != null) {
            serverCredentials.setServerType(Utils.getParameterValue(serverType));
        }
        Parameter domainName = transportOut.getParameter(XMPPConstants.XMPP_DOMAIN_NAME);
        if (serverUrl != null) {
            serverCredentials.setDomainName(Utils.getParameterValue(domainName));
        }
    }
}
Also used : Parameter(org.apache.axis2.description.Parameter)

Example 2 with TransportSender

use of org.apache.axis2.transport.TransportSender in project wso2-synapse by wso2.

the class Axis2TransportHelper method getPendingSenderThreadCount.

/**
 * Determines the total number of pending sender threads (active + queued).
 *
 * @return the total number of pending sender threads (active + queued).
 */
public int getPendingSenderThreadCount() {
    int pendingThreads = 0;
    Map<String, TransportOutDescription> trpOuts = configurationContext.getAxisConfiguration().getTransportsOut();
    for (TransportOutDescription trpOut : trpOuts.values()) {
        TransportSender trpSnd = trpOut.getSender();
        if (trpSnd instanceof ManagementSupport) {
            int inUse = ((ManagementSupport) trpSnd).getActiveThreadCount();
            int inQue = ((ManagementSupport) trpSnd).getQueueSize();
            if ((inUse + inQue) > 0) {
                if (log.isDebugEnabled()) {
                    log.debug(new StringBuilder("Transport Sender : ").append(trpSnd.getName()).append(" currently using : ").append(inUse).append(" threads with ").append(inQue).append(" requests already queued...").toString());
                }
                pendingThreads += (inUse + inQue);
            }
        }
    }
    return pendingThreads;
}
Also used : TransportSender(org.apache.axis2.transport.TransportSender) ManagementSupport(org.apache.axis2.transport.base.ManagementSupport) TransportOutDescription(org.apache.axis2.description.TransportOutDescription)

Aggregations

Parameter (org.apache.axis2.description.Parameter)1 TransportOutDescription (org.apache.axis2.description.TransportOutDescription)1 TransportSender (org.apache.axis2.transport.TransportSender)1 ManagementSupport (org.apache.axis2.transport.base.ManagementSupport)1