RecordBuffer
with a mode of
SUBSCRIPTION
or HISTORY_SUBSCRIPTION
.@Deprecated public class SubscriptionBuffer extends Object implements SubscriptionConsumer, SubscriptionProvider, SubscriptionIterator, SubscriptionVisitor
SubscriptionBuffer
class is an universal buffer for subscription,
able to receive and retrieve subscription via all appropriate interfaces and via
random access. It uses cyclic buffers for efficient subscription storage.
NOTE: the SubscriptionBuffer
is not thread-safe;
it is designed to be used in a single-thread mode.
Modifier and Type | Field and Description |
---|---|
static SubscriptionBuffer |
VOID
Deprecated.
Many cases in code that use to this object do not need it any more. Double-check first.
If really needed, then use
SubscriptionVisitor.VOID ,
SubscriptionIterator.VOID ,
SubscriptionConsumer.VOID , or
SubscriptionListener.VOID . |
Constructor and Description |
---|
SubscriptionBuffer()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Deprecated.
Clears this subscription buffer.
|
protected static void |
copy(Object src,
Object dst,
int head,
int tail,
int length)
Deprecated.
Copies cyclic array buffer from source to destination.
|
protected void |
ensureCapacity(DataRecord record)
Deprecated.
Ensures that this buffer has capacity to visit and store specified record.
|
void |
examineRecord(int index,
SubscriptionVisitor visitor)
Deprecated.
Examines record by its index within this buffer via specivied visitor.
|
boolean |
examineSubscription(SubscriptionVisitor visitor)
Deprecated.
Examines accumulated subscription via specified subscription visitor.
|
SubscriptionIterator |
examiningIterator()
Deprecated.
Returns subscription iterator that examines this subscription buffer.
|
int |
getCipher()
Deprecated.
Returns cipher for the current record returned by last call to
SubscriptionIterator.nextRecord() . |
int |
getCipher(int index)
Deprecated.
Returns cipher of the record by its index within this buffer.
|
DataRecord |
getRecord(int index)
Deprecated.
Returns record by its index within this buffer.
|
String |
getSymbol()
Deprecated.
Returns symbol for the current record returned by last call to
SubscriptionIterator.nextRecord() . |
String |
getSymbol(int index)
Deprecated.
Returns symbol of the record by its index within this buffer.
|
long |
getTime()
Deprecated.
Returns time for the current record returned by last call to
SubscriptionIterator.nextRecord() . |
long |
getTime(int index)
Deprecated.
Returns time of the record by its index within this buffer.
|
boolean |
hasCapacity()
Deprecated.
Returns whether visitor has capacity to efficiently visit next record.
|
boolean |
isEmpty()
Deprecated.
Returns
true if this subscription buffer has no records. |
DataRecord |
nextRecord()
Deprecated.
Returns next record.
|
protected void |
notifyListener()
Deprecated.
Notifies subscription listener used in
SubscriptionProvider part
of this subscription buffer. |
static boolean |
process(SubscriptionIterator iterator,
SubscriptionVisitor visitor)
Deprecated.
|
void |
processSubscription(SubscriptionIterator iterator)
Deprecated.
Processes subscription from specified subscription iterator.
|
boolean |
retrieveSubscription(SubscriptionVisitor visitor)
Deprecated.
Retrieves accumulated subscription into specified subscription visitor.
|
void |
setSubscriptionListener(SubscriptionListener listener)
Deprecated.
Sets new subscription listener to receive notifications about subscription.
|
int |
size()
Deprecated.
Returns number of records in this subscription buffer.
|
void |
visitRecord(DataRecord record,
int cipher,
String symbol)
Deprecated.
Visits next record using
time = 0 . |
void |
visitRecord(DataRecord record,
int cipher,
String symbol,
long time)
Deprecated.
Visits next record.
|
public static final SubscriptionBuffer VOID
SubscriptionVisitor.VOID
,
SubscriptionIterator.VOID
,
SubscriptionConsumer.VOID
, or
SubscriptionListener.VOID
.public static boolean process(SubscriptionIterator iterator, SubscriptionVisitor visitor)
RecordBuffer.retrieveSubscription(SubscriptionVisitor)
or
LegacyIteratorUtils.processSubscription(SubscriptionIterator, SubscriptionVisitor)
as last resort.true
if some subscription may still remain in
the iterator or false
if all subscription were processed.public int size()
public boolean isEmpty()
true
if this subscription buffer has no records.public void clear()
public int getCipher(int index)
IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index >= size()).public String getSymbol(int index)
IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index >= size()).public long getTime(int index)
IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index >= size()).public DataRecord getRecord(int index)
IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index >= size()).public void examineRecord(int index, SubscriptionVisitor visitor)
NOTE: unlike bulk transfer methods, this method does not check
SubscriptionVisitor.hasCapacity()
method of specified visitor.
IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index >= size()).public boolean examineSubscription(SubscriptionVisitor visitor)
true
if not all accumulated subscription were examined
or false
if all accumulated subscription were examined.public SubscriptionIterator examiningIterator()
NOTE: returned iterator possesses no special protection against concurrent modifications of this buffer and it will fail in unexpected way in such event; it should be used up before any such modifications.
public void processSubscription(SubscriptionIterator iterator)
SubscriptionConsumer
processSubscription
in interface SubscriptionConsumer
public boolean retrieveSubscription(SubscriptionVisitor visitor)
SubscriptionProvider
true
if some subscription still remains in the provider
or false
if all accumulated subscription were retrieved.retrieveSubscription
in interface SubscriptionProvider
public void setSubscriptionListener(SubscriptionListener listener)
SubscriptionProvider
null
to set empty subscription listener (no notifications).
NOTE: if there is accumulated subscription available, then specified listener will be notified by this method.
setSubscriptionListener
in interface SubscriptionProvider
public int getCipher()
SubscriptionIterator
SubscriptionIterator.nextRecord()
.
Returns 0 if not encoded or if no current record is being iterated.getCipher
in interface SubscriptionIterator
public String getSymbol()
SubscriptionIterator
SubscriptionIterator.nextRecord()
.
Returns null if encoded or if no current record is being iterated.getSymbol
in interface SubscriptionIterator
public long getTime()
SubscriptionIterator
SubscriptionIterator.nextRecord()
.
Returns 0 if not historical or if no current record is being iterated.getTime
in interface SubscriptionIterator
public DataRecord nextRecord()
SubscriptionIterator
nextRecord
in interface SubscriptionIterator
public boolean hasCapacity()
SubscriptionVisitor
NOTE: subscription visitor must process all subscription that is passed to it via visitXXX calls no matter whether it has capacity to do it efficiently.
hasCapacity
in interface SubscriptionVisitor
public void visitRecord(DataRecord record, int cipher, String symbol, long time)
SubscriptionVisitor
visitRecord
in interface SubscriptionVisitor
public void visitRecord(DataRecord record, int cipher, String symbol)
time = 0
.protected void notifyListener()
SubscriptionProvider
part
of this subscription buffer. Does not check actual subscription availability.protected void ensureCapacity(DataRecord record)
Copyright © 2002–2025 Devexperts LLC. All rights reserved.