Contents | Package | Class | Tree | Deprecated | Index | Help
PREV | NEXT SHOW LISTS | HIDE LISTS

Class jsync.Concurrent

java.lang.Object
    |
    +----jsync.Concurrent

public class Concurrent
extends java.lang.Object
Class initiating parallel execution of several threads and collecting their results. Two models of execution are supported - wait completion of all activities or wait until some thread is terminated and stop all other threads.

See Also:
Activity

Constructor Summary
 Concurrent(Activity[] activities)
Constructor of Concurrent class.
 

Method Summary
void  start()
Start execution of activity threads.
java.lang.Object[]  waitAll()
Wait until all started threads finish their execution.
java.lang.Object[]  waitAll(long timeout)
Wait at most timeout miliseconds until all started threads finish their execution.
java.lang.Object  waitOne()
Wait until one of the started threads finish it's execution.
java.lang.Object  waitOne(long timeout)
Wait during specified period of time until one of started threads finish it's execution.
 
Methods inherited from class java.lang.Object
 equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Concurrent

public Concurrent(Activity[] activities)
Constructor of Concurrent class. This constructor creates a thread object for each activity.
Parameters:
activities - array of activities to be done.
Method Detail

start

public void start()
Start execution of activity threads.

waitOne

public java.lang.Object waitOne()
Wait until one of the started threads finish it's execution. After it all other threads are stopped and result of finished thread is returned.
Returns:
result returned by thread first finished it's execution.

waitOne

public java.lang.Object waitOne(long timeout)
Wait during specified period of time until one of started threads finish it's execution. After it all other threads are stopped and result of finished thread is returned.
Parameters:
timeout - the maximum time to wait in milliseconds.
Returns:
result returned by thread first finished it's execution or null if timeout is expired before any thread finish it's execution.

waitAll

public java.lang.Object[] waitAll()
Wait until all started threads finish their execution.
Returns:
array containing results returned by each of the threads.

waitAll

public java.lang.Object[] waitAll(long timeout)
Wait at most timeout miliseconds until all started threads finish their execution.
Parameters:
timeout - the maximum time to wait in milliseconds.
Returns:
array containing results returned by each of the threads or null if timeout is expired before all threads finish execution.

Contents | Package | Class | Tree | Deprecated | Index | Help
PREV | NEXT SHOW LISTS | HIDE LISTS