LocalAPIManager Class Reference

#include <LocalAPIManager.hpp>

Public Types

enum  { MAX_CONNECTIONS = 3 }
 

Public Member Functions

 LocalAPIManager ()
 
 ~LocalAPIManager ()
 
void initProcess ()
 
void terminateProcess ()
 
void shutdownConnections ()
 
SessionID getSession ()
 
void getUserID (char *buffer)
 
void connectToAPIServer ()
 
void establishServerConnection ()
 
RexxReturnCode processServiceException (ServerManager t, ServiceException *e)
 
void shutdown ()
 
SysClientStreamgetConnection ()
 
void returnConnection (SysClientStream *)
 
void closeConnection (SysClientStream *connection)
 

Static Public Member Functions

static LocalAPIManagergetInstance ()
 
static void shutdownInstance ()
 

Public Attributes

LocalQueueManager queueManager
 
LocalRegistrationManager registrationManager
 
LocalMacroSpaceManager macroSpaceManager
 

Protected Attributes

bool restartRequired
 
bool connectionEstablished
 
SessionID session
 
char userid [MAX_USERID_LENGTH]
 
std::list< SysClientStream * > connections
 

Static Protected Attributes

static LocalAPIManagersingleInstance = NULL
 
static SysMutex messageLock
 

Detailed Description

Definition at line 54 of file LocalAPIManager.hpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
MAX_CONNECTIONS 

Definition at line 58 of file LocalAPIManager.hpp.

Constructor & Destructor Documentation

◆ LocalAPIManager()

LocalAPIManager::LocalAPIManager ( )
inline

Definition at line 62 of file LocalAPIManager.hpp.

References connectionEstablished, and session.

Referenced by getInstance().

◆ ~LocalAPIManager()

LocalAPIManager::~LocalAPIManager ( )
inline

Definition at line 68 of file LocalAPIManager.hpp.

Member Function Documentation

◆ closeConnection()

void LocalAPIManager::closeConnection ( SysClientStream connection)

Close a connection to the server.

Parameters
connectionThe connection to close.

Definition at line 329 of file LocalAPIManager.cpp.

References APIManager, CLOSE_CONNECTION, and ServiceMessage::writeMessage().

Referenced by shutdownConnections().

◆ connectToAPIServer()

void LocalAPIManager::connectToAPIServer ( )

◆ establishServerConnection()

void LocalAPIManager::establishServerConnection ( )

Ensure that the daemon process managing the API information is initialized and running before doing any API related activities.

Definition at line 213 of file LocalAPIManager.cpp.

References API_FAILURE, APIManager, CONNECTION_ACTIVE, connectionEstablished, ServiceMessage::parameter1, REXXAPI_VERSION, ClientMessage::send(), and SysLocalAPIManager::startServerProcess().

Referenced by getInstance(), and initProcess().

◆ getConnection()

SysClientStream * LocalAPIManager::getConnection ( )

Request a connection from the connection pool

Returns
An active connection to the data server.

Definition at line 272 of file LocalAPIManager.cpp.

References connections, messageLock, SysClientStream::open(), REXX_API_PORT, and SERVER_FAILURE.

Referenced by ClientMessage::send().

◆ getInstance()

LocalAPIManager * LocalAPIManager::getInstance ( )
static

Get the singleton instance of the local API manager.

Returns
The pointer to the created (and initialized) API manager.

Definition at line 54 of file LocalAPIManager.cpp.

References establishServerConnection(), initProcess(), LocalAPIManager(), messageLock, restartRequired, and singleInstance.

Referenced by LocalAPIContext::getAPIManager(), and ClientMessage::send().

◆ getSession()

SessionID LocalAPIManager::getSession ( )
inline

◆ getUserID()

void LocalAPIManager::getUserID ( char *  buffer)
inline

Definition at line 78 of file LocalAPIManager.hpp.

References userid.

Referenced by ClientMessage::send().

◆ initProcess()

void LocalAPIManager::initProcess ( )

◆ processServiceException()

RexxReturnCode LocalAPIManager::processServiceException ( ServerManager  t,
ServiceException e 
)

Process a service exception, with appropriate error handling.

Parameters
tThe context API manager.
eThe caught exception object.
Returns
The appropriate return value for the exception.

Definition at line 103 of file LocalAPIManager.cpp.

References APIManager, macroSpaceManager, MacroSpaceManager, LocalMacroSpaceManager::processServiceException(), LocalQueueManager::processServiceException(), LocalRegistrationManager::processServiceException(), queueManager, QueueManager, registrationManager, RegistrationManager, and RXAPI_MEMFAIL.

Referenced by LocalAPIContext::processServiceException().

◆ returnConnection()

void LocalAPIManager::returnConnection ( SysClientStream connection)

Return a connection after use.

Parameters
connectionThe returned connection.

Definition at line 302 of file LocalAPIManager.cpp.

References connections, SysClientStream::isClean(), MAX_CONNECTIONS, and messageLock.

Referenced by ClientMessage::send().

◆ shutdown()

void LocalAPIManager::shutdown ( )

Send the shutdown message to the API daemon.

Definition at line 348 of file LocalAPIManager.cpp.

References APIManager, ClientMessage::send(), and SHUTDOWN_SERVER.

◆ shutdownConnections()

void LocalAPIManager::shutdownConnections ( )

Perform connection cleanup after an interpreter instance stops

Definition at line 154 of file LocalAPIManager.cpp.

References closeConnection(), connectionEstablished, and connections.

Referenced by shutdownInstance(), and terminateProcess().

◆ shutdownInstance()

void LocalAPIManager::shutdownInstance ( )
static

Shutdown the instance of the API manager.

Definition at line 82 of file LocalAPIManager.cpp.

References messageLock, restartRequired, shutdownConnections(), and singleInstance.

Referenced by RexxDeleteSessionQueue().

◆ terminateProcess()

void LocalAPIManager::terminateProcess ( )

Member Data Documentation

◆ connectionEstablished

bool LocalAPIManager::connectionEstablished
protected

◆ connections

std::list<SysClientStream *> LocalAPIManager::connections
protected

Definition at line 95 of file LocalAPIManager.hpp.

Referenced by getConnection(), returnConnection(), and shutdownConnections().

◆ macroSpaceManager

LocalMacroSpaceManager LocalAPIManager::macroSpaceManager

Definition at line 100 of file LocalAPIManager.hpp.

Referenced by initProcess(), processServiceException(), and terminateProcess().

◆ messageLock

SysMutex LocalAPIManager::messageLock
staticprotected

Definition at line 90 of file LocalAPIManager.hpp.

Referenced by getConnection(), getInstance(), returnConnection(), and shutdownInstance().

◆ queueManager

LocalQueueManager LocalAPIManager::queueManager

Definition at line 98 of file LocalAPIManager.hpp.

Referenced by initProcess(), processServiceException(), and terminateProcess().

◆ registrationManager

LocalRegistrationManager LocalAPIManager::registrationManager

Definition at line 99 of file LocalAPIManager.hpp.

Referenced by initProcess(), processServiceException(), and terminateProcess().

◆ restartRequired

bool LocalAPIManager::restartRequired
protected

Definition at line 91 of file LocalAPIManager.hpp.

Referenced by getInstance(), initProcess(), and shutdownInstance().

◆ session

SessionID LocalAPIManager::session
protected

Definition at line 93 of file LocalAPIManager.hpp.

Referenced by getSession(), initProcess(), and LocalAPIManager().

◆ singleInstance

LocalAPIManager * LocalAPIManager::singleInstance = NULL
staticprotected

Definition at line 89 of file LocalAPIManager.hpp.

Referenced by getInstance(), and shutdownInstance().

◆ userid

char LocalAPIManager::userid[MAX_USERID_LENGTH]
protected

Definition at line 94 of file LocalAPIManager.hpp.

Referenced by getUserID(), and initProcess().


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