Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove amd parameter from Incoming functions #1918

Merged
merged 4 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions cpp/include/Ice/Exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,38 +79,6 @@ namespace Ice
virtual void _readImpl(::Ice::InputStream*) {}
/// \endcond
};

/**
* Base class for all Ice system exceptions.
*
* System exceptions are currently Ice internal, non-documented
* exceptions.
* \headerfile Ice/Ice.h
*/
class ICE_API SystemException : public IceUtil::Exception
{
public:
/**
* The file and line number are required for all local exceptions.
* @param file The file name in which the exception was raised, typically __FILE__.
* @param line The line number at which the exception was raised, typically __LINE__.
*/
SystemException(const char* file, int line);
SystemException(const SystemException&) = default;
virtual ~SystemException();

/**
* Polymorphically clones this exception.
* @return A shallow copy of this exception.
*/
std::unique_ptr<SystemException> ice_clone() const;

/**
* Obtains the Slice type ID of this exception.
* @return The fully-scoped type ID.
*/
static std::string_view ice_staticId();
};
}

namespace IceInternal
Expand Down
10 changes: 5 additions & 5 deletions cpp/include/Ice/Incoming.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ namespace IceInternal
void writeParamEncaps(const std::uint8_t*, std::int32_t, bool ok);
void setMarshaledResult(Ice::MarshaledResult&&);

void response(bool amd);
void exception(std::exception_ptr, bool amd);

void setFormat(Ice::FormatType format) { _format = format; }

void invoke(const ServantManagerPtr&, Ice::InputStream*);
Expand Down Expand Up @@ -89,12 +86,15 @@ namespace IceInternal
private:
void setResponseSent();

void sendResponse();
void sendException(std::exception_ptr);

void warning(const Ice::Exception&) const;
void warning(std::exception_ptr) const;

bool servantLocatorFinished(bool amd);
bool servantLocatorFinished();

void handleException(std::exception_ptr, bool amd);
void handleException(std::exception_ptr);

Ice::Current _current;
std::shared_ptr<Ice::Object> _servant;
Expand Down
54 changes: 14 additions & 40 deletions cpp/src/Ice/CollocatedRequestHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ CollocatedRequestHandler::invokeAsyncRequest(OutgoingAsyncBase* outAsync, int ba
}

void
CollocatedRequestHandler::sendResponse(int32_t requestId, OutputStream* os, uint8_t, bool amd)
CollocatedRequestHandler::sendResponse(int32_t requestId, OutputStream* os, uint8_t)
{
OutgoingAsyncBasePtr outAsync;
{
Expand Down Expand Up @@ -222,19 +222,10 @@ CollocatedRequestHandler::sendResponse(int32_t requestId, OutputStream* os, uint

if (outAsync)
{
//
// If called from an AMD dispatch, invoke asynchronously
// the completion callback since this might be called from
// the user code.
//
if (amd)
{
outAsync->invokeResponseAsync();
}
else
{
outAsync->invokeResponse();
}
// We invoke the response using a thread-pool thread. If the invocation is a lambda async invocation, we want
// the callbacks to execute in a thread-pool thread - never in the application thread that sent the response
// via AMD.
outAsync->invokeResponseAsync();
}

_adapter->decDirectCount();
Expand All @@ -246,18 +237,10 @@ CollocatedRequestHandler::sendNoResponse()
_adapter->decDirectCount();
}

bool
CollocatedRequestHandler::systemException(int32_t requestId, exception_ptr ex, bool amd)
{
handleException(requestId, ex, amd);
_adapter->decDirectCount();
return true;
}

void
CollocatedRequestHandler::invokeException(int32_t requestId, exception_ptr ex, int /*invokeNum*/, bool amd)
CollocatedRequestHandler::invokeException(int32_t requestId, exception_ptr ex, int /*invokeNum*/)
{
handleException(requestId, ex, amd);
handleException(requestId, ex);
_adapter->decDirectCount();
}

Expand Down Expand Up @@ -338,7 +321,7 @@ CollocatedRequestHandler::invokeAll(OutputStream* os, int32_t requestId, int32_t
}
catch (const ObjectAdapterDeactivatedException&)
{
handleException(requestId, current_exception(), false);
handleException(requestId, current_exception());
break;
}

Expand All @@ -350,14 +333,14 @@ CollocatedRequestHandler::invokeAll(OutputStream* os, int32_t requestId, int32_t
}
catch (const LocalException&)
{
invokeException(requestId, current_exception(), invokeNum, false); // Fatal invocation exception
invokeException(requestId, current_exception(), invokeNum); // Fatal invocation exception
}

_adapter->decDirectCount();
}

void
CollocatedRequestHandler::handleException(int requestId, std::exception_ptr ex, bool amd)
CollocatedRequestHandler::handleException(int requestId, std::exception_ptr ex)
{
if (requestId == 0)
{
Expand All @@ -381,18 +364,9 @@ CollocatedRequestHandler::handleException(int requestId, std::exception_ptr ex,

if (outAsync)
{
//
// If called from an AMD dispatch, invoke asynchronously
// the completion callback since this might be called from
// the user code.
//
if (amd)
{
outAsync->invokeExceptionAsync();
}
else
{
outAsync->invokeException();
}
// We invoke the exception using a thread-pool thread. If the invocation is a lambda async invocation, we want
// the callbacks to execute in a thread-pool thread - never in the application thread that sent the exception
// via AMD.
outAsync->invokeExceptionAsync();
}
}
7 changes: 3 additions & 4 deletions cpp/src/Ice/CollocatedRequestHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ namespace IceInternal

virtual void asyncRequestCanceled(const OutgoingAsyncBasePtr&, std::exception_ptr);

virtual void sendResponse(std::int32_t, Ice::OutputStream*, std::uint8_t, bool);
virtual void sendResponse(std::int32_t, Ice::OutputStream*, std::uint8_t);
virtual void sendNoResponse();
virtual bool systemException(std::int32_t, std::exception_ptr, bool);
virtual void invokeException(std::int32_t, std::exception_ptr, int, bool);
virtual void invokeException(std::int32_t, std::exception_ptr, int);

virtual Ice::ConnectionIPtr getConnection();
virtual Ice::ConnectionIPtr waitForConnection();
Expand All @@ -55,7 +54,7 @@ namespace IceInternal
}

private:
void handleException(std::int32_t, std::exception_ptr, bool);
void handleException(std::int32_t, std::exception_ptr);

const std::shared_ptr<Ice::ObjectAdapterI> _adapter;
const bool _dispatcher;
Expand Down
12 changes: 3 additions & 9 deletions cpp/src/Ice/ConnectionI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,7 @@ Ice::ConnectionI::asyncRequestCanceled(const OutgoingAsyncBasePtr& outAsync, exc
}

void
Ice::ConnectionI::sendResponse(int32_t, OutputStream* os, uint8_t compressFlag, bool /*amd*/)
Ice::ConnectionI::sendResponse(int32_t, OutputStream* os, uint8_t compressFlag)
{
std::unique_lock lock(_mutex);
assert(_state > StateNotValidated);
Expand Down Expand Up @@ -1169,14 +1169,8 @@ Ice::ConnectionI::sendNoResponse()
}
}

bool
Ice::ConnectionI::systemException(int32_t, std::exception_ptr, bool /*amd*/)
{
return false; // System exceptions aren't marshalled.
}

void
Ice::ConnectionI::invokeException(int32_t, exception_ptr ex, int invokeNum, bool /*amd*/)
Ice::ConnectionI::invokeException(int32_t, exception_ptr ex, int invokeNum)
{
//
// Fatal exception while invoking a request. Since sendResponse/sendNoResponse isn't
Expand Down Expand Up @@ -3395,7 +3389,7 @@ Ice::ConnectionI::invokeAll(
}
catch (const LocalException&)
{
invokeException(requestId, current_exception(), invokeNum, false); // Fatal invocation exception
invokeException(requestId, current_exception(), invokeNum); // Fatal invocation exception
}
}

Expand Down
5 changes: 2 additions & 3 deletions cpp/src/Ice/ConnectionI.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,9 @@ namespace Ice

virtual void asyncRequestCanceled(const IceInternal::OutgoingAsyncBasePtr&, std::exception_ptr);

virtual void sendResponse(std::int32_t, Ice::OutputStream*, std::uint8_t, bool);
virtual void sendResponse(std::int32_t, Ice::OutputStream*, std::uint8_t);
virtual void sendNoResponse();
virtual bool systemException(std::int32_t, std::exception_ptr, bool);
virtual void invokeException(std::int32_t, std::exception_ptr, int, bool);
virtual void invokeException(std::int32_t, std::exception_ptr, int);

IceInternal::EndpointIPtr endpoint() const;
IceInternal::ConnectorPtr connector() const;
Expand Down
21 changes: 0 additions & 21 deletions cpp/src/Ice/Exception.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,27 +132,6 @@ Ice::LocalException::ice_staticId()
return localException_ids[0];
}

Ice::SystemException::SystemException(const char* file, int line) : Exception(file, line) {}

Ice::SystemException::~SystemException() {}

unique_ptr<Ice::SystemException>
Ice::SystemException::ice_clone() const
{
return unique_ptr<SystemException>(static_cast<SystemException*>(ice_cloneImpl()));
}

namespace
{
const string systemException_ids[] = {"::Ice::SystemException"};
}

std::string_view
Ice::SystemException::ice_staticId()
{
return systemException_ids[0];
}

void
Ice::InitializationException::ice_print(ostream& out) const
{
Expand Down
Loading
Loading