You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jb...@apache.org on 2017/06/06 17:56:32 UTC
[06/23] geode-native git commit: GEODE-2741: Code cleanup to move to
std::shared_ptr
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/TcrEndpoint.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/TcrEndpoint.cpp b/src/cppcache/src/TcrEndpoint.cpp
index 24c3283..4458930 100644
--- a/src/cppcache/src/TcrEndpoint.cpp
+++ b/src/cppcache/src/TcrEndpoint.cpp
@@ -193,10 +193,10 @@ GfErrType TcrEndpoint::createNewConnection(
"m_needToConnectInLock=%d appThreadRequest =%d",
connectTimeout, m_needToConnectInLock, appThreadRequest);
GfErrType err = GF_NOERR;
- newConn = NULL;
+ newConn = nullptr;
while (timeoutRetries-- >= 0) {
try {
- if (newConn == NULL) {
+ if (newConn == nullptr) {
if (!needtoTakeConnectLock() || !appThreadRequest) {
newConn = new TcrConnection(m_connected);
bool authenticate = newConn->InitTcrConnection(
@@ -274,7 +274,7 @@ GfErrType TcrEndpoint::createNewConnection(
break;
}
}
- if (err != GF_NOERR && newConn != NULL) {
+ if (err != GF_NOERR && newConn != nullptr) {
GF_SAFE_DELETE(newConn);
}
return err;
@@ -454,7 +454,7 @@ GfErrType TcrEndpoint::registerDM(bool clientNotification, bool isSecondary,
if (m_connected || connected) {
if (clientNotification) {
- if (distMgr != NULL) {
+ if (distMgr != nullptr) {
ACE_Guard<ACE_Recursive_Thread_Mutex> guardDistMgrs(m_distMgrsLock);
m_distMgrs.push_back(distMgr);
}
@@ -496,7 +496,7 @@ GfErrType TcrEndpoint::registerDM(bool clientNotification, bool isSecondary,
int numConnections = m_opConnections.size();
if (!m_isActiveEndpoint && !isActiveEndpoint && m_connected &&
(numConnections != 1 || m_numRegionListener <= 0 ||
- m_notifyReceiver == NULL)) {
+ m_notifyReceiver == nullptr)) {
LOGWARN(
"Inactive connected endpoint does not have exactly one "
"connection. Number of connections: %d, number of region listeners: "
@@ -523,7 +523,7 @@ void TcrEndpoint::unregisterDM(bool clientNotification,
}
LOGFINEST("Decremented subscription region count for endpoint %s to %d",
m_name.c_str(), m_numRegionListener);
- if (distMgr != NULL) {
+ if (distMgr != nullptr) {
ACE_Guard<ACE_Recursive_Thread_Mutex> guardDistMgrs(m_distMgrsLock);
m_distMgrs.remove(distMgr);
}
@@ -540,10 +540,10 @@ void TcrEndpoint::pingServer(ThinClientPoolDM* poolDM) {
if (!m_msgSent && !m_pingSent) {
TcrMessagePing* pingMsg = TcrMessage::getPingMessage();
- TcrMessageReply reply(true, NULL);
+ TcrMessageReply reply(true, nullptr);
LOGFINEST("Sending ping message to endpoint %s", m_name.c_str());
GfErrType error;
- if (poolDM != NULL) {
+ if (poolDM != nullptr) {
error = poolDM->sendRequestToEP(*pingMsg, reply, this);
} else {
error = send(*pingMsg, reply);
@@ -586,7 +586,7 @@ int TcrEndpoint::receiveNotification(volatile bool& isRunning) {
LOGFINE("Started subscription channel for endpoint %s", m_name.c_str());
while (isRunning) {
- TcrMessageReply* msg = NULL;
+ TcrMessageReply* msg = nullptr;
try {
size_t dataLen;
ConnErrType opErr = CONN_NOERR;
@@ -610,11 +610,11 @@ int TcrEndpoint::receiveNotification(volatile bool& isRunning) {
}
if (data) {
- msg = new TcrMessageReply(true, NULL);
+ msg = new TcrMessageReply(true, nullptr);
msg->initCqMap();
msg->setData(data, static_cast<int32_t>(dataLen),
this->getDistributedMemberID());
- data = NULL; // memory is released by TcrMessage setData().
+ data = nullptr; // memory is released by TcrMessage setData().
handleNotificationStats(static_cast<int64_t>(dataLen));
LOGDEBUG("receive notification %d", msg->getMessageType());
@@ -789,7 +789,7 @@ GfErrType TcrEndpoint::sendRequestConn(const TcrMessage& request,
m_name.c_str(), conn);
// TcrMessage * req = const_cast<TcrMessage *>(&request);
LOGDEBUG("TcrEndpoint::sendRequestConn = %d", m_baseDM);
- if (m_baseDM != NULL) m_baseDM->beforeSendingRequest(request, conn);
+ if (m_baseDM != nullptr) m_baseDM->beforeSendingRequest(request, conn);
if (((type == TcrMessage::EXECUTE_FUNCTION ||
type == TcrMessage::EXECUTE_REGION_FUNCTION) &&
(request.hasResult() & 2))) {
@@ -875,7 +875,8 @@ GfErrType TcrEndpoint::sendRequestConn(const TcrMessage& request,
error = GF_NOTCON;
}
if (error == GF_NOERR) {
- if (m_baseDM != NULL) m_baseDM->afterSendingRequest(request, reply, conn);
+ if (m_baseDM != nullptr)
+ m_baseDM->afterSendingRequest(request, reply, conn);
}
return error;
@@ -916,8 +917,9 @@ GfErrType TcrEndpoint::sendRequestWithRetry(
LOGFINE(
"Creating a new connection when connection-pool-size system "
"property set to 0");
- if ((error = createNewConnection(
- conn, false, false, DistributedSystem::getSystemProperties()
+ if ((error =
+ createNewConnection(conn, false, false,
+ DistributedSystem::getSystemProperties()
->connectTimeout())) != GF_NOERR) {
epFailure = true;
continue;
@@ -940,7 +942,7 @@ GfErrType TcrEndpoint::sendRequestWithRetry(
epFailure = true;
continue;
}
- } else if (conn == NULL && useEPPool) {
+ } else if (conn == nullptr && useEPPool) {
LOGFINER(
"sendRequestWithRetry:: looking for connection in queue timeout = "
"%d ",
@@ -951,7 +953,7 @@ GfErrType TcrEndpoint::sendRequestWithRetry(
if (!m_connected) {
return GF_NOTCON;
}
- if (conn != NULL) {
+ if (conn != nullptr) {
LOGDEBUG("TcrEndpoint::send() obtained a connection for endpoint %s",
m_name.c_str());
int reqTransId = request.getTransId();
@@ -1110,7 +1112,7 @@ GfErrType TcrEndpoint::send(const TcrMessage& request, TcrMessageReply& reply) {
uint32_t requestedTimeout = reply.getTimeout();
setRetryAndTimeout(request, maxSendRetries, requestedTimeout);
- TcrConnection* conn = NULL;
+ TcrConnection* conn = nullptr;
bool epFailure;
std::string failReason;
// TODO: remove sendRetryCount as parameter.
@@ -1226,7 +1228,7 @@ void TcrEndpoint::closeConnections() {
/*
void TcrEndpoint::sendNotificationCloseMsg()
{
- if (m_notifyConnection != NULL) {
+ if (m_notifyConnection != nullptr) {
m_notifyReceiver->stop();
m_notifyConnection->close();
}
@@ -1250,7 +1252,7 @@ void TcrEndpoint::closeNotification() {
}
void TcrEndpoint::stopNoBlock() {
- if (m_notifyReceiver != NULL) {
+ if (m_notifyReceiver != nullptr) {
m_notifyConnection->close();
m_notifyReceiver->stopNoblock();
}
@@ -1260,7 +1262,7 @@ void TcrEndpoint::stopNotifyReceiverAndCleanup() {
LOGFINER("Stopping subscription receiver and cleaning up");
ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_notifyReceiverLock);
- if (m_notifyReceiver != NULL) {
+ if (m_notifyReceiver != nullptr) {
LOGFINER("Waiting for notification thread...");
// m_notifyReceiver->stopNoblock();
m_notifyReceiver->wait();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/TcrEndpoint.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/TcrEndpoint.hpp b/src/cppcache/src/TcrEndpoint.hpp
index 77ab3ab..aa7ecb7 100644
--- a/src/cppcache/src/TcrEndpoint.hpp
+++ b/src/cppcache/src/TcrEndpoint.hpp
@@ -46,7 +46,7 @@ class CPPCACHE_EXPORT TcrEndpoint {
TcrEndpoint(
const std::string& name, CacheImpl* cache, ACE_Semaphore& failoverSema,
ACE_Semaphore& cleanupSema, ACE_Semaphore& redundancySema,
- ThinClientBaseDM* dm = NULL,
+ ThinClientBaseDM* dm = nullptr,
bool isMultiUserMode = false); // TODO: need to look for endpoint case
/* adongre
@@ -57,15 +57,15 @@ class CPPCACHE_EXPORT TcrEndpoint {
virtual GfErrType registerDM(bool clientNotification,
bool isSecondary = false,
bool isActiveEndpoint = false,
- ThinClientBaseDM* distMgr = NULL);
+ ThinClientBaseDM* distMgr = nullptr);
// GfErrType registerPoolDM( bool isSecondary, ThinClientPoolHADM* poolDM );
virtual void unregisterDM(bool clientNotification,
- ThinClientBaseDM* distMgr = NULL,
+ ThinClientBaseDM* distMgr = nullptr,
bool checkQueueHosted = false);
// void unregisterPoolDM( );
- void pingServer(ThinClientPoolDM* poolDM = NULL);
+ void pingServer(ThinClientPoolDM* poolDM = nullptr);
int receiveNotification(volatile bool& isRunning);
GfErrType send(const TcrMessage& request, TcrMessageReply& reply);
GfErrType sendRequestConn(const TcrMessage& request, TcrMessageReply& reply,
@@ -116,7 +116,7 @@ class CPPCACHE_EXPORT TcrEndpoint {
virtual bool isMultiUserMode();
/*{
- if(m_baseDM != NULL)
+ if(m_baseDM != nullptr)
return this->m_baseDM->isMultiUserMode();
else
return false;
@@ -158,7 +158,7 @@ class CPPCACHE_EXPORT TcrEndpoint {
uint32_t connectTimeout);
void setConnected(volatile bool connected = true) { m_connected = connected; }
- virtual ThinClientPoolDM* getPoolHADM() { return NULL; }
+ virtual ThinClientPoolDM* getPoolHADM() { return nullptr; }
bool isQueueHosted();
ACE_Recursive_Thread_Mutex& getQueueHostedMutex() {
return m_notifyReceiverLock;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/TcrHADistributionManager.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/TcrHADistributionManager.cpp b/src/cppcache/src/TcrHADistributionManager.cpp
index bec944d..2a50a52 100644
--- a/src/cppcache/src/TcrHADistributionManager.cpp
+++ b/src/cppcache/src/TcrHADistributionManager.cpp
@@ -32,7 +32,7 @@ TcrHADistributionManager::TcrHADistributionManager(
: ThinClientDistributionManager(connManager, theRegion),
m_cacheAttributes(cacheAttributes),
m_theTcrConnManager(connManager) {
- GF_R_ASSERT(theRegion != NULL);
+ GF_R_ASSERT(theRegion != nullptr);
}
void TcrHADistributionManager::init() {
@@ -86,7 +86,7 @@ GfErrType TcrHADistributionManager::sendSyncRequestRegisterInterestEP(
TcrMessage& request, TcrMessageReply& reply, bool attemptFailover,
TcrEndpoint* endpoint) {
return ThinClientBaseDM::sendSyncRequestRegisterInterest(
- request, reply, attemptFailover, NULL, endpoint);
+ request, reply, attemptFailover, nullptr, endpoint);
}
GfErrType TcrHADistributionManager::sendSyncRequestRegisterInterest(
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/TcrHADistributionManager.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/TcrHADistributionManager.hpp b/src/cppcache/src/TcrHADistributionManager.hpp
index 39384bd..61817c6 100644
--- a/src/cppcache/src/TcrHADistributionManager.hpp
+++ b/src/cppcache/src/TcrHADistributionManager.hpp
@@ -68,7 +68,7 @@ class CPPCACHE_EXPORT TcrHADistributionManager
protected:
virtual GfErrType sendSyncRequestRegisterInterest(
TcrMessage& request, TcrMessageReply& reply, bool attemptFailover = true,
- ThinClientRegion* region = NULL, TcrEndpoint* endpoint = NULL);
+ ThinClientRegion* region = nullptr, TcrEndpoint* endpoint = nullptr);
virtual GfErrType sendSyncRequestCq(TcrMessage& request,
TcrMessageReply& reply);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/TcrMessage.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/TcrMessage.cpp b/src/cppcache/src/TcrMessage.cpp
index d20b40a..cfba9c7 100644
--- a/src/cppcache/src/TcrMessage.cpp
+++ b/src/cppcache/src/TcrMessage.cpp
@@ -42,16 +42,16 @@ uint32_t g_headerLen = 17;
} // namespace
// AtomicInc TcrMessage::m_transactionId = 0;
-TcrMessagePing* TcrMessage::m_pingMsg = NULL;
-TcrMessage* TcrMessage::m_closeConnMsg = NULL;
-TcrMessage* TcrMessage::m_allEPDisconnected = NULL;
-uint8_t* TcrMessage::m_keepalive = NULL;
+TcrMessagePing* TcrMessage::m_pingMsg = nullptr;
+TcrMessage* TcrMessage::m_closeConnMsg = nullptr;
+TcrMessage* TcrMessage::m_allEPDisconnected = nullptr;
+uint8_t* TcrMessage::m_keepalive = nullptr;
const int TcrMessage::m_flag_empty = 0x01;
const int TcrMessage::m_flag_concurrency_checks = 0x02;
bool TcrMessage::init() {
bool ret = true;
- if (m_pingMsg == NULL) {
+ if (m_pingMsg == nullptr) {
try {
m_pingMsg = new TcrMessagePing(true);
m_closeConnMsg = new TcrMessageCloseConnection(true);
@@ -67,8 +67,8 @@ bool TcrMessage::init() {
LOGERROR("unknown exception");
}
}
- if (m_allEPDisconnected == NULL) {
- m_allEPDisconnected = new TcrMessageReply(true, NULL);
+ if (m_allEPDisconnected == nullptr) {
+ m_allEPDisconnected = new TcrMessageReply(true, nullptr);
}
return ret;
}
@@ -85,7 +85,7 @@ TcrMessage* TcrMessage::getAllEPDisMess() { return m_allEPDisconnected; }
TcrMessage* TcrMessage::getCloseConnMessage() { return m_closeConnMsg; }
void TcrMessage::setKeepAlive(bool keepalive) {
- if (TcrMessage::m_keepalive != NULL) {
+ if (TcrMessage::m_keepalive != nullptr) {
*TcrMessage::m_keepalive = keepalive ? 1 : 0;
}
}
@@ -558,7 +558,7 @@ bool TcrMessage::readExceptionPart(DataInput& input, uint8_t isLastChunk,
void TcrMessage::writeObjectPart(const SerializablePtr& se, bool isDelta,
bool callToData,
const VectorOfCacheableKey* getAllKeyList) {
- // no NULL check since for some messages NULL object may be valid
+ // no nullptr check since for some messages nullptr object may be valid
uint32_t size = 0;
m_request->writeInt(
static_cast<int32_t>(size)); // write a dummy size of 4 bytes.
@@ -605,11 +605,10 @@ void TcrMessage::writeObjectPart(const SerializablePtr& se, bool isDelta,
deltaPtr->toDelta(*m_request);
} else if (isObject) {
if (!callToData) {
- if (getAllKeyList != NULL) {
+ if (getAllKeyList != nullptr) {
int8_t typeId = GeodeTypeIds::CacheableObjectArray;
m_request->write(typeId);
- int32_t len = getAllKeyList->size();
- m_request->writeArrayLen(len);
+ m_request->writeArrayLen(static_cast<int32_t>(getAllKeyList->size()));
m_request->write(static_cast<int8_t>(GeodeTypeIdsImpl::Class));
m_request->write(
static_cast<int8_t>(GeodeTypeIds::CacheableASCIIString));
@@ -652,7 +651,7 @@ void TcrMessage::readInt(uint8_t* buffer, uint32_t* value) {
void TcrMessage::writeBytesOnly(const SerializablePtr& se) {
uint32_t cBufferLength = m_request->getBufferLength();
- uint8_t* startBytes = NULL;
+ uint8_t* startBytes = nullptr;
m_request->writeObject(se);
uint8_t* cursor =
const_cast<uint8_t*>(m_request->getBuffer()) + cBufferLength;
@@ -693,7 +692,7 @@ void TcrMessage::writeHeader(uint32_t msgType, uint32_t numOfParts) {
int8_t earlyAck = 0x0;
LOGDEBUG("TcrMessage::writeHeader m_isMetaRegion = %d", m_isMetaRegion);
- if (m_tcdm != NULL) {
+ if (m_tcdm != nullptr) {
if ((isSecurityOn =
(m_tcdm->isSecurityOn() &&
TcrMessage::isUserInitiativeOps(*this) && !m_isMetaRegion))) {
@@ -709,7 +708,7 @@ void TcrMessage::writeHeader(uint32_t msgType, uint32_t numOfParts) {
// 4) offset.
m_request->writeInt(static_cast<int32_t>(numOfParts));
TXState* txState = TSSTXStateWrapper::s_geodeTSSTXState->getTXState();
- if (txState == NULL) {
+ if (txState == nullptr) {
m_txId = -1;
} else {
m_txId = txState->getTransactionId()->getId();
@@ -775,7 +774,7 @@ void TcrMessage::startProcessChunk(ACE_Semaphore& finalizeSema) {
m_msgTypeRequest == TcrMessage::MONITORCQ_MSG_TYPE) {
return;
}
- if (m_chunkedResult == NULL) {
+ if (m_chunkedResult == nullptr) {
throw FatalInternalException(
"TcrMessage::startProcessChunk: null "
"result processor!");
@@ -836,7 +835,7 @@ void TcrMessage::processChunk(const uint8_t* bytes, int32_t len,
this->m_isLastChunkAndisSecurityHeader = isLastChunkAndisSecurityHeader;
handleSpecialFECase();
- if (m_tcdm == NULL) {
+ if (m_tcdm == nullptr) {
throw FatalInternalException("TcrMessage::processChunk: null DM!");
}
@@ -863,7 +862,7 @@ void TcrMessage::processChunk(const uint8_t* bytes, int32_t len,
bytes, len, m_chunkedResult, isLastChunkAndisSecurityHeader);
m_chunkedResult->setEndpointMemId(endpointmemId);
m_tcdm->queueChunk(chunk);
- if (bytes == NULL) {
+ if (bytes == nullptr) {
// last chunk -- wait for processing of all the chunks to complete
m_chunkedResult->waitFinalize();
ExceptionPtr ex = m_chunkedResult->getException();
@@ -880,13 +879,13 @@ void TcrMessage::processChunk(const uint8_t* bytes, int32_t len,
case TcrMessage::CQDATAERROR_MSG_TYPE: // one part
case TcrMessage::CQ_EXCEPTION_TYPE: // one part
case TcrMessage::RESPONSE_FROM_PRIMARY: {
- if (m_chunkedResult != NULL) {
+ if (m_chunkedResult != nullptr) {
LOGDEBUG("tcrmessage in case22 ");
TcrChunkedContext* chunk = new TcrChunkedContext(
bytes, len, m_chunkedResult, isLastChunkAndisSecurityHeader);
m_chunkedResult->setEndpointMemId(endpointmemId);
m_tcdm->queueChunk(chunk);
- if (bytes == NULL) {
+ if (bytes == nullptr) {
// last chunk -- wait for processing of all the chunks to complete
m_chunkedResult->waitFinalize();
// Throw any exception during processing here.
@@ -897,15 +896,14 @@ void TcrMessage::processChunk(const uint8_t* bytes, int32_t len,
// This can cause behaviour like partially filled cache in case
// of populating cache with registerAllKeys(), so that should be
// documented since rolling that back may not be a good idea either.
- ExceptionPtr& ex = m_chunkedResult->getException();
- if (ex != nullptr) {
+ if (const auto& ex = m_chunkedResult->getException()) {
ex->raise();
}
}
} else if (TcrMessage::CQ_EXCEPTION_TYPE == m_msgType ||
TcrMessage::CQDATAERROR_MSG_TYPE == m_msgType ||
TcrMessage::GET_ALL_DATA_ERROR == m_msgType) {
- if (bytes != NULL) {
+ if (bytes != nullptr) {
chunkSecurityHeader(1, bytes, len, isLastChunkAndisSecurityHeader);
GF_SAFE_DELETE_ARRAY(bytes);
}
@@ -916,7 +914,7 @@ void TcrMessage::processChunk(const uint8_t* bytes, int32_t len,
// error
case EXECUTE_FUNCTION_ERROR:
case EXECUTE_REGION_FUNCTION_ERROR: {
- if (bytes != NULL) {
+ if (bytes != nullptr) {
// DeleteArray<const uint8_t> delChunk(bytes);
// DataInput input(bytes, len);
// TODO: this not send two part...
@@ -930,7 +928,7 @@ void TcrMessage::processChunk(const uint8_t* bytes, int32_t len,
break;
}
case TcrMessage::EXCEPTION: {
- if (bytes != NULL) {
+ if (bytes != nullptr) {
DeleteArray<const uint8_t> delChunk(bytes);
DataInput input(bytes, len);
readExceptionPart(input, isLastChunkAndisSecurityHeader);
@@ -942,7 +940,7 @@ void TcrMessage::processChunk(const uint8_t* bytes, int32_t len,
case TcrMessage::RESPONSE_FROM_SECONDARY: {
// TODO: how many parts
chunkSecurityHeader(1, bytes, len, isLastChunkAndisSecurityHeader);
- if (bytes != NULL) {
+ if (bytes != nullptr) {
DeleteArray<const uint8_t> delChunk(bytes);
LOGFINEST("processChunk - got response from secondary, ignoring.");
}
@@ -950,7 +948,7 @@ void TcrMessage::processChunk(const uint8_t* bytes, int32_t len,
}
case TcrMessage::GET_ALL_DATA_ERROR: {
chunkSecurityHeader(1, bytes, len, isLastChunkAndisSecurityHeader);
- if (bytes != NULL) {
+ if (bytes != nullptr) {
GF_SAFE_DELETE_ARRAY(bytes);
}
// nothing else to done since this will be taken care of at higher level
@@ -958,7 +956,7 @@ void TcrMessage::processChunk(const uint8_t* bytes, int32_t len,
}
default: {
// TODO: how many parts what should we do here
- if (bytes != NULL) {
+ if (bytes != nullptr) {
GF_SAFE_DELETE_ARRAY(bytes);
} else {
LOGWARN(
@@ -975,19 +973,19 @@ void TcrMessage::processChunk(const uint8_t* bytes, int32_t len,
}
const char* TcrMessage::getPoolName() {
- if (m_region != NULL) {
+ if (m_region != nullptr) {
const PoolPtr& p = (const_cast<Region*>(m_region))->getPool();
if (p != nullptr) {
return p->getName();
} else {
- return NULL;
+ return nullptr;
}
}
- return NULL;
+ return nullptr;
/*ThinClientPoolDM* pool = dynamic_cast<ThinClientPoolDM*>(m_tcdm);
- if(pool == NULL)
- return NULL;
+ if(pool == nullptr)
+ return nullptr;
return pool->getName();*/
}
@@ -1007,8 +1005,8 @@ void TcrMessage::handleByteArrayResponse(const char* bytearray, int32_t len,
uint16_t endpointMemId) {
DataInput input((uint8_t*)bytearray, len);
// TODO:: this need to make sure that pool is there
- // if(m_tcdm == NULL)
- // throw IllegalArgumentException("Pool is NULL in TcrMessage");
+ // if(m_tcdm == nullptr)
+ // throw IllegalArgumentException("Pool is nullptr in TcrMessage");
input.setPoolName(getPoolName());
input.readInt(&m_msgType);
int32_t msglen;
@@ -1218,7 +1216,7 @@ void TcrMessage::handleByteArrayResponse(const char* bytearray, int32_t len,
input.readInt(®ionLen);
int8_t isObj;
input.read(&isObj);
- char* regname = NULL;
+ char* regname = nullptr;
regname = new char[regionLen + 1];
DeleteArray<char> delRegName(regname);
input.readBytesOnly(reinterpret_cast<int8_t*>(regname), regionLen);
@@ -1255,7 +1253,7 @@ void TcrMessage::handleByteArrayResponse(const char* bytearray, int32_t len,
input.readInt(®ionLen);
int8_t isObj;
input.read(&isObj);
- char* regname = NULL;
+ char* regname = nullptr;
regname = new char[regionLen + 1];
DeleteArray<char> delRegName(regname);
input.readBytesOnly(reinterpret_cast<int8_t*>(regname), regionLen);
@@ -1309,7 +1307,7 @@ void TcrMessage::handleByteArrayResponse(const char* bytearray, int32_t len,
input.readInt(®ionLen);
int8_t isObj;
input.read(&isObj);
- char* regname = NULL;
+ char* regname = nullptr;
regname = new char[regionLen + 1];
DeleteArray<char> delRegName(regname);
input.readBytesOnly(reinterpret_cast<int8_t*>(regname), regionLen);
@@ -1429,7 +1427,7 @@ void TcrMessage::handleByteArrayResponse(const char* bytearray, int32_t len,
input.readInt(®ionLen);
int8_t isObj;
input.read(&isObj);
- char* regname = NULL;
+ char* regname = nullptr;
regname = new char[regionLen + 1];
DeleteArray<char> delRegName(regname);
@@ -1493,7 +1491,8 @@ TcrMessageDestroyRegion::TcrMessageDestroyRegion(
int messageResponsetimeout, ThinClientBaseDM* connectionDM) {
m_msgType = TcrMessage::DESTROY_REGION;
m_tcdm = connectionDM;
- m_regionName = region == NULL ? "INVALID_REGION_NAME" : region->getFullPath();
+ m_regionName =
+ region == nullptr ? "INVALID_REGION_NAME" : region->getFullPath();
m_region = region;
m_timeout = DEFAULT_TIMEOUT_SECONDS;
m_messageResponseTimeout = messageResponsetimeout;
@@ -1524,7 +1523,8 @@ TcrMessageClearRegion::TcrMessageClearRegion(
int messageResponsetimeout, ThinClientBaseDM* connectionDM) {
m_msgType = TcrMessage::CLEAR_REGION;
m_tcdm = connectionDM;
- m_regionName = region == NULL ? "INVALID_REGION_NAME" : region->getFullPath();
+ m_regionName =
+ region == nullptr ? "INVALID_REGION_NAME" : region->getFullPath();
m_region = region;
m_timeout = DEFAULT_TIMEOUT_SECONDS;
m_messageResponseTimeout = messageResponsetimeout;
@@ -1562,7 +1562,7 @@ TcrMessageQuery::TcrMessageQuery(const std::string& regionName,
m_regionName = regionName; // this is querystri;
m_timeout = DEFAULT_TIMEOUT_SECONDS;
m_messageResponseTimeout = messageResponsetimeout;
- m_region = NULL;
+ m_region = nullptr;
uint32_t numOfParts = 1;
numOfParts++;
@@ -1585,7 +1585,7 @@ TcrMessageStopCQ::TcrMessageStopCQ(const std::string& regionName,
m_regionName = regionName; // this is querystring
m_timeout = DEFAULT_TIMEOUT_SECONDS;
m_messageResponseTimeout = messageResponsetimeout;
- m_region = NULL;
+ m_region = nullptr;
m_isSecurityHeaderAdded = false;
m_isMetaRegion = false;
@@ -1611,7 +1611,7 @@ TcrMessageCloseCQ::TcrMessageCloseCQ(const std::string& regionName,
m_regionName = regionName; // this is querystring
m_timeout = DEFAULT_TIMEOUT_SECONDS;
m_messageResponseTimeout = messageResponsetimeout;
- m_region = NULL;
+ m_region = nullptr;
uint32_t numOfParts = 1;
numOfParts++;
@@ -1635,16 +1635,16 @@ TcrMessageQueryWithParameters::TcrMessageQueryWithParameters(
m_regionName = regionName;
m_timeout = DEFAULT_TIMEOUT_SECONDS;
m_messageResponseTimeout = messageResponsetimeout;
- m_region = NULL;
+ m_region = nullptr;
// Find out the numOfParts
- uint32_t numOfParts = 4 + paramList->size();
+ uint32_t numOfParts = 4 + static_cast<uint32_t>(paramList->size());
writeHeader(m_msgType, numOfParts);
// Part-1: Query String
writeRegionPart(m_regionName);
// Part-2: Number or length of the parameters
- writeIntPart(paramList->size());
+ writeIntPart(static_cast<uint32_t>(paramList->size()));
// Part-3: X (COMPILE_QUERY_CLEAR_TIMEOUT) parameter
writeIntPart(15);
@@ -1669,7 +1669,8 @@ TcrMessageContainsKey::TcrMessageContainsKey(
ThinClientBaseDM* connectionDM) {
m_msgType = TcrMessage::CONTAINS_KEY;
m_tcdm = connectionDM;
- m_regionName = region == NULL ? "INVALID_REGION_NAME" : region->getFullPath();
+ m_regionName =
+ region == nullptr ? "INVALID_REGION_NAME" : region->getFullPath();
m_region = region;
m_timeout = DEFAULT_TIMEOUT_SECONDS;
@@ -1683,7 +1684,7 @@ TcrMessageContainsKey::TcrMessageContainsKey(
if (key == nullptr) {
delete m_request;
throw IllegalArgumentException(
- "key passed to the constructor can't be NULL");
+ "key passed to the constructor can't be nullptr");
}
writeHeader(m_msgType, numOfParts);
@@ -1702,7 +1703,7 @@ TcrMessageGetDurableCqs::TcrMessageGetDurableCqs(
m_msgType = TcrMessage::GETDURABLECQS_MSG_TYPE;
m_tcdm = connectionDM;
m_timeout = DEFAULT_TIMEOUT_SECONDS;
- m_region = NULL;
+ m_region = nullptr;
// wrirting msgtype with part length =1
writeHeader(m_msgType, 1);
// the server expects at least 1 part, so writing a dummy byte part
@@ -1718,7 +1719,7 @@ TcrMessageRequest::TcrMessageRequest(const Region* region,
m_tcdm = connectionDM;
m_key = key;
m_regionName =
- (region == NULL ? "INVALID_REGION_NAME" : region->getFullPath());
+ (region == nullptr ? "INVALID_REGION_NAME" : region->getFullPath());
m_region = region;
m_timeout = DEFAULT_TIMEOUT_SECONDS;
@@ -1732,7 +1733,7 @@ TcrMessageRequest::TcrMessageRequest(const Region* region,
if (key == nullptr) {
delete m_request;
throw IllegalArgumentException(
- "key passed to the constructor can't be NULL");
+ "key passed to the constructor can't be nullptr");
}
numOfParts--; // no event id for request
@@ -1755,7 +1756,7 @@ TcrMessageInvalidate::TcrMessageInvalidate(const Region* region,
m_tcdm = connectionDM;
m_key = key;
m_regionName =
- (region == NULL ? "INVALID_REGION_NAME" : region->getFullPath());
+ (region == nullptr ? "INVALID_REGION_NAME" : region->getFullPath());
m_region = region;
m_timeout = DEFAULT_TIMEOUT_SECONDS;
@@ -1769,7 +1770,7 @@ TcrMessageInvalidate::TcrMessageInvalidate(const Region* region,
if (key == nullptr) {
delete m_request;
throw IllegalArgumentException(
- "key passed to the constructor can't be NULL");
+ "key passed to the constructor can't be nullptr");
}
writeHeader(TcrMessage::INVALIDATE, numOfParts);
@@ -1793,7 +1794,7 @@ TcrMessageDestroy::TcrMessageDestroy(const Region* region,
m_tcdm = connectionDM;
m_key = key;
m_regionName =
- (region == NULL ? "INVALID_REGION_NAME" : region->getFullPath());
+ (region == nullptr ? "INVALID_REGION_NAME" : region->getFullPath());
m_region = region;
m_timeout = DEFAULT_TIMEOUT_SECONDS;
uint32_t numOfParts = 2;
@@ -1806,7 +1807,7 @@ TcrMessageDestroy::TcrMessageDestroy(const Region* region,
if (key == nullptr) {
delete m_request;
throw IllegalArgumentException(
- "key passed to the constructor can't be NULL");
+ "key passed to the constructor can't be nullptr");
}
if (value != nullptr) {
@@ -1849,12 +1850,12 @@ TcrMessagePut::TcrMessagePut(const Region* region, const CacheableKeyPtr& key,
m_msgType = TcrMessage::PUT;
m_tcdm = connectionDM;
m_key = key;
- m_regionName = region != NULL ? region->getFullPath() : regionName;
+ m_regionName = region != nullptr ? region->getFullPath() : regionName;
m_region = region;
m_timeout = DEFAULT_TIMEOUT_SECONDS;
// TODO check the number of parts in this constructor. doubt because in PUT
- // value can be NULL also.
+ // value can be nullptr also.
uint32_t numOfParts = 5;
if (aCallbackArgument != nullptr) {
++numOfParts;
@@ -1865,7 +1866,7 @@ TcrMessagePut::TcrMessagePut(const Region* region, const CacheableKeyPtr& key,
if (key == nullptr) {
delete m_request;
throw IllegalArgumentException(
- "key passed to the constructor can't be NULL");
+ "key passed to the constructor can't be nullptr");
}
numOfParts++;
@@ -1889,7 +1890,7 @@ TcrMessageReply::TcrMessageReply(bool decodeAll,
m_decodeAll = decodeAll;
m_tcdm = connectionDM;
- if (connectionDM != NULL) isSecurityOn = connectionDM->isSecurityOn();
+ if (connectionDM != nullptr) isSecurityOn = connectionDM->isSecurityOn();
}
TcrMessagePing::TcrMessagePing(bool decodeAll) {
@@ -1940,13 +1941,14 @@ TcrMessageRegisterInterestList::TcrMessageRegisterInterestList(
m_msgType = TcrMessage::REGISTER_INTEREST_LIST;
m_tcdm = connectionDM;
m_keyList = &keys;
- m_regionName = region == NULL ? "INVALID_REGION_NAME" : region->getFullPath();
+ m_regionName =
+ region == nullptr ? "INVALID_REGION_NAME" : region->getFullPath();
m_region = region;
m_timeout = DEFAULT_TIMEOUT_SECONDS;
m_isDurable = isDurable;
m_receiveValues = receiveValues;
- uint32_t numInItrestList = keys.size();
+ uint32_t numInItrestList = static_cast<int32_t>(keys.size());
GF_R_ASSERT(numInItrestList != 0);
uint32_t numOfParts = 2 + numInItrestList;
@@ -1964,7 +1966,7 @@ TcrMessageRegisterInterestList::TcrMessageRegisterInterestList(
if (keys[i] == nullptr) {
delete m_request;
throw IllegalArgumentException(
- "keys in the interest list cannot be NULL");
+ "keys in the interest list cannot be nullptr");
}
cal->push_back(keys[i]);
}
@@ -1991,15 +1993,16 @@ TcrMessageUnregisterInterestList::TcrMessageUnregisterInterestList(
m_msgType = TcrMessage::UNREGISTER_INTEREST_LIST;
m_tcdm = connectionDM;
m_keyList = &keys;
- m_regionName = region == NULL ? "INVALID_REGION_NAME" : region->getFullPath();
+ m_regionName =
+ region == nullptr ? "INVALID_REGION_NAME" : region->getFullPath();
m_region = region;
m_timeout = DEFAULT_TIMEOUT_SECONDS;
m_isDurable = isDurable;
m_receiveValues = receiveValues;
- uint32_t numInItrestList = keys.size();
+ auto numInItrestList = keys.size();
GF_R_ASSERT(numInItrestList != 0);
- uint32_t numOfParts = 2 + numInItrestList;
+ uint32_t numOfParts = 2 + static_cast<uint32_t>(numInItrestList);
numOfParts += 2;
writeHeader(m_msgType, numOfParts);
@@ -2013,7 +2016,7 @@ TcrMessageUnregisterInterestList::TcrMessageUnregisterInterestList(
if (keys[i] == nullptr) {
delete m_request;
throw IllegalArgumentException(
- "keys in the interest list cannot be NULL");
+ "keys in the interest list cannot be nullptr");
}
writeObjectPart(keys[i]);
}
@@ -2186,17 +2189,17 @@ TcrMessagePutAll::TcrMessagePutAll(const Region* region,
m_messageResponseTimeout = messageResponsetimeout;
// TODO check the number of parts in this constructor. doubt because in PUT
- // value can be NULL also.
+ // value can be nullptr also.
uint32_t numOfParts = 0;
// bool skipCallBacks = false;
if (aCallbackArgument != nullptr) {
m_msgType = TcrMessage::PUT_ALL_WITH_CALLBACK;
- numOfParts = 6 + map.size() * 2;
+ numOfParts = 6 + static_cast<uint32_t>(map.size()) * 2;
// skipCallBacks = false;
} else {
m_msgType = TcrMessage::PUTALL;
- numOfParts = 5 + map.size() * 2;
+ numOfParts = 5 + static_cast<uint32_t>(map.size()) * 2;
// skipCallBacks = true;
}
@@ -2206,7 +2209,7 @@ TcrMessagePutAll::TcrMessagePutAll(const Region* region,
writeHeader(m_msgType, numOfParts);
writeRegionPart(m_regionName);
- writeEventIdPart(map.size() - 1);
+ writeEventIdPart(static_cast<uint32_t>(map.size()) - 1);
// writeIntPart(skipCallBacks ? 0 : 1);
writeIntPart(0);
@@ -2225,18 +2228,15 @@ TcrMessagePutAll::TcrMessagePutAll(const Region* region,
}
writeIntPart(flags);
- writeIntPart(map.size());
+ writeIntPart(static_cast<int32_t>(map.size()));
if (aCallbackArgument != nullptr) {
writeObjectPart(aCallbackArgument);
}
- for (HashMapOfCacheable::Iterator iter = map.begin(); iter != map.end();
- ++iter) {
- CacheableKeyPtr key = iter.first();
- CacheablePtr value = iter.second();
- writeObjectPart(key);
- writeObjectPart(value);
+ for (const auto& iter : map) {
+ writeObjectPart(iter.first);
+ writeObjectPart(iter.second);
}
if (m_messageResponseTimeout != -1) {
@@ -2255,13 +2255,13 @@ TcrMessageRemoveAll::TcrMessageRemoveAll(const Region* region,
m_region = region;
// TODO check the number of parts in this constructor. doubt because in PUT
- // value can be NULL also.
- uint32_t numOfParts = 5 + keys.size();
+ // value can be nullptr also.
+ uint32_t numOfParts = 5 + static_cast<uint32_t>(keys.size());
if (m_messageResponseTimeout != -1) numOfParts++;
writeHeader(m_msgType, numOfParts);
writeRegionPart(m_regionName);
- writeEventIdPart(keys.size() - 1);
+ writeEventIdPart(static_cast<int>(keys.size() - 1));
// Client removeall requests now send a flags int as part #0. 1==region has
// datapolicy.EMPTY, 2==region has concurrency checks enabled.
@@ -2279,11 +2279,10 @@ TcrMessageRemoveAll::TcrMessageRemoveAll(const Region* region,
}
writeIntPart(flags);
writeObjectPart(aCallbackArgument);
- writeIntPart(keys.size());
+ writeIntPart(static_cast<int32_t>(keys.size()));
- for (VectorOfCacheableKey::Iterator iter = keys.begin(); iter != keys.end();
- ++iter) {
- writeObjectPart(*iter);
+ for (const auto& key : keys) {
+ writeObjectPart(key);
}
writeMessageLength();
}
@@ -2309,7 +2308,7 @@ TcrMessageGetAll::TcrMessageGetAll(const Region* region,
m_region = region;
/*CacheableObjectArrayPtr keyArr = nullptr;
- if (keys != NULL) {
+ if (keys != nullptr) {
keyArr = CacheableObjectArray::create();
for (int32_t index = 0; index < keys->size(); ++index) {
keyArr->push_back(keys->operator[](index));
@@ -2331,7 +2330,7 @@ TcrMessageGetAll::TcrMessageGetAll(const Region* region,
void TcrMessage::InitializeGetallMsg(const UserDataPtr& aCallbackArgument) {
/*CacheableObjectArrayPtr keyArr = nullptr;
- if (m_keyList != NULL) {
+ if (m_keyList != nullptr) {
keyArr = CacheableObjectArray::create();
for (int32_t index = 0; index < m_keyList->size(); ++index) {
keyArr->push_back(m_keyList->operator[](index));
@@ -2410,7 +2409,7 @@ TcrMessageExecuteFunction::TcrMessageExecuteFunction(
// writeBytePart(getResult ? 1 : 0);
// if gfcpp property unit set then timeout will be in millisecond
// otherwise it will be in second
- if ((DistributedSystem::getSystemProperties() != NULL) &&
+ if ((DistributedSystem::getSystemProperties() != nullptr) &&
(DistributedSystem::getSystemProperties()->readTimeoutUnitInMillis())) {
writeByteAndTimeOutPart(getResult, timeout);
} else {
@@ -2428,16 +2427,18 @@ TcrMessageExecuteRegionFunction::TcrMessageExecuteRegionFunction(
ThinClientBaseDM* connectionDM, int8_t reExecute) {
m_msgType = TcrMessage::EXECUTE_REGION_FUNCTION;
m_tcdm = connectionDM;
- m_regionName = region == NULL ? "INVALID_REGION_NAME" : region->getFullPath();
+ m_regionName =
+ region == nullptr ? "INVALID_REGION_NAME" : region->getFullPath();
m_region = region;
m_hasResult = getResult;
- if (routingObj != nullptr && routingObj->size() == 1) {
+ if (routingObj && routingObj->size() == 1) {
LOGDEBUG("setting up key");
m_key = std::static_pointer_cast<CacheableKey>(routingObj->at(0));
}
- uint32_t numOfParts = 6 + (routingObj == nullptr ? 0 : routingObj->size());
+ uint32_t numOfParts =
+ 6 + (!routingObj ? 0 : static_cast<uint32_t>(routingObj->size()));
numOfParts +=
2; // for the FunctionHA isReExecute and removedNodesSize parts.
if (failedNodes != nullptr) {
@@ -2447,7 +2448,7 @@ TcrMessageExecuteRegionFunction::TcrMessageExecuteRegionFunction(
// if gfcpp property unit set then timeout will be in millisecond
// otherwise it will be in second
- if ((DistributedSystem::getSystemProperties() != NULL) &&
+ if ((DistributedSystem::getSystemProperties() != nullptr) &&
(DistributedSystem::getSystemProperties()->readTimeoutUnitInMillis())) {
writeByteAndTimeOutPart(getResult, timeout);
} else {
@@ -2459,15 +2460,16 @@ TcrMessageExecuteRegionFunction::TcrMessageExecuteRegionFunction(
// klug for MemberMappedArgs
writeObjectPart(nullptr);
writeBytePart(reExecute); // FunctionHA isReExecute = false
- writeIntPart(routingObj == nullptr ? 0 : routingObj->size());
- if (routingObj != nullptr) {
- for (int32_t i = 0; i < routingObj->size(); i++) {
- CacheablePtr value = routingObj->operator[](i);
+ if (routingObj) {
+ writeIntPart(static_cast<int32_t>(routingObj->size()));
+ for (const auto& value : *routingObj) {
writeObjectPart(value);
}
+ } else {
+ writeIntPart(0);
}
- if (failedNodes != nullptr) {
- writeIntPart(failedNodes->size());
+ if (failedNodes) {
+ writeIntPart(static_cast<int32_t>(failedNodes->size()));
writeObjectPart(failedNodes);
} else {
writeIntPart(0); // FunctionHA removedNodesSize = 0
@@ -2483,11 +2485,13 @@ TcrMessageExecuteRegionFunctionSingleHop::
int32_t timeout, ThinClientBaseDM* connectionDM) {
m_msgType = TcrMessage::EXECUTE_REGION_FUNCTION_SINGLE_HOP;
m_tcdm = connectionDM;
- m_regionName = region == NULL ? "INVALID_REGION_NAME" : region->getFullPath();
+ m_regionName =
+ region == nullptr ? "INVALID_REGION_NAME" : region->getFullPath();
m_region = region;
m_hasResult = getResult;
- uint32_t numOfParts = 6 + (routingObj == nullptr ? 0 : routingObj->size());
+ uint32_t numOfParts =
+ 6 + (routingObj ? static_cast<int32_t>(routingObj->size()) : 0);
numOfParts +=
2; // for the FunctionHA isReExecute and removedNodesSize parts.
if (failedNodes != nullptr) {
@@ -2497,7 +2501,7 @@ TcrMessageExecuteRegionFunctionSingleHop::
// if gfcpp property unit set then timeout will be in millisecond
// otherwise it will be in second
- if ((DistributedSystem::getSystemProperties() != NULL) &&
+ if ((DistributedSystem::getSystemProperties() != nullptr) &&
(DistributedSystem::getSystemProperties()->readTimeoutUnitInMillis())) {
writeByteAndTimeOutPart(getResult, timeout);
} else {
@@ -2509,8 +2513,8 @@ TcrMessageExecuteRegionFunctionSingleHop::
// klug for MemberMappedArgs
writeObjectPart(nullptr);
writeBytePart(allBuckets ? 1 : 0);
- writeIntPart(routingObj == nullptr ? 0 : routingObj->size());
- if (routingObj != nullptr) {
+ if (routingObj) {
+ writeIntPart(static_cast<int32_t>(routingObj->size()));
if (allBuckets) {
LOGDEBUG("All Buckets so putting IntPart for buckets = %d ",
routingObj->size());
@@ -2524,9 +2528,11 @@ TcrMessageExecuteRegionFunctionSingleHop::
writeObjectPart(itr);
}
}
+ } else {
+ writeIntPart(0);
}
- if (failedNodes != nullptr) {
- writeIntPart(failedNodes->size());
+ if (failedNodes) {
+ writeIntPart(static_cast<int32_t>(failedNodes->size()));
writeObjectPart(failedNodes);
} else {
writeIntPart(0); // FunctionHA removedNodesSize = 0
@@ -2974,8 +2980,8 @@ void TcrMessage::readHashMapForGCVersions(
auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(key);
auto valVersionPtr = std::dynamic_pointer_cast<Cacheable>(valVersion);
- if (value != nullptr) {
- value->insert(keyPtr, valVersionPtr);
+ if (value) {
+ value->emplace(keyPtr, valVersionPtr);
} else {
throw Exception(
"Inserting values in HashMap For GC versions. value must not be "
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/TcrMessage.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/TcrMessage.hpp b/src/cppcache/src/TcrMessage.hpp
index 00951e2..240a968 100644
--- a/src/cppcache/src/TcrMessage.hpp
+++ b/src/cppcache/src/TcrMessage.hpp
@@ -44,7 +44,6 @@
#include <map>
#include <vector>
-
namespace apache {
namespace geode {
namespace client {
@@ -215,7 +214,7 @@ class CPPCACHE_EXPORT TcrMessage {
void setData(const char* bytearray, int32_t len, uint16_t memId);
void startProcessChunk(ACE_Semaphore& finalizeSema);
- // NULL chunk means that this is the last chunk
+ // nullptr chunk means that this is the last chunk
void processChunk(const uint8_t* chunk, int32_t chunkLen,
uint16_t endpointmemId,
const uint8_t isLastChunkAndisSecurityHeader = 0x00);
@@ -226,7 +225,7 @@ class CPPCACHE_EXPORT TcrMessage {
// const std::string& str2, InterestResultPolicy interestPolicy =
// InterestResultPolicy::NONE, bool isDurable = false, bool isCachingEnabled
// = false, bool receiveValues = true, ThinClientBaseDM *connectionDM =
- // NULL);
+ // nullptr);
void InitializeGetallMsg(const UserDataPtr& aCallbackArgument);
// for multiuser cache close
@@ -379,16 +378,16 @@ class CPPCACHE_EXPORT TcrMessage {
// that
// takes ownership of delta bytes.
CacheableBytesPtr getDeltaBytes() {
- if (m_deltaBytes == NULL) {
+ if (m_deltaBytes == nullptr) {
return nullptr;
}
CacheableBytesPtr retVal(
CacheableBytes::createNoCopy(m_deltaBytes, m_deltaBytesLen));
- m_deltaBytes = NULL;
+ m_deltaBytes = nullptr;
return retVal;
}
- bool hasDelta() { return (m_delta != NULL); }
+ bool hasDelta() { return (m_delta != nullptr); }
void addSecurityPart(int64_t connectionId, int64_t unique_id,
TcrConnection* conn);
@@ -463,9 +462,9 @@ class CPPCACHE_EXPORT TcrMessage {
m_msgTypeRequest(0),
m_txId(-1),
m_decodeAll(false),
- m_tcdm(NULL),
- m_chunkedResult(NULL),
- m_keyList(NULL),
+ m_tcdm(nullptr),
+ m_chunkedResult(nullptr),
+ m_keyList(nullptr),
m_key(),
m_value(nullptr),
m_failedNode(),
@@ -473,7 +472,7 @@ class CPPCACHE_EXPORT TcrMessage {
m_versionTag(),
m_eventid(nullptr),
m_regionName("INVALID_REGION_NAME"),
- m_region(NULL),
+ m_region(nullptr),
m_regex(),
m_interestPolicy(0),
m_timeout(15 /*DEFAULT_TIMEOUT_SECONDS*/),
@@ -492,11 +491,11 @@ class CPPCACHE_EXPORT TcrMessage {
m_vectorPtr(),
m_numCqPart(0),
m_msgTypeForCq(0),
- m_cqs(NULL),
+ m_cqs(nullptr),
m_messageResponseTimeout(-1),
m_boolValue(0),
- m_delta(NULL),
- m_deltaBytes(NULL),
+ m_delta(nullptr),
+ m_deltaBytes(nullptr),
m_deltaBytesLen(0),
m_isCallBackArguement(false),
m_bucketServerLocation(nullptr),
@@ -553,7 +552,7 @@ class CPPCACHE_EXPORT TcrMessage {
void readPrMetaData(DataInput& input);
void writeObjectPart(const SerializablePtr& se, bool isDelta = false,
bool callToData = false,
- const VectorOfCacheableKey* getAllKeyList = NULL);
+ const VectorOfCacheableKey* getAllKeyList = nullptr);
void writeHeader(uint32_t msgType, uint32_t numOfParts);
void writeRegionPart(const std::string& regionName);
void writeStringPart(const std::string& str);
@@ -715,7 +714,7 @@ class TcrMessageRequest : public TcrMessage {
public:
TcrMessageRequest(const Region* region, const CacheableKeyPtr& key,
const UserDataPtr& aCallbackArgument,
- ThinClientBaseDM* connectionDM = NULL);
+ ThinClientBaseDM* connectionDM = nullptr);
virtual ~TcrMessageRequest() {}
};
@@ -724,7 +723,7 @@ class TcrMessageInvalidate : public TcrMessage {
public:
TcrMessageInvalidate(const Region* region, const CacheableKeyPtr& key,
const UserDataPtr& aCallbackArgument,
- ThinClientBaseDM* connectionDM = NULL);
+ ThinClientBaseDM* connectionDM = nullptr);
};
class TcrMessageDestroy : public TcrMessage {
@@ -732,7 +731,7 @@ class TcrMessageDestroy : public TcrMessage {
TcrMessageDestroy(const Region* region, const CacheableKeyPtr& key,
const CacheablePtr& value,
const UserDataPtr& aCallbackArgument,
- ThinClientBaseDM* connectionDM = NULL);
+ ThinClientBaseDM* connectionDM = nullptr);
};
class TcrMessageRegisterInterestList : public TcrMessage {
@@ -742,7 +741,7 @@ class TcrMessageRegisterInterestList : public TcrMessage {
bool isDurable = false, bool isCachingEnabled = false,
bool receiveValues = true,
InterestResultPolicy interestPolicy = InterestResultPolicy::NONE,
- ThinClientBaseDM* connectionDM = NULL);
+ ThinClientBaseDM* connectionDM = nullptr);
virtual ~TcrMessageRegisterInterestList() {}
};
@@ -754,7 +753,7 @@ class TcrMessageUnregisterInterestList : public TcrMessage {
bool isDurable = false, bool isCachingEnabled = false,
bool receiveValues = true,
InterestResultPolicy interestPolicy = InterestResultPolicy::NONE,
- ThinClientBaseDM* connectionDM = NULL);
+ ThinClientBaseDM* connectionDM = nullptr);
virtual ~TcrMessageUnregisterInterestList() {}
};
@@ -763,9 +762,9 @@ class TcrMessagePut : public TcrMessage {
public:
TcrMessagePut(const Region* region, const CacheableKeyPtr& key,
const CacheablePtr& value, const UserDataPtr& aCallbackArgument,
- bool isDelta = false, ThinClientBaseDM* connectionDM = NULL,
+ bool isDelta = false, ThinClientBaseDM* connectionDM = nullptr,
bool isMetaRegion = false, bool fullValueAfterDeltaFail = false,
- const char* regionName = NULL);
+ const char* regionName = nullptr);
virtual ~TcrMessagePut() {}
};
@@ -776,7 +775,7 @@ class TcrMessageCreateRegion : public TcrMessage {
const std::string& str1, const std::string& str2,
InterestResultPolicy interestPolicy = InterestResultPolicy::NONE,
bool isDurable = false, bool isCachingEnabled = false,
- bool receiveValues = true, ThinClientBaseDM* connectionDM = NULL);
+ bool receiveValues = true, ThinClientBaseDM* connectionDM = nullptr);
virtual ~TcrMessageCreateRegion() {}
};
@@ -787,7 +786,7 @@ class TcrMessageRegisterInterest : public TcrMessage {
const std::string& str1, const std::string& str2,
InterestResultPolicy interestPolicy = InterestResultPolicy::NONE,
bool isDurable = false, bool isCachingEnabled = false,
- bool receiveValues = true, ThinClientBaseDM* connectionDM = NULL);
+ bool receiveValues = true, ThinClientBaseDM* connectionDM = nullptr);
virtual ~TcrMessageRegisterInterest() {}
};
@@ -798,7 +797,7 @@ class TcrMessageUnregisterInterest : public TcrMessage {
const std::string& str1, const std::string& str2,
InterestResultPolicy interestPolicy = InterestResultPolicy::NONE,
bool isDurable = false, bool isCachingEnabled = false,
- bool receiveValues = true, ThinClientBaseDM* connectionDM = NULL);
+ bool receiveValues = true, ThinClientBaseDM* connectionDM = nullptr);
virtual ~TcrMessageUnregisterInterest() {}
};
@@ -858,7 +857,7 @@ class TcrMessageRemoveAll : public TcrMessage {
public:
TcrMessageRemoveAll(const Region* region, const VectorOfCacheableKey& keys,
const UserDataPtr& aCallbackArgument,
- ThinClientBaseDM* connectionDM = NULL);
+ ThinClientBaseDM* connectionDM = nullptr);
virtual ~TcrMessageRemoveAll() {}
};
@@ -887,7 +886,7 @@ class TcrMessageExecuteRegionFunction : public TcrMessage {
const std::string& funcName, const Region* region,
const CacheablePtr& args, CacheableVectorPtr routingObj,
uint8_t getResult, CacheableHashSetPtr failedNodes, int32_t timeout,
- ThinClientBaseDM* connectionDM = NULL, int8_t reExecute = 0);
+ ThinClientBaseDM* connectionDM = nullptr, int8_t reExecute = 0);
virtual ~TcrMessageExecuteRegionFunction() {}
};
@@ -927,7 +926,7 @@ class TcrMessageSize : public TcrMessage {
class TcrMessageUserCredential : public TcrMessage {
public:
TcrMessageUserCredential(PropertiesPtr creds,
- ThinClientBaseDM* connectionDM = NULL);
+ ThinClientBaseDM* connectionDM = nullptr);
virtual ~TcrMessageUserCredential() {}
};
@@ -990,7 +989,7 @@ class TcrMessageGetPdxEnumById : public TcrMessage {
class TcrMessageGetFunctionAttributes : public TcrMessage {
public:
TcrMessageGetFunctionAttributes(const std::string& funcName,
- ThinClientBaseDM* connectionDM = NULL);
+ ThinClientBaseDM* connectionDM = nullptr);
virtual ~TcrMessageGetFunctionAttributes() {}
};
@@ -998,7 +997,7 @@ class TcrMessageGetFunctionAttributes : public TcrMessage {
class TcrMessageKeySet : public TcrMessage {
public:
TcrMessageKeySet(const std::string& funcName,
- ThinClientBaseDM* connectionDM = NULL);
+ ThinClientBaseDM* connectionDM = nullptr);
virtual ~TcrMessageKeySet() {}
};
@@ -1027,7 +1026,7 @@ class TcrMessageUpdateClientNotification : public TcrMessage {
class TcrMessageGetAll : public TcrMessage {
public:
TcrMessageGetAll(const Region* region, const VectorOfCacheableKey* keys,
- ThinClientBaseDM* connectionDM = NULL,
+ ThinClientBaseDM* connectionDM = nullptr,
const UserDataPtr& aCallbackArgument = nullptr);
virtual ~TcrMessageGetAll() {}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/TcrPoolEndPoint.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/TcrPoolEndPoint.hpp b/src/cppcache/src/TcrPoolEndPoint.hpp
index 66c26ae..cffb4e6 100644
--- a/src/cppcache/src/TcrPoolEndPoint.hpp
+++ b/src/cppcache/src/TcrPoolEndPoint.hpp
@@ -42,15 +42,15 @@ class TcrPoolEndPoint : public TcrEndpoint {
virtual GfErrType registerDM(bool clientNotification,
bool isSecondary = false,
bool isActiveEndpoint = false,
- ThinClientBaseDM* distMgr = NULL);
+ ThinClientBaseDM* distMgr = nullptr);
virtual void unregisterDM(bool clientNotification,
- ThinClientBaseDM* distMgr = NULL,
+ ThinClientBaseDM* distMgr = nullptr,
bool checkQueueHosted = false);
using TcrEndpoint::handleIOException;
virtual bool handleIOException(const std::string& message,
TcrConnection*& conn, bool isBgThread = false);
void handleNotificationStats(int64_t byteLength);
- virtual ~TcrPoolEndPoint() { m_dm = NULL; }
+ virtual ~TcrPoolEndPoint() { m_dm = nullptr; }
virtual bool isMultiUserMode();
protected:
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/ThinClientBaseDM.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ThinClientBaseDM.cpp b/src/cppcache/src/ThinClientBaseDM.cpp
index cda9ccd..0291c5a 100644
--- a/src/cppcache/src/ThinClientBaseDM.cpp
+++ b/src/cppcache/src/ThinClientBaseDM.cpp
@@ -38,7 +38,7 @@ ThinClientBaseDM::ThinClientBaseDM(TcrConnectionManager& connManager,
m_initDone(false),
m_clientNotification(false),
m_chunks(true),
- m_chunkProcessor(NULL) {}
+ m_chunkProcessor(nullptr) {}
ThinClientBaseDM::~ThinClientBaseDM() {}
@@ -73,7 +73,7 @@ GfErrType ThinClientBaseDM::sendSyncRequestRegisterInterest(
ThinClientRegion* region, TcrEndpoint* endpoint) {
GfErrType err = GF_NOERR;
- if (endpoint == NULL) {
+ if (endpoint == nullptr) {
err = sendSyncRequest(request, reply, attemptFailover);
} else {
reply.setDM(this);
@@ -131,7 +131,7 @@ GfErrType ThinClientBaseDM::handleEPError(TcrEndpoint* ep,
if (error == GF_NOERR) {
if (reply.getMessageType() == TcrMessage::EXCEPTION) {
const char* exceptStr = reply.getException();
- if (exceptStr != NULL) {
+ if (exceptStr != nullptr) {
bool markServerDead = unrecoverableServerError(exceptStr);
bool doFailover = (markServerDead || nonFatalServerError(exceptStr));
if (doFailover) {
@@ -174,13 +174,14 @@ GfErrType ThinClientBaseDM::sendRequestToEndPoint(const TcrMessage& request,
* This method is for exceptions when server should be marked as dead.
*/
bool ThinClientBaseDM::unrecoverableServerError(const char* exceptStr) {
- return ((strstr(exceptStr, "org.apache.geode.cache.CacheClosedException") !=
- NULL) ||
- /*(strstr(exceptStr,
- "org.apache.geode.cache.execute.FunctionException") != NULL) ||*/
- (strstr(exceptStr,
- "org.apache.geode.distributed.ShutdownException") != NULL) ||
- (strstr(exceptStr, "java.lang.OutOfMemoryError") != NULL));
+ return (
+ (strstr(exceptStr, "org.apache.geode.cache.CacheClosedException") !=
+ nullptr) ||
+ /*(strstr(exceptStr,
+ "org.apache.geode.cache.execute.FunctionException") != nullptr) ||*/
+ (strstr(exceptStr, "org.apache.geode.distributed.ShutdownException") !=
+ nullptr) ||
+ (strstr(exceptStr, "java.lang.OutOfMemoryError") != nullptr));
}
/**
@@ -192,10 +193,10 @@ bool ThinClientBaseDM::unrecoverableServerError(const char* exceptStr) {
*/
bool ThinClientBaseDM::nonFatalServerError(const char* exceptStr) {
return ((strstr(exceptStr, "org.apache.geode.distributed.TimeoutException") !=
- NULL) ||
+ nullptr) ||
(strstr(exceptStr, "org.apache.geode.ThreadInterruptedException") !=
- NULL) ||
- (strstr(exceptStr, "java.lang.IllegalStateException") != NULL));
+ nullptr) ||
+ (strstr(exceptStr, "java.lang.IllegalStateException") != nullptr));
}
void ThinClientBaseDM::failover() {
@@ -205,7 +206,7 @@ void ThinClientBaseDM::failover() {
void ThinClientBaseDM::queueChunk(TcrChunkedContext* chunk) {
LOGDEBUG("ThinClientBaseDM::queueChunk");
const uint32_t timeout = 1;
- if (m_chunkProcessor == NULL) {
+ if (m_chunkProcessor == nullptr) {
LOGDEBUG("ThinClientBaseDM::queueChunk2");
// process in same thread if no chunk processor thread
chunk->handleChunk(true);
@@ -228,7 +229,7 @@ void ThinClientBaseDM::queueChunk(TcrChunkedContext* chunk) {
int ThinClientBaseDM::processChunks(volatile bool& isRunning) {
TcrChunkedContext* chunk;
LOGFINE("Starting chunk process thread for region %s",
- (m_region != NULL ? m_region->getFullPath() : "(null)"));
+ (m_region != nullptr ? m_region->getFullPath() : "(null)"));
while (isRunning) {
chunk = m_chunks.getUntil(0, 100000);
if (chunk) {
@@ -237,14 +238,14 @@ int ThinClientBaseDM::processChunks(volatile bool& isRunning) {
}
}
LOGFINE("Ending chunk process thread for region %s",
- (m_region != NULL ? m_region->getFullPath() : "(null)"));
+ (m_region != nullptr ? m_region->getFullPath() : "(null)"));
GF_DEV_ASSERT(m_chunks.size() == 0);
return 0;
}
// start the chunk processing thread
void ThinClientBaseDM::startChunkProcessor() {
- if (m_chunkProcessor == NULL) {
+ if (m_chunkProcessor == nullptr) {
m_chunks.open();
m_chunkProcessor = new Task<ThinClientBaseDM>(
this, &ThinClientBaseDM::processChunks, NC_ProcessChunk);
@@ -254,7 +255,7 @@ void ThinClientBaseDM::startChunkProcessor() {
// stop the chunk processing thread
void ThinClientBaseDM::stopChunkProcessor() {
- if (m_chunkProcessor != NULL) {
+ if (m_chunkProcessor != nullptr) {
m_chunkProcessor->stop();
m_chunks.close();
GF_SAFE_DELETE(m_chunkProcessor);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/ThinClientBaseDM.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ThinClientBaseDM.hpp b/src/cppcache/src/ThinClientBaseDM.hpp
index a3976d1..ad10981 100644
--- a/src/cppcache/src/ThinClientBaseDM.hpp
+++ b/src/cppcache/src/ThinClientBaseDM.hpp
@@ -49,7 +49,7 @@ class ThinClientBaseDM {
virtual GfErrType sendSyncRequestRegisterInterest(
TcrMessage& request, TcrMessageReply& reply, bool attemptFailover = true,
- ThinClientRegion* theRegion = NULL, TcrEndpoint* endpoint = NULL);
+ ThinClientRegion* theRegion = nullptr, TcrEndpoint* endpoint = nullptr);
virtual GfErrType sendSyncRequestRegisterInterestEP(TcrMessage& request,
TcrMessageReply& reply,
@@ -107,7 +107,7 @@ class ThinClientBaseDM {
TcrMessageReply& reply,
TcrEndpoint* currentEndpoint) = 0;
- virtual TcrEndpoint* getActiveEndpoint() { return NULL; }
+ virtual TcrEndpoint* getActiveEndpoint() { return nullptr; }
virtual bool checkDupAndAdd(EventIdPtr eventid) {
return m_connManager.checkDupAndAdd(eventid);
@@ -127,9 +127,9 @@ class ThinClientBaseDM {
TcrConnectionManager& getConnectionManager() { return m_connManager; }
virtual size_t getNumberOfEndPoints() const { return 0; }
bool isNotAuthorizedException(const char* exceptionMsg) {
- if (exceptionMsg != NULL &&
+ if (exceptionMsg != nullptr &&
strstr(exceptionMsg,
- "org.apache.geode.security.NotAuthorizedException") != NULL) {
+ "org.apache.geode.security.NotAuthorizedException") != nullptr) {
LOGDEBUG(
"isNotAuthorizedException() An exception (%s) happened at remote "
"server.",
@@ -139,11 +139,11 @@ class ThinClientBaseDM {
return false;
}
bool isPutAllPartialResultException(const char* exceptionMsg) {
- if (exceptionMsg != NULL &&
+ if (exceptionMsg != nullptr &&
strstr(
exceptionMsg,
"org.apache.geode.internal.cache.PutAllPartialResultException") !=
- NULL) {
+ nullptr) {
LOGDEBUG(
"isNotAuthorizedException() An exception (%s) happened at remote "
"server.",
@@ -155,10 +155,10 @@ class ThinClientBaseDM {
protected:
bool isAuthRequireException(const char* exceptionMsg) {
- if (exceptionMsg != NULL &&
+ if (exceptionMsg != nullptr &&
strstr(exceptionMsg,
"org.apache.geode.security.AuthenticationRequiredException") !=
- NULL) {
+ nullptr) {
LOGDEBUG(
"isAuthRequireExcep() An exception (%s) happened at remote server.",
exceptionMsg);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/ThinClientCacheDistributionManager.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ThinClientCacheDistributionManager.cpp b/src/cppcache/src/ThinClientCacheDistributionManager.cpp
index 9104ecc..9175565 100644
--- a/src/cppcache/src/ThinClientCacheDistributionManager.cpp
+++ b/src/cppcache/src/ThinClientCacheDistributionManager.cpp
@@ -31,7 +31,7 @@ using namespace apache::geode::client;
ThinClientCacheDistributionManager::ThinClientCacheDistributionManager(
TcrConnectionManager& connManager)
- : ThinClientDistributionManager(connManager, NULL) {}
+ : ThinClientDistributionManager(connManager, nullptr) {}
void ThinClientCacheDistributionManager::init() {
LOGDEBUG("ThinClientCacheDistributionManager::init");
@@ -178,7 +178,7 @@ bool ThinClientCacheDistributionManager::postFailoverAction(
CacheImpl* cache = m_connManager.getCacheImpl();
- if (cache == NULL) {
+ if (cache == nullptr) {
LOGERROR("Client not initialized for failover");
return false;
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/ThinClientDistributionManager.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ThinClientDistributionManager.cpp b/src/cppcache/src/ThinClientDistributionManager.cpp
index 9063437..bc97b96 100644
--- a/src/cppcache/src/ThinClientDistributionManager.cpp
+++ b/src/cppcache/src/ThinClientDistributionManager.cpp
@@ -65,7 +65,7 @@ void ThinClientDistributionManager::destroy(bool keepAlive) {
m_endpoints[m_activeEndpoint]->unregisterDM(m_clientNotification, this);
}
LOGFINEST("ThinClientDistributionManager:: starting destroy for region %s",
- (m_region != NULL ? m_region->getFullPath() : "(null)"));
+ (m_region != nullptr ? m_region->getFullPath() : "(null)"));
destroyAction();
// stop the chunk processing thread
stopChunkProcessor();
@@ -83,7 +83,7 @@ void ThinClientDistributionManager::destroy(bool keepAlive) {
}
m_connManager.disconnect(this, m_endpoints, keepAlive);
LOGFINEST("ThinClientDistributionManager: completed destroy for region %s",
- (m_region != NULL ? m_region->getFullPath() : "(null)"));
+ (m_region != nullptr ? m_region->getFullPath() : "(null)"));
m_initDone = false;
}
@@ -204,7 +204,7 @@ void ThinClientDistributionManager::failover() {
std::vector<int> randIndex;
bool doRand = true;
LOGFINEST("DM: invoked select endpoint via failover thread for region %s",
- (m_region != NULL ? m_region->getFullPath() : "(null)"));
+ (m_region != nullptr ? m_region->getFullPath() : "(null)"));
selectEndpoint(randIndex, doRand);
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/ThinClientHARegion.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ThinClientHARegion.cpp b/src/cppcache/src/ThinClientHARegion.cpp
index 0ef2e0a..d59366e 100644
--- a/src/cppcache/src/ThinClientHARegion.cpp
+++ b/src/cppcache/src/ThinClientHARegion.cpp
@@ -41,7 +41,7 @@ ThinClientHARegion::ThinClientHARegion(const std::string& name,
void ThinClientHARegion::initTCR() {
try {
- bool isPool = m_attribute->getPoolName() != NULL &&
+ bool isPool = m_attribute->getPoolName() != nullptr &&
strlen(m_attribute->getPoolName()) > 0;
if (DistributedSystem::getSystemProperties()->isGridClient()) {
LOGWARN(
@@ -52,7 +52,7 @@ void ThinClientHARegion::initTCR() {
isPool);
}
- if (m_attribute->getPoolName() == NULL ||
+ if (m_attribute->getPoolName() == nullptr ||
strlen(m_attribute->getPoolName()) == 0) {
m_poolDM = false;
m_tcrdm = new TcrHADistributionManager(
@@ -165,7 +165,7 @@ GfErrType ThinClientHARegion::getNoThrow_FullObject(EventIdPtr eventId,
CacheablePtr& fullObject,
VersionTagPtr& versionTag) {
TcrMessageRequestEventValue fullObjectMsg(eventId);
- TcrMessageReply reply(true, NULL);
+ TcrMessageReply reply(true, nullptr);
ThinClientPoolHADM* poolHADM = dynamic_cast<ThinClientPoolHADM*>(m_tcrdm);
GfErrType err = GF_NOTCON;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/ThinClientHARegion.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ThinClientHARegion.hpp b/src/cppcache/src/ThinClientHARegion.hpp
index 9a3e711..dd5a01c 100644
--- a/src/cppcache/src/ThinClientHARegion.hpp
+++ b/src/cppcache/src/ThinClientHARegion.hpp
@@ -53,7 +53,7 @@ class CPPCACHE_EXPORT ThinClientHARegion : public ThinClientRegion {
bool enableNotification = true);
virtual ~ThinClientHARegion() {
- if (m_poolDM) m_tcrdm = NULL;
+ if (m_poolDM) m_tcrdm = nullptr;
};
virtual void initTCR();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/ThinClientLocatorHelper.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ThinClientLocatorHelper.cpp b/src/cppcache/src/ThinClientLocatorHelper.cpp
index 2942a84..bb67290 100644
--- a/src/cppcache/src/ThinClientLocatorHelper.cpp
+++ b/src/cppcache/src/ThinClientLocatorHelper.cpp
@@ -41,7 +41,7 @@ class ConnectionWrapper {
explicit ConnectionWrapper(Connector*& conn) : m_conn(conn) {}
~ConnectionWrapper() {
LOGDEBUG("closing the connection locator1");
- if (m_conn != NULL) {
+ if (m_conn != nullptr) {
LOGDEBUG("closing the connection locator");
m_conn->close();
delete m_conn;
@@ -64,7 +64,7 @@ Connector* ThinClientLocatorHelper::createConnection(Connector*& conn,
int32_t port,
uint32_t waitSeconds,
int32_t maxBuffSizePool) {
- Connector* socket = NULL;
+ Connector* socket = nullptr;
if (DistributedSystem::getSystemProperties()->sslEnabled()) {
socket = new TcpSslConn(hostname, port, waitSeconds, maxBuffSizePool);
} else {
@@ -87,7 +87,7 @@ GfErrType ThinClientLocatorHelper::getAllServers(
if (m_poolDM) {
buffSize = static_cast<int32_t>(m_poolDM->getSocketBufferSize());
}
- Connector* conn = NULL;
+ Connector* conn = nullptr;
ConnectionWrapper cw(conn);
createConnection(
conn, loc.getServerName().c_str(), loc.getPort(),
@@ -102,7 +102,7 @@ GfErrType ThinClientLocatorHelper::getAllServers(
: 10 * 1000 * 1000,
0);
if (sentLength <= 0) {
- // conn->close(); delete conn; conn = NULL;
+ // conn->close(); delete conn; conn = nullptr;
continue;
}
char buff[BUFF_SIZE];
@@ -112,7 +112,7 @@ GfErrType ThinClientLocatorHelper::getAllServers(
: 10 * 1000 * 1000,
0);
// conn->close();
- // delete conn; conn = NULL;
+ // delete conn; conn = nullptr;
if (receivedLength <= 0) {
continue;
}
@@ -151,8 +151,8 @@ GfErrType ThinClientLocatorHelper::getEndpointForNewCallBackConn(
ClientProxyMembershipID& memId, std::list<ServerLocation>& outEndpoint,
std::string& additionalLoc, int redundancy,
const std::set<ServerLocation>& exclEndPts,
- /*const std::set<TcrEndpoint*>& exclEndPts,*/ const std::string&
- serverGrp) {
+ /*const std::set<TcrEndpoint*>& exclEndPts,*/
+ const std::string& serverGrp) {
ACE_Guard<ACE_Thread_Mutex> guard(m_locatorLock);
int locatorsRetry = 3;
if (m_poolDM) {
@@ -181,7 +181,7 @@ GfErrType ThinClientLocatorHelper::getEndpointForNewCallBackConn(
if (m_poolDM) {
buffSize = static_cast<int32_t>(m_poolDM->getSocketBufferSize());
}
- Connector* conn = NULL;
+ Connector* conn = nullptr;
ConnectionWrapper cw(conn);
createConnection(
conn, loc.getServerName().c_str(), loc.getPort(),
@@ -199,7 +199,7 @@ GfErrType ThinClientLocatorHelper::getEndpointForNewCallBackConn(
1000 * 1000,
0);
if (sentLength <= 0) {
- // conn->close(); delete conn; conn = NULL;
+ // conn->close(); delete conn; conn = nullptr;
continue;
}
char buff[BUFF_SIZE];
@@ -211,7 +211,7 @@ GfErrType ThinClientLocatorHelper::getEndpointForNewCallBackConn(
1000 * 1000,
0);
// conn->close();
- // delete conn; conn = NULL;
+ // delete conn; conn = nullptr;
if (receivedLength <= 0) {
continue;
}
@@ -276,14 +276,14 @@ GfErrType ThinClientLocatorHelper::getEndpointForNewFwdConn(
if (m_poolDM) {
buffSize = static_cast<int32_t>(m_poolDM->getSocketBufferSize());
}
- Connector* conn = NULL;
+ Connector* conn = nullptr;
ConnectionWrapper cw(conn);
createConnection(
conn, serLoc.getServerName().c_str(), serLoc.getPort(),
DistributedSystem::getSystemProperties()->connectTimeout(), buffSize);
DataOutput data;
data.writeInt(1001); // GOSSIPVERSION
- if (currentServer == NULL) {
+ if (currentServer == nullptr) {
LOGDEBUG("Creating ClientConnectionRequest");
ClientConnectionRequest request(exclEndPts, serverGrp);
data.writeObject(&request);
@@ -368,7 +368,7 @@ GfErrType ThinClientLocatorHelper::updateLocators(
ACE_Guard<ACE_Thread_Mutex> guard(m_locatorLock);
for (unsigned attempts = 0; attempts < m_locHostPort.size(); attempts++) {
ServerLocation serLoc = m_locHostPort[attempts];
- Connector* conn = NULL;
+ Connector* conn = nullptr;
try {
int32_t buffSize = 0;
if (m_poolDM) {
@@ -395,7 +395,7 @@ GfErrType ThinClientLocatorHelper::updateLocators(
if (sentLength <= 0) {
// conn->close();
// delete conn;
- conn = NULL;
+ conn = nullptr;
continue;
}
char buff[BUFF_SIZE];
@@ -407,7 +407,7 @@ GfErrType ThinClientLocatorHelper::updateLocators(
1000 * 1000,
0);
// conn->close();
- // delete conn; conn = NULL;
+ // delete conn; conn = nullptr;
if (receivedLength <= 0) {
continue;
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/ThinClientLocatorHelper.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ThinClientLocatorHelper.hpp b/src/cppcache/src/ThinClientLocatorHelper.hpp
index 6ac4d0d..8ae1466 100644
--- a/src/cppcache/src/ThinClientLocatorHelper.hpp
+++ b/src/cppcache/src/ThinClientLocatorHelper.hpp
@@ -39,17 +39,17 @@ class ThinClientLocatorHelper {
public:
ThinClientLocatorHelper(std::vector<std::string> locHostPort,
const ThinClientPoolDM* poolDM);
- GfErrType getEndpointForNewFwdConn(ServerLocation& outEndpoint,
- std::string& additionalLoc,
- const std::set<ServerLocation>& exclEndPts,
- const std::string& serverGrp = "",
- const TcrConnection* currentServer = NULL);
+ GfErrType getEndpointForNewFwdConn(
+ ServerLocation& outEndpoint, std::string& additionalLoc,
+ const std::set<ServerLocation>& exclEndPts,
+ const std::string& serverGrp = "",
+ const TcrConnection* currentServer = nullptr);
GfErrType getEndpointForNewCallBackConn(
ClientProxyMembershipID& memId, std::list<ServerLocation>& outEndpoint,
std::string& additionalLoc, int redundancy,
const std::set<ServerLocation>& exclEndPts,
- /*const std::set<TcrEndpoint*>& exclEndPts,*/ const std::string&
- serverGrp);
+ /*const std::set<TcrEndpoint*>& exclEndPts,*/
+ const std::string& serverGrp);
GfErrType getAllServers(std::vector<ServerLocation>& servers,
const std::string& serverGrp);
int32_t getCurLocatorsNum() {