|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.trippi.impl.base.ConcurrentTriplestoreReader org.trippi.impl.base.ConcurrentTriplestoreWriter
public class ConcurrentTriplestoreWriter
A ConcurrentTriplestoreReader that also implements TriplestoreWriter with concurrent buffered write access.
In addition to on-demand flushes, additions and deletions will periodically by flushed by a separate thread when a certain amount of inactivity has occurred or the buffer reaches a certain size.
If the buffer ever exceeds its safeCapacity(), all updates will be halted until it is flushed.
Constructor Summary | |
---|---|
ConcurrentTriplestoreWriter(TriplestoreSessionPool pool,
AliasManager aliasManager,
TriplestoreSession updateSession,
UpdateBuffer buffer,
int autoFlushBufferSize,
int autoFlushDormantSeconds)
Initialize variables, obtain a session for updates, and start the autoFlush thread. |
Method Summary | |
---|---|
void |
add(java.util.List triples,
boolean flush)
Add a series of triples to the store. |
void |
add(org.jrdf.graph.Triple triple,
boolean flush)
Add a single triple to the store (convenience method). |
void |
add(TripleIterator iter,
boolean flush)
Add a series of triples to the store. |
void |
close()
Close the writer, releasing any resources. |
void |
delete(java.util.List triples,
boolean flush)
Remove a series of triples from the store. |
void |
delete(org.jrdf.graph.Triple triple,
boolean flush)
Remove a single triple from the store (convenience method). |
void |
delete(TripleIterator iter,
boolean flush)
Remove a series of triples from the store. |
java.util.List |
findBufferedUpdates(org.jrdf.graph.SubjectNode subject,
org.jrdf.graph.PredicateNode predicate,
org.jrdf.graph.ObjectNode object,
int updateType)
Returns an unmodifiable List of TripleUpdates currently in queue. |
void |
flushBuffer()
Flush the buffer (write the changes to the store). |
int |
getBufferSize()
Get the current size of the buffer. |
void |
run()
Watch the buffer and automatically flush it if dormantSeconds or bufferSize is reached. |
void |
setCacheDeletes(boolean cacheDeletes)
|
void |
setFlushErrorHandler(FlushErrorHandler h)
Set the (optional) handler that will recieve failed flush notification. |
Methods inherited from class org.trippi.impl.base.ConcurrentTriplestoreReader |
---|
countTriples, countTriples, countTriples, countTuples, finalize, findTriples, findTriples, findTriples, findTuples, getAliasMap, listTripleLanguages, listTupleLanguages, setAliasMap |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.trippi.TriplestoreReader |
---|
countTriples, countTriples, countTriples, countTuples, findTriples, findTriples, findTriples, findTuples, getAliasMap, listTripleLanguages, listTupleLanguages, setAliasMap |
Constructor Detail |
---|
public ConcurrentTriplestoreWriter(TriplestoreSessionPool pool, AliasManager aliasManager, TriplestoreSession updateSession, UpdateBuffer buffer, int autoFlushBufferSize, int autoFlushDormantSeconds) throws java.io.IOException, TrippiException
java.io.IOException
TrippiException
Method Detail |
---|
public void setCacheDeletes(boolean cacheDeletes)
public void add(java.util.List triples, boolean flush) throws java.io.IOException, TrippiException
add
in interface TriplestoreWriter
triples
- a list of Triple
objectsflush
- whether to flush the buffer before returning.
java.io.IOException
TrippiException
public void add(TripleIterator iter, boolean flush) throws java.io.IOException, TrippiException
TriplestoreWriter
add
in interface TriplestoreWriter
iter
- an iterator over the triplesflush
- whether to flush the buffer before returning
java.io.IOException
TrippiException
public void add(org.jrdf.graph.Triple triple, boolean flush) throws java.io.IOException, TrippiException
add
in interface TriplestoreWriter
triple
- the Triple
to addflush
- whether to flush the buffer before returning
java.io.IOException
TrippiException
public void delete(java.util.List triples, boolean flush) throws java.io.IOException, TrippiException
delete
in interface TriplestoreWriter
triples
- a list of Triple
objectsflush
- whether to flush the buffer before returning
java.io.IOException
TrippiException
public void delete(TripleIterator iter, boolean flush) throws java.io.IOException, TrippiException
TriplestoreWriter
delete
in interface TriplestoreWriter
iter
- an iterator over the triplesflush
- whether to flush the buffer before returning
java.io.IOException
TrippiException
public void delete(org.jrdf.graph.Triple triple, boolean flush) throws java.io.IOException, TrippiException
delete
in interface TriplestoreWriter
triple
- the Triple
to deleteflush
- whether to flush the buffer before returning
java.io.IOException
TrippiException
public void flushBuffer() throws java.io.IOException, TrippiException
flushBuffer
in interface TriplestoreWriter
java.io.IOException
TrippiException
public void setFlushErrorHandler(FlushErrorHandler h)
TriplestoreWriter
setFlushErrorHandler
in interface TriplestoreWriter
public int getBufferSize()
TriplestoreWriter
getBufferSize
in interface TriplestoreWriter
public void run()
run
in interface java.lang.Runnable
public void close() throws TrippiException
close
in interface TriplestoreReader
close
in class ConcurrentTriplestoreReader
TrippiException
public java.util.List findBufferedUpdates(org.jrdf.graph.SubjectNode subject, org.jrdf.graph.PredicateNode predicate, org.jrdf.graph.ObjectNode object, int updateType)
TriplestoreWriter
findBufferedUpdates
in interface TriplestoreWriter
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |