Skip to content

Commit c4af21a

Browse files
committed
Fix another concurrency issue similar to AXIS-2850 and ensure that stubs are thread safe.
1 parent ef1938b commit c4af21a

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

axis-rt-core/src/main/java/org/apache/axis/client/Stub.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,11 +432,14 @@ public Service _getService() {
432432
* @return
433433
*/
434434
public Call _createCall() throws ServiceException {
435-
_call = (Call) service.createCall();
435+
// A single stub instance may be used concurrently by multiple threads; therefore we need
436+
// to return the value of the local call variable instead of reading the _call attribute.
437+
Call call = (Call) service.createCall();
438+
_call = call;
436439

437440
// TODO: There is a lot of code in the generated stubs that
438441
// can be moved here.
439-
return _call;
442+
return call;
440443
}
441444

442445
/**

integration/src/test/java/test/wsdl/multithread/MultithreadTestCase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public AddressBook getStub() throws Exception {
4646
private void testMultithreading(StubSupplier stubSupplier) throws Throwable {
4747
Report report = new Report();
4848
final int numThreads = 50;
49-
final int numInvocations = 4;
49+
final int numInvocations = 10;
5050
CountDownLatch readyLatch = new CountDownLatch(numThreads);
5151
CountDownLatch startLatch = new CountDownLatch(1);
5252
Thread[] threads = new Thread[numThreads];

0 commit comments

Comments
 (0)