E - the elements in the buspublic class FastOdsBus<E> extends Object
final FastOdsBus <E> bus = new FastOdsBus <E>();
Thread consumer = new Thread() {
@Override
public void run() {
while (!bus.isClosed()) {
final E element = bus.get();
// do something with E
}
}
consumer.start()
// put whatever in the bus with bus put.
try {
consumer.join();
} catch (final InterruptedException e) {
logger.log(Level.SEVERE, "", e);
}
| Constructor and Description |
|---|
FastOdsBus()
Create a new bus
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
close the bus
|
E |
get()
Get an element from the bus.
|
boolean |
isClosed() |
void |
put(E element)
Add an element to the bus
|
public void close()
public E get()
public boolean isClosed()
public void put(E element)
element - the elementCopyright © 2016–2021. All rights reserved.