Qorus Integration Engine®  4.0.3.p1_git
OMQ::AbstractParallelStream Class Referenceabstract

common base class for streams using a background thread for socket I/O More...

Inheritance diagram for OMQ::AbstractParallelStream:
Qore::Thread::AbstractThreadResource OMQ::AbstractParallelReceiveStream OMQ::AbstractParallelWriteStream OMQ::DbRemoteReceive OMQ::DbRemoteSend OMQ::FsRemoteSend

Public Member Methods

 destructor ()
 wait for any I/O in progress to complete
 
nothing cleanupBase ()
 called by child classes when the thread resource is still allocated and the thread exits or one of Qore::throw_thread_resource_exceptions() or Qore::throw_thread_resource_exceptions_to_mark() is called
 
private waitIoComplete ()
 waits for the I/O thread to complete and returns
 
private markIoInProgress ()
 marks the current connection as in progress; must be already checked beforehand that it's not in progress
 
private markIoComplete ()
 performs thread cleanup on the background I/O thread if any is registered and running
 
OMQ::StreamInfo getInfo ()
 returns performance information about the stream
 
private checkError (string cmd)
 checks for an error in the background send thread; if there is one, then rethrows the exception in the main application / data thread
 
private startStream ()
 opens the remote transaction by calling startStreamImpl() and starts the background I/O socket thread More...
 
private socketThread (*ThreadLocalData my_tld)
 sets up thread-local data if possible and calls socketThreadImpl() that implements the background socket I/O for the object
 
private abortIo (string reason)
 signals the end of queue operations
 
private bool abortIoWait (string reason)
 signals the end of queue operations and waits until the socket thread terminates More...
 
private beginTransaction (OMQ::DbStreamConfig m_config)
 starts or continues a remote transaction
 
private commit (OMQ::DbStreamConfig m_config)
 commits a remote transaction
 
private rollback (OMQ::DbStreamConfig m_config)
 rolls back a remote transaction
 
abstract OMQ::StreamConfig config ()
 returns the configuration object
 

Static Public Member Methods

static staticCleanup ()
 performs static thread resource cleanup on I/O thread resources
 
static checkStream (QorusSystemRestHelper helper, string op)
 checks if there is a stream operation running in the background, if so, a user-friendly exception is thrown
 
static beginTransaction (QorusSystemRestHelper remote, string datasource, *timeout timeout_ms, *reference info)
 starts a transaction in a remote datasource More...
 

Public Attributes

const DO_DISCONNECT = True
 A constant for rollback() methods to perform real disconnect.
 
const DONT_DISCONNECT = False
 A constant for rollback() methods to keep the network connection alive.
 

Private Member Methods

Qore::Thread::Counter cnt ()
 confirmation counter for the socket I/O thread
 
OMQ::StreamInfo m_info ()
 stream information
 
abstract socketThreadImpl ()
 this method implements the background thread that handles the actual DataStream socket sends
 
abstract startStreamImpl ()
 opens the remote transaction before starting the background I/O socket thread
 

Private Attributes

Qore::Thread::Queue dataq
 Queue for the socket I/O thread.
 
*hash thread_ex
 exception info for send thread to communicate errors to the primary data thread
 
string objid
 stream object identifier
 
const StreamTerminatedError = "STREAM-TERMINATED"
 stream terminated error
 
const ThreadKey = "_STREAM_"
 thread-local data key
 

Detailed Description

common base class for streams using a background thread for socket I/O

Member Function Documentation

◆ abortIoWait()

private bool OMQ::AbstractParallelStream::abortIoWait ( string  reason)

signals the end of queue operations and waits until the socket thread terminates

Parameters
reasonthe reason for aborting the I/O thread
Returns
True if there was I/O still in progress, False if not

◆ beginTransaction()

static OMQ::AbstractParallelStream::beginTransaction ( QorusSystemRestHelper  remote,
string  datasource,
*timeout  timeout_ms,
*reference  info 
)
static

starts a transaction in a remote datasource

Example:
AbstractParallelStream::beginTransaction(remote, dsname);
Parameters
remotea OMQ::QorusSystemRestHelper object
datasourcethe name of the datasource in the remote server
timeout_msan optional timeout value in milliseconds for HTTP communication
infoan optional reference to an lvalue that will be used as an output variable giving a hash of request headers and other information about the HTTP request

The "Qorus-Connection: Continue-Persistent" header is sent with the call so that a new transaction is started or any transaction in progress is continued

◆ startStream()

private OMQ::AbstractParallelStream::startStream ( )

opens the remote transaction by calling startStreamImpl() and starts the background I/O socket thread

Exceptions
STREAM-ERRORif the same remote connection object is already active with a remote stream, this exception is thrown

The documentation for this class was generated from the following file: