java.lang.Object
convex.peer.AThreadedComponent
convex.peer.TransactionHandler
Server component for handling client transactions and producing Blocks
Main loop for this component handles client transaction messages, validates them and
prepares them for inclusion in a Block
-
Field Summary
FieldsModifier and TypeFieldDescriptionlongprotected longTime at which last Block was published by this Peerlongprotected final ArrayBlockingQueue<Message> Queue for incoming (unverified) transaction messagesFields inherited from class convex.peer.AThreadedComponent
server, thread -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintprotected Stringbooleanprotected voidloop()Loops for handling incoming client transactionsprotected SignedData<Block>[]Gets the next Blocks for publication, or null if nothing to publish Checks for pending transactions, and if found propose them as new Block(s).voidmaybeReportTransactions(Peer peer) booleanOffer a transaction for handlingprotected voidvoidsetRequestObserver(Consumer<SignedData<ATransaction>> observer) Sets a request observer, which will be called whenever the Peer processes a valid client transaction requestvoidsetResponseObserver(BiConsumer<SignedData<ATransaction>, Result> observer) Sets a request observer, which will be called whenever the Peer processes a valid client transaction requestvoidstart()Start the threaded componentMethods inherited from class convex.peer.AThreadedComponent
close, getLoad
-
Field Details
-
txMessageQueue
Queue for incoming (unverified) transaction messages -
clientTransactionCount
public long clientTransactionCount -
receivedTransactionCount
public long receivedTransactionCount -
lastBlockPublishedTime
protected long lastBlockPublishedTimeTime at which last Block was published by this Peer
-
-
Constructor Details
-
TransactionHandler
-
-
Method Details
-
offerTransaction
Offer a transaction for handling- Parameters:
m- Message offered- Returns:
- True if queued for handling, false otherwise
-
processMessage
- Throws:
InterruptedException
-
setRequestObserver
Sets a request observer, which will be called whenever the Peer processes a valid client transaction request- Parameters:
observer- Consumer to receive observed transaction
-
maybeReportTransactions
-
setResponseObserver
Sets a request observer, which will be called whenever the Peer processes a valid client transaction request- Parameters:
observer- Consumer to receive observed transaction
-
maybeGenerateBlocks
Gets the next Blocks for publication, or null if nothing to publish Checks for pending transactions, and if found propose them as new Block(s).- Returns:
- New signed Block, or null if nothing to publish yet
-
start
public void start()Description copied from class:AThreadedComponentStart the threaded component- Overrides:
startin classAThreadedComponent
-
isAwaitingResults
public boolean isAwaitingResults() -
countInterests
public int countInterests() -
loop
Loops for handling incoming client transactions- Specified by:
loopin classAThreadedComponent- Throws:
InterruptedException
-
getThreadName
- Specified by:
getThreadNamein classAThreadedComponent
-