Example usage for com.liferay.portal.kernel.xmlrpc XmlRpcUtil executeMethod

List of usage examples for com.liferay.portal.kernel.xmlrpc XmlRpcUtil executeMethod

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.xmlrpc XmlRpcUtil executeMethod.

Prototype

public static Response executeMethod(String url, String methodName, Object[] arguments) throws XmlRpcException 

Source Link

Usage

From source file:com.liferay.portlet.blogs.util.LinkbackProducerUtil.java

License:Open Source License

public static synchronized void sendQueuedPingbacks() throws XmlRpcException {

    Calendar cal = Calendar.getInstance();

    cal.add(Calendar.MINUTE, -1);

    Date expiration = cal.getTime();

    while (!_pingbackQueue.isEmpty()) {
        Tuple tuple = _pingbackQueue.get(0);

        Date time = (Date) tuple.getObject(0);

        if (time.before(expiration)) {
            _pingbackQueue.remove(0);//from  w  w  w .  j  a  v a  2s . c o  m

            String sourceUri = (String) tuple.getObject(1);
            String targetUri = (String) tuple.getObject(2);

            String serverUri = _discoverPingbackServer(targetUri);

            if (Validator.isNull(serverUri)) {
                continue;
            }

            if (_log.isInfoEnabled()) {
                _log.info("XML-RPC pingback " + serverUri + ", source " + sourceUri + ", target " + targetUri);
            }

            Response response = XmlRpcUtil.executeMethod(serverUri, "pingback.ping",
                    new Object[] { sourceUri, targetUri });

            if (_log.isInfoEnabled()) {
                _log.info(response.toString());
            }
        } else {
            break;
        }
    }
}