Project

General

Profile

« Previous | Next » 

Revision 46729

async methods

View differences:

AsyncClientUtils.java
15 15

  
16 16
	private static final Map<String, AsyncClientCallback> activeRemoteCalls = new HashMap<>();
17 17

  
18
	public void invokeRemoteMethod(final String remoteBaseUrl, final String remoteMethod, final Object o, final AsyncClientCallback callback) {
19
		final String url = remoteBaseUrl + "/async/method/" + remoteMethod;
18
	public void invokeRemoteMethod(final String remoteBaseUrl,
19
			final String remoteMethod,
20
			final String localBaseUrl,
21
			final Object o,
22
			final AsyncClientCallback callback) {
23
		final String url = remoteBaseUrl + "/async/method/" + remoteMethod + "?caller=" + localBaseUrl;
24

  
25
		log.info("invoking async method: " + url);
26

  
20 27
		final String id = (new RestTemplate()).postForObject(url, o, String.class);
21
		activeRemoteCalls.put(id, callback);
28
		if (callback != null) {
29
			activeRemoteCalls.put(id, callback);
30
		}
22 31
	}
23 32

  
24 33
	public boolean processResponse(final String id, final AsyncResponse response) {

Also available in: Unified diff