|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgr.uoa.di.madgik.grs.writer.RecordWriter<T>
public class RecordWriter<T extends Record>
Field Summary | |
---|---|
static int |
DefaultBufferCapacity
|
static int |
DefaultConcurrentPartialCapacity
|
static long |
DefaultInactivityTimeout
|
static java.util.concurrent.TimeUnit |
DefaultInactivityTimeUnit
|
static float |
DefaultMirrorBufferFactor
|
static float |
DefaultThreshold
|
Constructor Summary | |
---|---|
RecordWriter(IWriterProxy proxy,
IRecordReader reader)
Creates a new instance using the configuration retrieved from an IRecordReader . |
|
RecordWriter(IWriterProxy proxy,
IRecordReader reader,
int capacity,
int concurrentPartialCapacity,
float mirrorSizeFactor)
Creates a new instance using the same record definitions as the ones of the supplied IRecordReader . |
|
RecordWriter(IWriterProxy proxy,
IRecordReader reader,
int capacity,
int concurrentPartialCapacity,
float mirrorSizeFactor,
long inactivityTimeout,
java.util.concurrent.TimeUnit inactivityTimeUnit)
Creates a new instance using the same record definitions as the ones of the supplied IRecordReader . |
|
RecordWriter(IWriterProxy proxy,
RecordDefinition[] definitions)
Creates a new instance |
|
RecordWriter(IWriterProxy proxy,
RecordDefinition[] definitions,
int capacity,
int concurrentPartialCapacity,
float mirrorSizeFactor)
Creates a new instance |
|
RecordWriter(IWriterProxy proxy,
RecordDefinition[] definitions,
int capacity,
int concurrentPartialCapacity,
float mirrorSizeFactor,
long inactivityTimeout,
java.util.concurrent.TimeUnit inactivityTimeUnit)
Creates a new instance |
Method Summary | |
---|---|
int |
availableRecords()
The number of readily available for consumption Record s |
void |
close()
Closes the underlying buffer. |
void |
dispose()
Disposes the underlying buffer. |
void |
emit(BufferEvent event)
Emits the provided event to the reader. |
int |
getCapacity()
The underlying IBuffer capacity used |
java.net.URI |
getLocator()
|
IBuffer.Status |
getStatus()
Retrieves the status of the underlying IBuffer |
boolean |
importRecord(T record)
Dissociates a Record from the underlying IBuffer of a producer and stores it to the IBuffer of
this IRecordWriter . |
boolean |
importRecord(T record,
int newDefinitionIndex)
Dissociates a Record from the underlying IBuffer of a producer and stores it to the IBuffer of
this RecordWriter . |
boolean |
importRecord(T record,
int newDefinitionIndex,
long timeout,
java.util.concurrent.TimeUnit unit)
Dissociates a Record from the underlying IBuffer of a producer and stores it to the IBuffer of
this RecordWriter . |
boolean |
importRecord(T record,
long timeout,
java.util.concurrent.TimeUnit unit)
Dissociates a Record from the underlying IBuffer of a producer and stores it to the IBuffer of
this RecordWriter . |
boolean |
put(T record)
Stores the provided Record to the underlying IBuffer |
boolean |
put(T record,
long timeout,
java.util.concurrent.TimeUnit unit)
Stores the provided Record to the underlying IBuffer . |
BufferEvent |
receive()
Receives a previously emitted event from a reader |
void |
setBufferStore(IBufferStore store)
If this writer is populated by an IBufferStore this store is provided in order to keep the store
alive and active even after the respective BufferStoreReader has closed the writer but the client
reader is still using it |
long |
totalRecords()
The number of total Record s that have passed through the IBuffer this far |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static int DefaultBufferCapacity
public static int DefaultConcurrentPartialCapacity
public static float DefaultThreshold
public static float DefaultMirrorBufferFactor
public static long DefaultInactivityTimeout
public static java.util.concurrent.TimeUnit DefaultInactivityTimeUnit
Constructor Detail |
---|
public RecordWriter(IWriterProxy proxy, RecordDefinition[] definitions) throws GRS2WriterException
proxy
- the IWriterProxy
to use to publish the authored IBuffer
definitions
- the RecordDefinition
s of the Record
s added
GRS2WriterException
- the operation could not be completedBufferFactory.getBuffer()
,
IBuffer.setRecordDefinitions(RecordDefinition[])
public RecordWriter(IWriterProxy proxy, RecordDefinition[] definitions, int capacity, int concurrentPartialCapacity, float mirrorSizeFactor) throws GRS2WriterException
proxy
- the IWriterProxy
to use to publish the authored IBuffer
definitions
- the RecordDefinition
s of the Record
s addedcapacity
- the capacity of the underlying IBuffer
concurrentPartialCapacity
- the concurrent partial record capacity of the underlying IBuffer
mirrorSizeFactor
- the factor to calculate the mirror threshold size
GRS2WriterException
- the operation could not be completedBufferFactory.getBuffer()
,
IBuffer.setRecordDefinitions(RecordDefinition[])
,
IBuffer.setCapacity(int)
,
IBuffer.setConcurrentPartialCapacity(int)
,
IBuffer.setMirrorBuffer(int)
public RecordWriter(IWriterProxy proxy, RecordDefinition[] definitions, int capacity, int concurrentPartialCapacity, float mirrorSizeFactor, long inactivityTimeout, java.util.concurrent.TimeUnit inactivityTimeUnit) throws GRS2WriterException
proxy
- the IWriterProxy
to use to publish the authored IBuffer
definitions
- the RecordDefinition
s of the Record
s addedcapacity
- the capacity of the underlying IBuffer
concurrentPartialCapacity
- the concurrent partial record capacity of the underlying IBuffer
mirrorSizeFactor
- the factor to calculate the mirror threshold sizeinactivityTimeout
- the inactivity timeout after which the IBuffer
is considered eligible for
disposal. This value is interpreted in conjunction with the inactivityTimeUnit valueinactivityTimeUnit
- the inactivity timeout unit after which the IBuffer
is considered eligible for
disposal. This value is interpreted in conjunction with the inactivityTimeout value
GRS2WriterException
- the operation could not be completedBufferFactory.getBuffer()
,
IBuffer.setRecordDefinitions(RecordDefinition[])
,
IBuffer.setCapacity(int)
,
IBuffer.setConcurrentPartialCapacity(int)
,
IBuffer#setNotificationThreshold(float)
,
IBuffer.setMirrorBuffer(int)
,
IBuffer.setInactivityTimeout(long)
,
IBuffer.setInactivityTimeUnit(TimeUnit)
,
IBuffer#getWriterThresholdNotificationObject()
,
IBuffer.initialize()
public RecordWriter(IWriterProxy proxy, IRecordReader reader) throws GRS2WriterException
IRecordReader
. The record definitions, capacity and
concurrent partial capacity configuration parameters are duplicated from the reader and all other configuration parameters
are set to their default values.
proxy
- the IWriterProxy
to use to publish the authored IBuffer
reader
- the IRecordReader
to retrieve configuration from
GRS2WriterException
- the operation could not be completedBufferFactory.getBuffer()
,
IBuffer.setRecordDefinitions(RecordDefinition[])
public RecordWriter(IWriterProxy proxy, IRecordReader reader, int capacity, int concurrentPartialCapacity, float mirrorSizeFactor) throws GRS2WriterException
IRecordReader
.
Capacity, concurrent partial capacity and mirror buffer factor configuration parameters can be configured to a non-default value.
All other configuration parameters are set to their default values.
proxy
- the IWriterProxy
to use to publish the authored IBuffer
reader
- the IRecordReader
to retrieve record definitions fromcapacity
- the capacity of the underlying IBuffer
concurrentPartialCapacity
- the concurrent partial record capacity of the underlying IBuffer
mirrorSizeFactor
- the factor to calculate the mirror threshold size
GRS2WriterException
- the operation could not be completedBufferFactory.getBuffer()
,
IBuffer.setRecordDefinitions(RecordDefinition[])
,
IBuffer.setCapacity(int)
,
IBuffer.setConcurrentPartialCapacity(int)
,
IBuffer.setMirrorBuffer(int)
public RecordWriter(IWriterProxy proxy, IRecordReader reader, int capacity, int concurrentPartialCapacity, float mirrorSizeFactor, long inactivityTimeout, java.util.concurrent.TimeUnit inactivityTimeUnit) throws GRS2WriterException
IRecordReader
.
All configuration parameters can be configured to a non-default value.
proxy
- the IWriterProxy
to use to publish the authored IBuffer
reader
- the IRecordReader
to retrieve record definitions fromcapacity
- the capacity of the underlying IBuffer
concurrentPartialCapacity
- the concurrent partial record capacity of the underlying IBuffer
mirrorSizeFactor
- the factor to calculate the mirror threshold sizeinactivityTimeout
- the inactivity timeout after which the IBuffer
is considered eligible for
disposal. This value is interpreted in conjunction with the inactivityTimeUnit valueinactivityTimeUnit
- the inactivity timeout unit after which the IBuffer
is considered eligible for
disposal. This value is interpreted in conjunction with the inactivityTimeout value
GRS2WriterException
- the operation could not be completedBufferFactory.getBuffer()
,
IBuffer.setRecordDefinitions(RecordDefinition[])
,
IBuffer.setCapacity(int)
,
IBuffer.setConcurrentPartialCapacity(int)
,
IBuffer#setNotificationThreshold(float)
,
IBuffer.setMirrorBuffer(int)
,
IBuffer.setInactivityTimeout(long)
,
IBuffer.setInactivityTimeUnit(TimeUnit)
,
IBuffer#getWriterThresholdNotificationObject()
,
IBuffer.initialize()
Method Detail |
---|
public void setBufferStore(IBufferStore store) throws GRS2WriterException
IBufferStore
this store is provided in order to keep the store
alive and active even after the respective BufferStoreReader
has closed the writer but the client
reader is still using it
setBufferStore
in interface IRecordWriter<T extends Record>
store
- the store which serves the writer
GRS2WriterException
- the operation could not be completedIRecordWriter.setBufferStore(IBufferStore)
public int getCapacity() throws GRS2WriterException
IBuffer
capacity used
getCapacity
in interface IRecordWriter<T extends Record>
GRS2WriterException
- the operation could not be completedIRecordWriter.getCapacity()
public java.net.URI getLocator() throws GRS2WriterException
getLocator
in interface IRecordWriter<T extends Record>
IBuffer
created through the IWriterProxy
provided at
writer initialization
GRS2WriterException
- the operation could not be completedIRecordWriter.getLocator()
public IBuffer.Status getStatus()
IBuffer
getStatus
in interface IRecordWriter<T extends Record>
IRecordWriter.getStatus()
public int availableRecords() throws GRS2WriterException
Record
s
availableRecords
in interface IRecordWriter<T extends Record>
GRS2WriterException
- the operation could not be completedIRecordWriter.availableRecords()
public long totalRecords() throws GRS2WriterException
Record
s that have passed through the IBuffer
this far
totalRecords
in interface IRecordWriter<T extends Record>
Record
s that have passed through the IBuffer
this far
GRS2WriterException
- the operation could not be completedIRecordWriter.totalRecords()
public boolean put(T record) throws GRS2WriterException
Record
to the underlying IBuffer
put
in interface IRecordWriter<T extends Record>
record
- the Record
to add
IBuffer
has reached its capacity
GRS2WriterException
- the operation could not be completedIRecordWriter.put(Record)
public boolean put(T record, long timeout, java.util.concurrent.TimeUnit unit) throws GRS2WriterException
Record
to the underlying IBuffer
. If the IBuffer
has already reached
its capacity, the method will block for a maximum of timeout
unit
units of time waiting
for a record to be consumed or until the IBuffer
uses the IBuffer.getWriterImmediateNotificationObject()
to notify blocked writers
put
in interface IRecordWriter<T extends Record>
record
- the Record
to addtimeout
- the timeout to wait forunit
- the unit of time to use to interpret the timeout value
IBuffer
has reached its capacity and the timeout expired
GRS2WriterException
- the operation could not be completedIRecordWriter.put(Record, long, TimeUnit)
public boolean importRecord(T record) throws GRS2Exception
Record
from the underlying IBuffer
of a producer and stores it to the IBuffer
of
this IRecordWriter
.
Before IRecordWriter.put(Record)
is called, the record is unbound from the buffer to which is associated, and its definition index
is re-set to the same value it had before.
Equivalent to calling IRecordWriter.importRecord(Record, int)
with the second parameter being equal to
Record.getDefinitionIndex()
. Used for convenience if this IRecordWriter
is associated with the same definitions as
the reader from which the record is originating
importRecord
in interface IRecordWriter<T extends Record>
record
- the Record
to import to the RecordWriter
IBuffer
has reached its capacity
GRS2Exception
- an error has occurredIRecordWriter.importRecord(Record)
public boolean importRecord(T record, long timeout, java.util.concurrent.TimeUnit unit) throws GRS2Exception
Record
from the underlying IBuffer
of a producer and stores it to the IBuffer
of
this RecordWriter
.
Before put(Record, long, TimeUnit)
is called, the record is unbound from the buffer to which is associated,
and its definition index is re-set to the same value it had before.
Equivalent to calling importRecord(Record, int, long, TimeUnit)
with the second parameter being equal to
Record.getDefinitionIndex()
. Used for convenience if this RecordWriter
is associated with the same definitions as
the reader from which the record is originating
importRecord
in interface IRecordWriter<T extends Record>
record
- the Record
to import to the RecordWriter
IBuffer
has reached its capacity and the timeout expired
GRS2Exception
- an error has occurredIRecordWriter.importRecord(Record, long, TimeUnit)
public boolean importRecord(T record, int newDefinitionIndex) throws GRS2Exception
Record
from the underlying IBuffer
of a producer and stores it to the IBuffer
of
this RecordWriter
.
Before put(Record)
is called, the record is unbound from the buffer to which is associated, and its definition index
is set to the supplied value
importRecord
in interface IRecordWriter<T extends Record>
record
- the Record
to import to this RecordWriter
newDefinitionIndex
- the definition index that the Record
will have in this RecordWriter
IBuffer
has reached its capacity
GRS2Exception
- an error has occurredIRecordWriter.importRecord(Record, int)
public boolean importRecord(T record, int newDefinitionIndex, long timeout, java.util.concurrent.TimeUnit unit) throws GRS2Exception
Record
from the underlying IBuffer
of a producer and stores it to the IBuffer
of
this RecordWriter
.
Before put(Record, long, TimeUnit)
is called, the record is unbound from the buffer to which is associated,
and its definition index is set to the supplied value
importRecord
in interface IRecordWriter<T extends Record>
record
- the Record
to import to this RecordWriter
newDefinitionIndex
- the definition index that the Record
will have in this RecordWriter
IBuffer
has reached its capacity and the timeout expired
GRS2Exception
- an error has occurredIRecordWriter.importRecord(Record, int, long, TimeUnit)
public void close() throws GRS2WriterException
Record
s can be added
close
in interface IRecordWriter<T extends Record>
GRS2WriterException
- the operation could not be completedIRecordWriter.close()
public void dispose()
IBuffer
, their resources will also be disposed
dispose
in interface IRecordWriter<T extends Record>
IRecordWriter.dispose()
public void emit(BufferEvent event) throws GRS2WriterException, GRS2WriterInvalidArgumentException
BufferEvent.EventSource.Writer
emit
in interface IRecordWriter<T extends Record>
event
- the event to send to the reader
GRS2WriterException
- the operation could not be completed
GRS2WriterInvalidArgumentException
- the event provided cannot be nullIRecordWriter.emit(BufferEvent)
public BufferEvent receive() throws GRS2WriterException
receive
in interface IRecordWriter<T extends Record>
GRS2WriterException
- the operation could not be completedIRecordWriter.receive()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |