#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 () |
SysClientStream * | getConnection () |
void | returnConnection (SysClientStream *) |
void | closeConnection (SysClientStream *connection) |
Static Public Member Functions | |
static LocalAPIManager * | getInstance () |
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 LocalAPIManager * | singleInstance = NULL |
static SysMutex | messageLock |
Definition at line 54 of file LocalAPIManager.hpp.
anonymous enum |
Enumerator | |
---|---|
MAX_CONNECTIONS |
Definition at line 58 of file LocalAPIManager.hpp.
|
inline |
Definition at line 62 of file LocalAPIManager.hpp.
References connectionEstablished, and session.
Referenced by getInstance().
|
inline |
Definition at line 68 of file LocalAPIManager.hpp.
void LocalAPIManager::closeConnection | ( | SysClientStream * | connection | ) |
Close a connection to the server.
connection | The connection to close. |
Definition at line 329 of file LocalAPIManager.cpp.
References APIManager, CLOSE_CONNECTION, and ServiceMessage::writeMessage().
Referenced by shutdownConnections().
void LocalAPIManager::connectToAPIServer | ( | ) |
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().
SysClientStream * LocalAPIManager::getConnection | ( | ) |
Request a connection from the connection pool
Definition at line 272 of file LocalAPIManager.cpp.
References connections, messageLock, SysClientStream::open(), REXX_API_PORT, and SERVER_FAILURE.
Referenced by ClientMessage::send().
|
static |
Get the singleton instance of the local 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().
|
inline |
Definition at line 77 of file LocalAPIManager.hpp.
References session.
Referenced by LocalQueueManager::createNamedQueue(), LocalQueueManager::initializeLocal(), and ClientMessage::send().
|
inline |
Definition at line 78 of file LocalAPIManager.hpp.
References userid.
Referenced by ClientMessage::send().
void LocalAPIManager::initProcess | ( | ) |
Perform process-specific client API initialization.
Definition at line 174 of file LocalAPIManager.cpp.
References establishServerConnection(), SysProcess::getPid(), SysProcess::getUserID(), LocalAPISubsystem::initializeLocal(), LocalQueueManager::initializeLocal(), macroSpaceManager, queueManager, registrationManager, restartRequired, session, and userid.
Referenced by getInstance().
RexxReturnCode LocalAPIManager::processServiceException | ( | ServerManager | t, |
ServiceException * | e | ||
) |
Process a service exception, with appropriate error handling.
t | The context API manager. |
e | The caught exception object. |
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().
void LocalAPIManager::returnConnection | ( | SysClientStream * | connection | ) |
Return a connection after use.
connection | The returned connection. |
Definition at line 302 of file LocalAPIManager.cpp.
References connections, SysClientStream::isClean(), MAX_CONNECTIONS, and messageLock.
Referenced by ClientMessage::send().
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.
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().
|
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().
void LocalAPIManager::terminateProcess | ( | ) |
Perform process termination cleanup.
Definition at line 136 of file LocalAPIManager.cpp.
References macroSpaceManager, queueManager, registrationManager, shutdownConnections(), LocalAPISubsystem::terminateProcess(), and LocalQueueManager::terminateProcess().
|
protected |
Definition at line 92 of file LocalAPIManager.hpp.
Referenced by establishServerConnection(), LocalAPIManager(), and shutdownConnections().
|
protected |
Definition at line 95 of file LocalAPIManager.hpp.
Referenced by getConnection(), returnConnection(), and shutdownConnections().
LocalMacroSpaceManager LocalAPIManager::macroSpaceManager |
Definition at line 100 of file LocalAPIManager.hpp.
Referenced by initProcess(), processServiceException(), and terminateProcess().
|
staticprotected |
Definition at line 90 of file LocalAPIManager.hpp.
Referenced by getConnection(), getInstance(), returnConnection(), and shutdownInstance().
LocalQueueManager LocalAPIManager::queueManager |
Definition at line 98 of file LocalAPIManager.hpp.
Referenced by initProcess(), processServiceException(), and terminateProcess().
LocalRegistrationManager LocalAPIManager::registrationManager |
Definition at line 99 of file LocalAPIManager.hpp.
Referenced by initProcess(), processServiceException(), and terminateProcess().
|
protected |
Definition at line 91 of file LocalAPIManager.hpp.
Referenced by getInstance(), initProcess(), and shutdownInstance().
|
protected |
Definition at line 93 of file LocalAPIManager.hpp.
Referenced by getSession(), initProcess(), and LocalAPIManager().
|
staticprotected |
Definition at line 89 of file LocalAPIManager.hpp.
Referenced by getInstance(), and shutdownInstance().
|
protected |
Definition at line 94 of file LocalAPIManager.hpp.
Referenced by getUserID(), and initProcess().