diff options
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Freeze/EvictorI.cpp | 5 | ||||
-rw-r--r-- | cpp/src/Glacier/Blobject.cpp | 6 | ||||
-rw-r--r-- | cpp/src/Glacier/Missive.cpp | 6 | ||||
-rw-r--r-- | cpp/src/Ice/Incoming.cpp | 2 | ||||
-rw-r--r-- | cpp/src/Ice/Outgoing.cpp | 4 | ||||
-rw-r--r-- | cpp/src/Ice/Proxy.cpp | 40 | ||||
-rw-r--r-- | cpp/src/IceStorm/IceStormInternal.ice | 3 | ||||
-rw-r--r-- | cpp/src/IceStorm/LinkSubscriber.cpp | 2 | ||||
-rw-r--r-- | cpp/src/IceStorm/OnewaySubscriber.cpp | 2 | ||||
-rw-r--r-- | cpp/src/IceStorm/Subscriber.h | 2 | ||||
-rw-r--r-- | cpp/src/IceStorm/TopicI.cpp | 8 | ||||
-rw-r--r-- | cpp/src/Slice/Parser.cpp | 18 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 12 | ||||
-rw-r--r-- | cpp/src/slice2java/Gen.cpp | 43 |
14 files changed, 91 insertions, 62 deletions
diff --git a/cpp/src/Freeze/EvictorI.cpp b/cpp/src/Freeze/EvictorI.cpp index 4e11ff221ca..99213015ff1 100644 --- a/cpp/src/Freeze/EvictorI.cpp +++ b/cpp/src/Freeze/EvictorI.cpp @@ -317,12 +317,9 @@ Freeze::EvictorI::finished(const ObjectAdapterPtr&, const Current& current, // If we are in SaveAfterMutatingOperation mode, we must save the // Ice Object if this was a mutating call. // - // TODO: ML: Badly broken now, we don't save if an operation is - // mutating and idempotent!!! - // if(_persistenceMode == SaveAfterMutatingOperation) { - if(!current.idempotent) + if(current.mode != ::Ice::Nonmutating) { _dict.insert(make_pair(current.id, servant)); } diff --git a/cpp/src/Glacier/Blobject.cpp b/cpp/src/Glacier/Blobject.cpp index bfd9626d994..7a9a3ae5c84 100644 --- a/cpp/src/Glacier/Blobject.cpp +++ b/cpp/src/Glacier/Blobject.cpp @@ -74,16 +74,16 @@ Glacier::Blobject::invoke(ObjectPrx& proxy, const vector<Byte>& inParams, vector out << "routing to:\n" << "proxy = " << _communicator->proxyToString(proxy) << '\n' << "operation = " << current.operation << '\n' - << "idempotent = " << (current.idempotent ? "true" : "false"); + << "mode = " << current.mode; } if(_forwardContext) { - return proxy->ice_invoke(current.operation, current.idempotent, inParams, outParams, current.ctx); + return proxy->ice_invoke(current.operation, current.mode, inParams, outParams, current.ctx); } else { - return proxy->ice_invoke(current.operation, current.idempotent, inParams, outParams); + return proxy->ice_invoke(current.operation, current.mode, inParams, outParams); } } } diff --git a/cpp/src/Glacier/Missive.cpp b/cpp/src/Glacier/Missive.cpp index d7fdc924d6b..694d8897d18 100644 --- a/cpp/src/Glacier/Missive.cpp +++ b/cpp/src/Glacier/Missive.cpp @@ -34,11 +34,11 @@ Glacier::Missive::invoke() std::vector<Byte> dummy; if(_forwardContext) { - _proxy->ice_invoke(_current.operation, _current.idempotent, _inParams, dummy, _current.ctx); + _proxy->ice_invoke(_current.operation, _current.mode, _inParams, dummy, _current.ctx); } else { - _proxy->ice_invoke(_current.operation, _current.idempotent, _inParams, dummy); + _proxy->ice_invoke(_current.operation, _current.mode, _inParams, dummy); } } @@ -161,7 +161,7 @@ Glacier::MissiveQueue::run() out << "batch routing to:\n" << "proxy = " << _communicator->proxyToString(proxy) << '\n' << "operation = " << current.operation << '\n' - << "idempotent = " << (current.idempotent ? "true" : "false"); + << "mode = " << current.mode; } (*p)->invoke(); diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp index 3f956cef439..a8f1744450a 100644 --- a/cpp/src/Ice/Incoming.cpp +++ b/cpp/src/Ice/Incoming.cpp @@ -32,7 +32,7 @@ IceInternal::Incoming::invoke(bool response) current.id.__read(&_is); _is.read(current.facet); _is.read(current.operation); - _is.read(current.idempotent); + _is.read(static_cast<Byte>(current.mode)); Int sz; _is.readSize(sz); while(sz--) diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp index 46085df1879..e5f2dd52318 100644 --- a/cpp/src/Ice/Outgoing.cpp +++ b/cpp/src/Ice/Outgoing.cpp @@ -37,7 +37,7 @@ IceInternal::NonRepeatable::get() const } IceInternal::Outgoing::Outgoing(const ConnectionPtr& connection, const ReferencePtr& ref, const string& operation, - bool idempotent, const Context& context) : + OperationMode mode, const Context& context) : _connection(connection), _reference(ref), _state(StateUnsent), @@ -65,7 +65,7 @@ IceInternal::Outgoing::Outgoing(const ConnectionPtr& connection, const Reference _reference->identity.__write(&_os); _os.write(_reference->facet); _os.write(operation); - _os.write(idempotent); + _os.write(static_cast<Byte>(mode)); _os.writeSize(Int(context.size())); Context::const_iterator p; for(p = context.begin(); p != context.end(); ++p) diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index 098987d2d24..bdbf6b52cbe 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -249,7 +249,7 @@ IceProxy::Ice::Object::ice_facets(const Context& __context) bool IceProxy::Ice::Object::ice_invoke(const string& operation, - bool idempotent, + OperationMode mode, const vector<Byte>& inParams, vector<Byte>& outParams, const Context& context) @@ -260,7 +260,7 @@ IceProxy::Ice::Object::ice_invoke(const string& operation, try { Handle< ::IceDelegate::Ice::Object> __del = __getDelegate(); - return __del->ice_invoke(operation, idempotent, inParams, outParams, context); + return __del->ice_invoke(operation, mode, inParams, outParams, context); } catch(const LocationForward& __ex) { @@ -268,7 +268,8 @@ IceProxy::Ice::Object::ice_invoke(const string& operation, } catch(const NonRepeatable& __ex) { - if(idempotent) + bool canRetry = mode == Nonmutating || mode == Idempotent; + if(canRetry) { __handleException(*__ex.get(), __cnt); } @@ -746,7 +747,7 @@ bool IceDelegateM::Ice::Object::ice_isA(const string& __id, const Context& __context) { static const string __operation("ice_isA"); - Outgoing __out(__connection, __reference, __operation, true, __context); + Outgoing __out(__connection, __reference, __operation, ::Ice::Nonmutating, __context); BasicStream* __is = __out.is(); BasicStream* __os = __out.os(); __os->write(__id); @@ -763,7 +764,7 @@ void IceDelegateM::Ice::Object::ice_ping(const Context& __context) { static const string __operation("ice_ping"); - Outgoing __out(__connection, __reference, __operation, true, __context); + Outgoing __out(__connection, __reference, __operation, ::Ice::Nonmutating, __context); if(!__out.invoke()) { throw ::Ice::UnknownUserException(__FILE__, __LINE__); @@ -774,7 +775,7 @@ vector<string> IceDelegateM::Ice::Object::ice_ids(const Context& __context) { static const string __operation("ice_ids"); - Outgoing __out(__connection, __reference, __operation, true, __context); + Outgoing __out(__connection, __reference, __operation, ::Ice::Nonmutating, __context); BasicStream* __is = __out.is(); if(!__out.invoke()) { @@ -789,7 +790,7 @@ string IceDelegateM::Ice::Object::ice_id(const Context& __context) { static const string __operation("ice_id"); - Outgoing __out(__connection, __reference, __operation, true, __context); + Outgoing __out(__connection, __reference, __operation, ::Ice::Nonmutating, __context); BasicStream* __is = __out.is(); if(!__out.invoke()) { @@ -804,7 +805,7 @@ vector<string> IceDelegateM::Ice::Object::ice_facets(const Context& __context) { static const string __operation("ice_facets"); - Outgoing __out(__connection, __reference, __operation, true, __context); + Outgoing __out(__connection, __reference, __operation, ::Ice::Nonmutating, __context); BasicStream* __is = __out.is(); if(!__out.invoke()) { @@ -817,12 +818,12 @@ IceDelegateM::Ice::Object::ice_facets(const Context& __context) bool IceDelegateM::Ice::Object::ice_invoke(const string& operation, - bool idempotent, + ::Ice::OperationMode mode, const vector<Byte>& inParams, vector<Byte>& outParams, const Context& context) { - Outgoing __out(__connection, __reference, operation, idempotent, context); + Outgoing __out(__connection, __reference, operation, mode, context); BasicStream* __os = __out.os(); __os->writeBlob(inParams); bool ok = __out.invoke(); @@ -1054,7 +1055,7 @@ bool IceDelegateD::Ice::Object::ice_isA(const string& __id, const Context& __context) { Current __current; - __initCurrent(__current, "ice_isA", true, __context); + __initCurrent(__current, "ice_isA", ::Ice::Nonmutating, __context); while(true) { Direct __direct(__adapter, __current); @@ -1082,7 +1083,7 @@ void IceDelegateD::Ice::Object::ice_ping(const ::Ice::Context& __context) { Current __current; - __initCurrent(__current, "ice_ping", true, __context); + __initCurrent(__current, "ice_ping", ::Ice::Nonmutating, __context); while(true) { Direct __direct(__adapter, __current); @@ -1110,7 +1111,7 @@ vector<string> IceDelegateD::Ice::Object::ice_ids(const ::Ice::Context& __context) { Current __current; - __initCurrent(__current, "ice_ids", true, __context); + __initCurrent(__current, "ice_ids", ::Ice::Nonmutating, __context); while(true) { Direct __direct(__adapter, __current); @@ -1138,7 +1139,7 @@ string IceDelegateD::Ice::Object::ice_id(const ::Ice::Context& __context) { Current __current; - __initCurrent(__current, "ice_id", true, __context); + __initCurrent(__current, "ice_id", ::Ice::Nonmutating, __context); while(true) { Direct __direct(__adapter, __current); @@ -1166,7 +1167,7 @@ vector<string> IceDelegateD::Ice::Object::ice_facets(const ::Ice::Context& __context) { Current __current; - __initCurrent(__current, "ice_facets", true, __context); + __initCurrent(__current, "ice_facets", ::Ice::Nonmutating, __context); while(true) { Direct __direct(__adapter, __current); @@ -1192,13 +1193,13 @@ IceDelegateD::Ice::Object::ice_facets(const ::Ice::Context& __context) bool IceDelegateD::Ice::Object::ice_invoke(const string& operation, - bool idempotent, + ::Ice::OperationMode mode, const vector<Byte>& inParams, vector<Byte>& outParams, const ::Ice::Context& context) { Current current; - __initCurrent(current, operation, idempotent, context); + __initCurrent(current, operation, mode, context); while(true) { Direct __direct(__adapter, current); @@ -1253,12 +1254,13 @@ IceDelegateD::Ice::Object::__copyFrom(const ::IceInternal::Handle< ::IceDelegate } void -IceDelegateD::Ice::Object::__initCurrent(Current& current, const string& op, bool idempotent, const Context& context) +IceDelegateD::Ice::Object::__initCurrent(Current& current, const string& op, ::Ice::OperationMode mode, + const Context& context) { current.id = __reference->identity; current.facet = __reference->facet; current.operation = op; - current.idempotent = idempotent; + current.mode = mode; current.ctx = context; } diff --git a/cpp/src/IceStorm/IceStormInternal.ice b/cpp/src/IceStorm/IceStormInternal.ice index 6a8170a80bd..ae5e4e83424 100644 --- a/cpp/src/IceStorm/IceStormInternal.ice +++ b/cpp/src/IceStorm/IceStormInternal.ice @@ -12,6 +12,7 @@ #define ICE_STORM_INTERNAL_ICE #include <IceStorm/IceStorm.ice> +#include <Ice/Current.ice> module IceStorm { @@ -55,7 +56,7 @@ interface TopicLink * originating request. * **/ - void forward(string op, bool \idempotent, ByteSeq data, ContextData context); + void forward(string op, Ice::OperationMode mode, ByteSeq data, ContextData context); }; /** diff --git a/cpp/src/IceStorm/LinkSubscriber.cpp b/cpp/src/IceStorm/LinkSubscriber.cpp index bce15c94903..2ea8675e538 100644 --- a/cpp/src/IceStorm/LinkSubscriber.cpp +++ b/cpp/src/IceStorm/LinkSubscriber.cpp @@ -77,7 +77,7 @@ LinkSubscriber::publish(const Event& event) try { - _obj->forward(event.op, event.idempotent, event.data, event.context); + _obj->forward(event.op, event.mode, event.data, event.context); } catch(const Ice::ObjectNotExistException& e) { diff --git a/cpp/src/IceStorm/OnewaySubscriber.cpp b/cpp/src/IceStorm/OnewaySubscriber.cpp index 9912e3bf382..73f00b7348a 100644 --- a/cpp/src/IceStorm/OnewaySubscriber.cpp +++ b/cpp/src/IceStorm/OnewaySubscriber.cpp @@ -63,7 +63,7 @@ OnewaySubscriber::publish(const Event& event) try { std::vector< ::Ice::Byte> dummy; - _obj->ice_invoke(event.op, event.idempotent, event.data, dummy, event.context); + _obj->ice_invoke(event.op, ::Ice::Idempotent, event.data, dummy, event.context); } catch(const Ice::LocalException& e) { diff --git a/cpp/src/IceStorm/Subscriber.h b/cpp/src/IceStorm/Subscriber.h index 289659863d6..b6581e6cac9 100644 --- a/cpp/src/IceStorm/Subscriber.h +++ b/cpp/src/IceStorm/Subscriber.h @@ -38,7 +38,7 @@ struct Event bool forwarded; int cost; std::string op; - bool idempotent; + Ice::OperationMode mode; std::vector< Ice::Byte> data; Ice::Context context; }; diff --git a/cpp/src/IceStorm/TopicI.cpp b/cpp/src/IceStorm/TopicI.cpp index e733b675442..10fd13fe4ed 100644 --- a/cpp/src/IceStorm/TopicI.cpp +++ b/cpp/src/IceStorm/TopicI.cpp @@ -73,7 +73,7 @@ public: { } - virtual void forward(const string&, bool, const ByteSeq&, const ContextData&, const Ice::Current&); + virtual void forward(const string&, ::Ice::OperationMode, const ByteSeq&, const ContextData&, const Ice::Current&); private: @@ -294,7 +294,7 @@ PublisherProxyI::ice_invoke(const vector< Ice::Byte>& inParams, vector< Ice::Byt event.cost = 0; // TODO: Default comes from property? } event.op = current.operation; - event.idempotent = current.idempotent; + event.mode = current.mode; event.data = inParams; event.context = context; @@ -307,14 +307,14 @@ PublisherProxyI::ice_invoke(const vector< Ice::Byte>& inParams, vector< Ice::Byt // Incoming events from linked topics. // void -TopicLinkI::forward(const string& op, bool idempotent, const ByteSeq& data, const ContextData& context, +TopicLinkI::forward(const string& op, Ice::OperationMode mode, const ByteSeq& data, const ContextData& context, const Ice::Current& current) { Event event; event.forwarded = true; event.cost = 0; event.op = op; - event.idempotent = idempotent; + event.mode = mode; event.data = data; event.context = context; diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index 748b018d952..0f070a1735c 100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -3044,6 +3044,12 @@ Slice::Operation::returnType() const return _returnType; } +Operation::Mode +Slice::Operation::mode() const +{ + return _mode; +} + ParamDeclPtr Slice::Operation::createParamDecl(const string& name, const TypePtr& type, bool isOutParam) { @@ -3148,18 +3154,6 @@ Slice::Operation::throws() const return _throws; } -bool -Slice::Operation::nonmutating() const -{ - return _mode == Nonmutating; -} - -bool -Slice::Operation::idempotent() const -{ - return _mode == Nonmutating || _mode == Idempotent; -} - void Slice::Operation::setExceptionList(const ExceptionList& el) { diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index ec98cd7ef34..2aff386f41b 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -1276,7 +1276,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) C << eb; C << nl << "catch(const ::IceInternal::NonRepeatable& __ex)"; C << sb; - if(p->idempotent()) + if(p->mode() == Operation::Idempotent || p->mode() == Operation::Nonmutating) { C << nl << "__handleException(*__ex.get(), __cnt);"; } @@ -1547,7 +1547,7 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p) C << sb; C << nl << "static const ::std::string __operation(\"" << p->name() << "\");"; C << nl << "::IceInternal::Outgoing __out(__connection, __reference, __operation, " - << (p->idempotent() ? "true" : "false") << ", __context);"; + << "static_cast< ::Ice::OperationMode>(" << p->mode() << "), __context);"; if(ret || !outParams.empty() || !throws.empty()) { C << nl << "::IceInternal::BasicStream* __is = __out.is();"; @@ -1732,8 +1732,8 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p) C << sp << nl << retS << nl << "IceDelegateD" << scoped << paramsDecl; C << sb; C << nl << "::Ice::Current __current;"; - C << nl << "__initCurrent(__current, \"" << p->name() << "\", " << (p->idempotent() ? "true" : "false") - << ", __context);"; + C << nl << "__initCurrent(__current, \"" << p->name() + << "\", static_cast< ::Ice::OperationMode>(" << p->mode() << "), __context);"; C << nl << "while(true)"; C << sb; C << nl << "::IceInternal::Direct __direct(__adapter, __current);"; @@ -2280,7 +2280,7 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p) } } - bool nonmutating = p->nonmutating(); + bool nonmutating = p->mode() == Operation::Nonmutating; H << sp; H << nl << exp2 << "virtual " << retS << ' ' << name << params << (nonmutating ? " const" : "") << " = 0;"; @@ -2832,7 +2832,7 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p) } H.restoreIndent(); - bool nonmutating = op->nonmutating(); + bool nonmutating = op->mode() == Operation::Nonmutating; H << ")" << (nonmutating ? " const" : "") << ";"; diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp index b84e18029a8..5f9ebb27a48 100644 --- a/cpp/src/slice2java/Gen.cpp +++ b/cpp/src/slice2java/Gen.cpp @@ -16,6 +16,39 @@ using namespace std; using namespace Slice; using namespace IceUtil; +namespace // anonymous +{ + +string +sliceModeToIceMode(const OperationPtr& op) +{ + string mode; + switch(op->mode()) + { + case Operation::Normal: + { + mode = "Ice.OperationMode.Normal"; + break; + } + case Operation::Nonmutating: + { + mode = "Ice.OperationMode.Nonmutating"; + break; + } + case Operation::Idempotent: + { + mode = "Ice.OperationMode.Idempotent"; + break; + } + default: + { + assert("Impossible operation mode!"); + break; + } + } + return mode; +} + Slice::JavaVisitor::JavaVisitor(const string& dir, const string& package) : JavaGenerator(dir, package) { @@ -2067,7 +2100,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) out << eb; out << nl << "catch(IceInternal.NonRepeatable __ex)"; out << sb; - if(op->idempotent()) + if(op->mode() == Operation::Idempotent || op->mode() == Operation::Nonmutating) { out << nl << "__cnt = __handleException(__ex.get(), __cnt);"; } @@ -3005,7 +3038,7 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p) out << sb; list<string> metaData = op->getMetaData(); out << nl << "IceInternal.Outgoing __out = getOutgoing(\"" << op->name() << "\", " - << (op->idempotent() ? "true" : "false") << ", __context);"; + << sliceModeToIceMode(op) << ", __context);"; out << nl << "try"; out << sb; if(!inParams.empty()) @@ -3109,6 +3142,8 @@ Slice::Gen::DelegateDVisitor::DelegateDVisitor(const string& dir, const string& { } +} + bool Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p) { @@ -3170,8 +3205,8 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p) out << sb; list<string> metaData = op->getMetaData(); out << nl << "Ice.Current __current = new Ice.Current();"; - out << nl << "__initCurrent(__current, \"" << op->name() << "\", " << (op->idempotent() ? "true" : "false") - << ", __context);"; + out << nl << "__initCurrent(__current, \"" << op->name() << "\", " + << sliceModeToIceMode(op) << ", __context);"; out << nl << "while(true)"; out << sb; out << nl << "IceInternal.Direct __direct = new IceInternal.Direct(__adapter, __current);"; |