com.kuka.roboticsAPI.concurrencyModel
Class SyncHandle

java.lang.Object
  extended by java.util.concurrent.CyclicBarrier
      extended by com.kuka.roboticsAPI.concurrencyModel.SyncHandle

public final class SyncHandle
extends CyclicBarrier

Handle for cyclic synchronization of threads. Using the await method forces the thread to block until all other parties arrived at this synchronization point. After all parties arrived, the handle is reset and can be used again.

By manually calling reset, all waiting threads will get released with an exception.

This element is not in its final state and might change in future versions.

Constructor Summary
SyncHandle(String name, int parties)
          Creates a new instance fo the SyncHandle class.
 
Method Summary
 int await()
          Waits for other threads to reach the synchronization point.
 int await(long timeout, TimeUnit unit)
          Waits for other threads to reach the synchronization point.
 String getName()
          Gets the name of the handle.
 String toString()
          
 
Methods inherited from class java.util.concurrent.CyclicBarrier
getNumberWaiting, getParties, isBroken, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SyncHandle

public SyncHandle(String name,
                  int parties)
Creates a new instance fo the SyncHandle class.

Parameters:
name - name for the handle.
parties - number of participating threads.
This element is not in its final state and might change in future versions.
Method Detail

getName

public String getName()
Gets the name of the handle.

Returns:
the name of the handle.
This element is not in its final state and might change in future versions.

await

public int await()
Waits for other threads to reach the synchronization point. If an error occurs because one thread broke the barrier, this method will throw an exception and reset the handle automatically. The handle will be reset when all threads reached the barrier, too.

Overrides:
await in class CyclicBarrier
Returns:
The index at which this thread arrived.
This element is not in its final state and might change in future versions.

await

public int await(long timeout,
                 TimeUnit unit)
Waits for other threads to reach the synchronization point. If an error occurs because one thread broke the barrier or a timeout occured, this method will throw an exception and reset the handle automatically. The handle will be reset when all threads reached the barrier, too.

Overrides:
await in class CyclicBarrier
Parameters:
timeout - The timeout to wait until the thread will return.
unit - The timeunit for the timeout.
Returns:
The index at which this thread arrived.
This element is not in its final state and might change in future versions.

toString

public String toString()

Overrides:
toString in class Object
This element is not in its final state and might change in future versions.


Copyright © 2019. All rights reserved.