Package convex.peer
Class TransactionHandler
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 TypeFieldDescriptionprotected longTime at which last Block was published by this Peerprotected final ArrayBlockingQueue<Message>Queue for incoming (unverified) transaction messagesFields inherited from class convex.peer.AThreadedComponent
server, thread -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close this threaded component, including interrupting any running thread(s).intprotected Stringbooleanprotected voidloop()Loops for handling incoming client transactionsprotected SignedData<Block>maybeGenerateBlock(Peer peer) Checks for pending transactions, and if found propose them as a new Block.Gets the next Block for publication, or null if not yet readyvoidmaybeReportTransactions(Peer peer) booleanOffer a transaction for handlingprotected voidvoidstart()Start the threaded componentMethods inherited from class convex.peer.AThreadedComponent
finalize, getLoad
-
Field Details
-
txMessageQueue
Queue for incoming (unverified) transaction messages -
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
-
maybeReportTransactions
-
maybeGenerateBlock
Checks for pending transactions, and if found propose them as a new Block.- Returns:
- New signed Block, or null if nothing to publish yet
-
maybeGetBlock
Gets the next Block for publication, or null if not yet ready- Returns:
- New Block, or null if not yet produced
-
close
public void close()Description copied from class:AThreadedComponentClose this threaded component, including interrupting any running thread(s). Subclasses may override, but should call `super.close()` to close the main thread- Overrides:
closein classAThreadedComponent
-
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
-