Hi everyone,
I have the following application in flex. I want to call two different remote objects in parallel.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
<mx:RemoteObject id="service1" destination="test1" />
<mx:RemoteObject id="service2" destination="test2" />
<mx:Button label="service1" click="{service1.method(1)}" />
<mx:Button label="service2" click="{service2.method(2)}" />
<mx:Button label="service1 AND service2" click="{service1.method(1);service2.method(2)}" />
</mx:Application>
Each remote object is wired to a different Java implementation called TestCase1 and TestCase2. So I would think I could call the two objects in parallel and execute them parallel to each other.
public class TestCase1 {
public void method(int n) {
System.out.println("method(" + n + ") starts");
try {
Thread.sleep(8000);
} catch(InterruptedException e) {}
System.out.println("method(" + n + ") ends");
}
}
public class TestCase2 {
public void method(int n) {
System.out.println("method(" + n + ") starts");
try {
Thread.sleep(8000);
} catch(InterruptedException e) {}
System.out.println("method(" + n + ") ends");
}
}
Now what the methods do is to print sth. when they are called, then wait 8 secs and print sth. after that.
When clicking each button seperatly, it works, both methods are started in parallel. However, calling both method the same time, leaves one service to wait with its call while until the other is executing.
How can I avoid that?
Thx Philipp
enter code here