|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectch.javasoft.jbase.concurrent.MultiplexedAppendTable<E>
public class MultiplexedAppendTable<E>
The MultiplexedAppendTable uses a queue with limited or
unlimited capacity to cache appended entities. A separate thread copies the
added entities from the queue to the underlying base table. Multiple threads
can concurrently add entities to this table.
Note that all method except for add(Object), flush()
and close(boolean) throw an UnsupportedOperationException.
| Constructor Summary | |
|---|---|
MultiplexedAppendTable(Table<E> baseTable)
Constructor with cache capacity of Integer.MAX_VALUE. |
|
MultiplexedAppendTable(Table<E> baseTable,
int cacheSize)
Constructor with specified cache capacity |
|
| Method Summary | |
|---|---|
int |
add(E entity)
Adds an entry, initially to the cache. |
void |
close(boolean erase)
Closes the table. |
void |
flush()
Flushes the table. |
E |
get(int index)
Always throws an UnsupportedOperationException |
void |
remove(int index)
Always throws an UnsupportedOperationException |
void |
removeAll()
Always throws an UnsupportedOperationException |
void |
set(int index,
E entity)
Always throws an UnsupportedOperationException |
int |
size()
Always throws an UnsupportedOperationException |
void |
swap(int indexA,
int indexB)
Always throws an UnsupportedOperationException |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MultiplexedAppendTable(Table<E> baseTable)
Integer.MAX_VALUE.
baseTable - the base table to which the entries are written from
the cache
public MultiplexedAppendTable(Table<E> baseTable,
int cacheSize)
baseTable - the base table to which the entries are written from
the cache| Method Detail |
|---|
public int add(E entity)
throws IOException
Note that this method always returns -1, since we do not know where the new entry has been put. If the table is already closed, an exception is thrown.
add in interface Table<E>entity - the entity to add
IOException - if an i/o exception occurs, or if the table has
already been closed
public void flush()
throws IOException
This method guarantees that the queue was empty once between the time this method was called, and the call returns. This also guarantees that entries which have been added by the calling thread are flushed to the underlying base table. However, it is important to know that if concurrent threads are constantly adding entries, this method might not return and leave the caller in a blocked state.
flush in interface Table<E>IOException
public void close(boolean erase)
throws IOException
close in interface Table<E>IOException
public E get(int index)
throws IOException
UnsupportedOperationException
get in interface Table<E>UnsupportedOperationException - always
IOException
public void removeAll()
throws IOException
UnsupportedOperationException
removeAll in interface Table<E>UnsupportedOperationException - always
IOException
public void remove(int index)
throws IOException
UnsupportedOperationException
remove in interface Table<E>UnsupportedOperationException - always
IOException
public void set(int index,
E entity)
throws IOException
UnsupportedOperationException
set in interface Table<E>UnsupportedOperationException - always
IOException
public void swap(int indexA,
int indexB)
throws IOException
UnsupportedOperationException
swap in interface Table<E>UnsupportedOperationException - always
IOException
public int size()
throws IOException
UnsupportedOperationException
size in interface Table<E>UnsupportedOperationException - always
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||