diff options
Diffstat (limited to 'cpp/include')
-rw-r--r-- | cpp/include/Ice/Direct.h | 20 | ||||
-rw-r--r-- | cpp/include/Ice/DispatchInterceptor.h | 34 | ||||
-rw-r--r-- | cpp/include/Ice/Ice.h | 1 | ||||
-rw-r--r-- | cpp/include/Ice/Incoming.h | 30 | ||||
-rw-r--r-- | cpp/include/Ice/IncomingAsync.h | 10 | ||||
-rw-r--r-- | cpp/include/Ice/Object.h | 24 |
6 files changed, 113 insertions, 6 deletions
diff --git a/cpp/include/Ice/Direct.h b/cpp/include/Ice/Direct.h index 33d1e5f2740..a720167b6a6 100644 --- a/cpp/include/Ice/Direct.h +++ b/cpp/include/Ice/Direct.h @@ -12,24 +12,29 @@ #include <Ice/ServantLocatorF.h> #include <Ice/ReferenceF.h> -#include <Ice/ObjectF.h> +#include <Ice/Object.h> #include <Ice/LocalObjectF.h> #include <Ice/Current.h> namespace IceInternal { -class ICE_API Direct : private IceUtil::noncopyable +class ICE_API Direct : public Ice::Request, private IceUtil::noncopyable { public: Direct(const Ice::Current&); - void destroy(); - const Ice::ObjectPtr& servant(); + const Ice::ObjectPtr& servant(); -private: + virtual bool isCollocated(); + virtual const Ice::Current& getCurrent(); + virtual DispatchStatus run(Ice::Object*) { return DispatchOK; } // = 0; + + void throwUserException(); + +protected: // // Optimization. The current may not be deleted while a @@ -37,9 +42,14 @@ private: // const Ice::Current& _current; + void setUserException(const Ice::UserException&); + +private: + Ice::ObjectPtr _servant; Ice::ServantLocatorPtr _locator; Ice::LocalObjectPtr _cookie; + std::auto_ptr<Ice::UserException> _userException; }; } diff --git a/cpp/include/Ice/DispatchInterceptor.h b/cpp/include/Ice/DispatchInterceptor.h new file mode 100644 index 00000000000..1eebc73e992 --- /dev/null +++ b/cpp/include/Ice/DispatchInterceptor.h @@ -0,0 +1,34 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#ifndef ICE_DISPATCH_INTERCEPTOR_H +#define ICE_DISPATCH_INTERCEPTOR_H + +#include <Ice/Object.h> + +namespace Ice +{ + +class ICE_API DispatchInterceptor : public virtual Object +{ +public: + + virtual IceInternal::DispatchStatus + dispatch(Request&) = 0; + + virtual IceInternal::DispatchStatus + __dispatch(IceInternal::Incoming&, const Current&); + + virtual IceInternal::DispatchStatus + __collocDispatch(IceInternal::Direct&); +}; + +} + +#endif diff --git a/cpp/include/Ice/Ice.h b/cpp/include/Ice/Ice.h index ef7c08831fc..4d8f53a8703 100644 --- a/cpp/include/Ice/Ice.h +++ b/cpp/include/Ice/Ice.h @@ -32,5 +32,6 @@ #include <Ice/ImplicitContext.h> #include <Ice/Locator.h> #include <Ice/Router.h> +#include <Ice/DispatchInterceptor.h> #endif diff --git a/cpp/include/Ice/Incoming.h b/cpp/include/Ice/Incoming.h index 7a1c6c84446..1a1aacc028c 100644 --- a/cpp/include/Ice/Incoming.h +++ b/cpp/include/Ice/Incoming.h @@ -15,17 +15,24 @@ #include <Ice/ServantLocatorF.h> #include <Ice/ServantManagerF.h> #include <Ice/BasicStream.h> +#include <Ice/Object.h> #include <Ice/Current.h> +#include <Ice/IncomingAsyncF.h> +#include <deque> namespace IceInternal { class ICE_API IncomingBase : private IceUtil::noncopyable { +public: + + void adopt(IncomingBase&); + protected: IncomingBase(Instance*, Ice::ConnectionI*, const Ice::ObjectAdapterPtr&, bool, Ice::Byte, Ice::Int); - IncomingBase(IncomingBase& in); // Adopts the argument. It must not be used afterwards. + IncomingBase(IncomingBase&); // Adopts the argument. It must not be used afterwards. void __warning(const Ice::Exception&) const; void __warning(const std::string&) const; @@ -49,6 +56,8 @@ protected: // stack-allocated Incoming still holds it. // Ice::ConnectionI* _connection; + + std::deque<Ice::DispatchInterceptorAsyncCallbackPtr> _interceptorAsyncCallbackQueue; }; class ICE_API Incoming : public IncomingBase @@ -57,6 +66,22 @@ public: Incoming(Instance*, Ice::ConnectionI*, const Ice::ObjectAdapterPtr&, bool, Ice::Byte, Ice::Int); + const Ice::Current& getCurrent() + { + return _current; + } + + void push(const Ice::DispatchInterceptorAsyncCallbackPtr&); + void pop(); + void startOver(); + void killAsync(); + void setActive(IncomingAsync&); + + bool isRetriable() + { + return _inParamPos != 0; + } + void invoke(const ServantManagerPtr&); // Inlined for speed optimization. @@ -66,6 +91,9 @@ public: private: BasicStream _is; + + IncomingAsyncPtr _cb; + Ice::Byte* _inParamPos; }; } diff --git a/cpp/include/Ice/IncomingAsync.h b/cpp/include/Ice/IncomingAsync.h index e7c5ba20ece..fdc05932c8e 100644 --- a/cpp/include/Ice/IncomingAsync.h +++ b/cpp/include/Ice/IncomingAsync.h @@ -26,6 +26,8 @@ public: IncomingAsync(Incoming&); // Adopts the argument. It must not be used afterwards. + void __deactivate(Incoming&); + protected: void __response(bool); @@ -33,6 +35,11 @@ protected: void __exception(const std::exception&); void __exception(); + bool __validateResponse(bool); + bool __validateException(const std::exception&); + bool __validateException(); + + // Inlined for speed optimization. BasicStream* __os() { return &_os; } @@ -51,6 +58,9 @@ private: // holds a ConnectionI* for optimization. // const Ice::ConnectionIPtr _connectionCopy; + + const bool _retriable; + bool _active; }; } diff --git a/cpp/include/Ice/Object.h b/cpp/include/Ice/Object.h index d09690f0499..3b4e8390c26 100644 --- a/cpp/include/Ice/Object.h +++ b/cpp/include/Ice/Object.h @@ -11,6 +11,7 @@ #define ICE_OBJECT_H #include <IceUtil/Mutex.h> +#include <IceUtil/Shared.h> #include <Ice/GCShared.h> #include <Ice/ObjectF.h> #include <Ice/ProxyF.h> @@ -23,6 +24,7 @@ namespace IceInternal class Incoming; class BasicStream; +class Direct; enum DispatchStatus { @@ -42,6 +44,25 @@ enum DispatchStatus namespace Ice { +class ICE_API DispatchInterceptorAsyncCallback : public virtual IceUtil::Shared +{ +public: + + virtual bool response(bool) = 0; + virtual bool exception(const std::exception&) = 0; + virtual bool exception() = 0; +}; +typedef IceUtil::Handle<DispatchInterceptorAsyncCallback> DispatchInterceptorAsyncCallbackPtr; + +class ICE_API Request +{ +public: + + virtual ~Request() {} + virtual bool isCollocated() = 0; + virtual const Current& getCurrent() = 0; +}; + // // No virtual inheritance from IceInternal::GCShared is required. This // used to be virtual inheritance from IceUtil::Shared, because we @@ -81,7 +102,10 @@ public: virtual void ice_postUnmarshal(); static std::string __all[]; + + virtual IceInternal::DispatchStatus ice_dispatch(Ice::Request&, const DispatchInterceptorAsyncCallbackPtr& = 0); virtual IceInternal::DispatchStatus __dispatch(IceInternal::Incoming&, const Current&); + virtual IceInternal::DispatchStatus __collocDispatch(IceInternal::Direct&); virtual void __write(IceInternal::BasicStream*) const; virtual void __read(IceInternal::BasicStream*, bool); |