summaryrefslogtreecommitdiff
path: root/cpp/include
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/include')
-rw-r--r--cpp/include/Ice/Config.h4
-rw-r--r--cpp/include/Ice/EndpointIF.h8
-rw-r--r--cpp/include/Ice/Outgoing.h55
-rw-r--r--cpp/include/Ice/OutgoingAsync.h74
-rw-r--r--cpp/include/Ice/OutgoingAsyncF.h11
-rw-r--r--cpp/include/Ice/ProtocolPluginFacade.h11
-rw-r--r--cpp/include/Ice/Proxy.h26
-rw-r--r--cpp/include/Ice/RequestHandlerF.h25
-rw-r--r--cpp/include/IceUtil/Timer.h20
9 files changed, 205 insertions, 29 deletions
diff --git a/cpp/include/Ice/Config.h b/cpp/include/Ice/Config.h
index be46f18545f..8563409cd9b 100644
--- a/cpp/include/Ice/Config.h
+++ b/cpp/include/Ice/Config.h
@@ -71,4 +71,8 @@ inline int getSystemErrno() { return GetLastError(); }
inline int getSystemErrno() { return errno; }
#endif
+#if defined(__linux) && !defined(ICE_NO_EPOLL)
+# define ICE_USE_EPOLL 1
+#endif
+
#endif
diff --git a/cpp/include/Ice/EndpointIF.h b/cpp/include/Ice/EndpointIF.h
index 841a6948e3d..1e530d1e75d 100644
--- a/cpp/include/Ice/EndpointIF.h
+++ b/cpp/include/Ice/EndpointIF.h
@@ -17,8 +17,12 @@ namespace IceInternal
{
class EndpointI;
-ICE_API Ice::LocalObject* upCast(IceInternal::EndpointI*);
-typedef IceInternal::Handle<EndpointI> EndpointIPtr;
+ICE_API Ice::LocalObject* upCast(EndpointI*);
+typedef Handle<EndpointI> EndpointIPtr;
+
+class EndpointHostResolver;
+ICE_API IceUtil::Shared* upCast(EndpointHostResolver*);
+typedef Handle<EndpointHostResolver> EndpointHostResolverPtr;
}
diff --git a/cpp/include/Ice/Outgoing.h b/cpp/include/Ice/Outgoing.h
index c2cdfc040b3..10f3db806e0 100644
--- a/cpp/include/Ice/Outgoing.h
+++ b/cpp/include/Ice/Outgoing.h
@@ -12,6 +12,8 @@
#include <IceUtil/Mutex.h>
#include <IceUtil/Monitor.h>
+#include <Ice/RequestHandlerF.h>
+#include <Ice/InstanceF.h>
#include <Ice/ConnectionIF.h>
#include <Ice/ReferenceF.h>
#include <Ice/BasicStream.h>
@@ -59,15 +61,26 @@ private:
bool _retry;
};
-class ICE_API Outgoing : private IceUtil::noncopyable
+class ICE_API OutgoingMessageCallback : private IceUtil::noncopyable
{
public:
- Outgoing(Ice::ConnectionI*, Reference*, const std::string&, Ice::OperationMode, const Ice::Context*, bool);
+ virtual ~OutgoingMessageCallback() { }
+
+ virtual void sent(bool) = 0;
+ virtual void finished(const Ice::LocalException&) = 0;
+};
+
+class ICE_API Outgoing : public OutgoingMessageCallback
+{
+public:
+
+ Outgoing(RequestHandler*, const std::string&, Ice::OperationMode, const Ice::Context*);
bool invoke(); // Returns true if ok, false if user exception.
void abort(const Ice::LocalException&);
- void finished(BasicStream&);
+ virtual void sent(bool);
+ virtual void finished(BasicStream&);
void finished(const Ice::LocalException&);
// Inlined for speed optimization.
@@ -77,11 +90,10 @@ public:
private:
//
- // Optimization. The connection and the reference may not be
+ // Optimization. The request handler and the reference may not be
// deleted while a stack-allocated Outgoing still holds it.
//
- Ice::ConnectionI* _connection;
- Reference* _reference;
+ RequestHandler* _handler;
std::auto_ptr<Ice::LocalException> _exception;
@@ -91,13 +103,13 @@ private:
StateInProgress,
StateOK,
StateUserException,
- StateLocalException
+ StateLocalException,
+ StateFailed
} _state;
BasicStream _is;
BasicStream _os;
-
- const bool _compress;
+ bool _sent;
//
// NOTE: we use an attribute for the monitor instead of inheriting
@@ -109,6 +121,31 @@ private:
IceUtil::Monitor<IceUtil::Mutex> _monitor;
};
+class BatchOutgoing : public OutgoingMessageCallback
+{
+public:
+
+ BatchOutgoing(RequestHandler*);
+ BatchOutgoing(Ice::ConnectionI*, Instance*);
+
+ void invoke();
+
+ virtual void sent(bool);
+ virtual void finished(const Ice::LocalException&);
+
+ BasicStream* os() { return &_os; }
+
+private:
+
+ IceUtil::Monitor<IceUtil::Mutex> _monitor;
+ RequestHandler* _handler;
+ Ice::ConnectionI* _connection;
+ bool _sent;
+ std::auto_ptr<Ice::LocalException> _exception;
+
+ BasicStream _os;
+};
+
}
#endif
diff --git a/cpp/include/Ice/OutgoingAsync.h b/cpp/include/Ice/OutgoingAsync.h
index ffcc03236e0..8871ba08a68 100644
--- a/cpp/include/Ice/OutgoingAsync.h
+++ b/cpp/include/Ice/OutgoingAsync.h
@@ -11,8 +11,10 @@
#define ICE_OUTGOING_ASYNC_H
#include <IceUtil/Monitor.h>
-#include <IceUtil/RecMutex.h>
+#include <IceUtil/Mutex.h>
+#include <IceUtil/Timer.h>
#include <Ice/OutgoingAsyncF.h>
+#include <Ice/InstanceF.h>
#include <Ice/ReferenceF.h>
#include <Ice/ConnectionIF.h>
#include <Ice/Current.h>
@@ -21,22 +23,43 @@ namespace IceInternal
{
class BasicStream;
+class LocalExceptionWrapper;
+class Outgoing;
+
+class ICE_API OutgoingAsyncMessageCallback : virtual public IceUtil::Shared
+{
+public:
+
+ virtual ~OutgoingAsyncMessageCallback() { }
+
+ virtual void __sent(Ice::ConnectionI*) = 0;
+ virtual void __finished(const Ice::LocalException&) = 0;
+};
//
// We need virtual inheritance from shared, because the user might use
// multiple inheritance from IceUtil::Shared.
//
-class ICE_API OutgoingAsync : virtual public IceUtil::Shared
+class ICE_API OutgoingAsync : public OutgoingAsyncMessageCallback, public IceUtil::TimerTask
{
public:
OutgoingAsync();
virtual ~OutgoingAsync();
+ void __sent(Ice::ConnectionI*);
+
+ BasicStream*
+ __getOs()
+ {
+ return __os;
+ }
+
virtual void ice_exception(const Ice::Exception&) = 0;
void __finished(BasicStream&);
void __finished(const Ice::LocalException&);
+ void __finished(const LocalExceptionWrapper&);
protected:
@@ -50,17 +73,51 @@ protected:
private:
+ void runTimerTask(); // Implementation of TimerTask::runTimerTask()
+
void warning(const std::exception&) const;
void warning() const;
void cleanup();
+ bool _sent;
+ bool _response;
::Ice::ObjectPrx _proxy;
- ::IceInternal::Handle< ::IceDelegate::Ice::Object> _delegate;
+ Handle< ::IceDelegate::Ice::Object> _delegate;
int _cnt;
Ice::OperationMode _mode;
- IceUtil::Monitor<IceUtil::RecMutex> _monitor;
+ Ice::ConnectionIPtr _timerTaskConnection;
+ IceUtil::Monitor<IceUtil::Mutex> _monitor;
+};
+
+class ICE_API BatchOutgoingAsync : public OutgoingAsyncMessageCallback
+{
+public:
+
+ BatchOutgoingAsync();
+
+ void __prepare(const InstancePtr&);
+ virtual void __sent(Ice::ConnectionI*);
+ virtual void __finished(const Ice::LocalException&);
+
+ BasicStream*
+ __getOs()
+ {
+ return _os;
+ }
+
+ virtual void ice_exception(const Ice::Exception&) = 0;
+
+private:
+
+ void warning(const std::exception&) const;
+ void warning() const;
+
+ void cleanup();
+
+ IceUtil::Monitor<IceUtil::Mutex> _monitor;
+ BasicStream* _os;
};
}
@@ -98,6 +155,15 @@ protected:
virtual void __response(bool);
};
+class ICE_API AMI_Object_ice_flushBatchRequests : public IceInternal::BatchOutgoingAsync
+{
+public:
+
+ void __invoke(const Ice::ObjectPrx&);
+
+ virtual void ice_exception(const Ice::Exception&) = 0;
+};
+
}
#endif
diff --git a/cpp/include/Ice/OutgoingAsyncF.h b/cpp/include/Ice/OutgoingAsyncF.h
index 21f9b5f4737..769c319db85 100644
--- a/cpp/include/Ice/OutgoingAsyncF.h
+++ b/cpp/include/Ice/OutgoingAsyncF.h
@@ -21,6 +21,14 @@ class OutgoingAsync;
ICE_API IceUtil::Shared* upCast(OutgoingAsync*);
typedef IceInternal::Handle<OutgoingAsync> OutgoingAsyncPtr;
+class OutgoingAsyncMessageCallback;
+ICE_API IceUtil::Shared* upCast(OutgoingAsyncMessageCallback*);
+typedef IceInternal::Handle<OutgoingAsyncMessageCallback> OutgoingAsyncMessageCallbackPtr;
+
+class BatchOutgoingAsync;
+ICE_API IceUtil::Shared* upCast(BatchOutgoingAsync*);
+typedef IceInternal::Handle<BatchOutgoingAsync> BatchOutgoingAsyncPtr;
+
}
namespace Ice
@@ -28,6 +36,7 @@ namespace Ice
class AMI_Object_ice_invoke;
class AMI_Array_Object_ice_invoke;
+class AMI_Object_ice_flushBatchRequests;
}
@@ -36,6 +45,7 @@ namespace IceInternal
ICE_API IceUtil::Shared* upCast(::Ice::AMI_Object_ice_invoke*);
ICE_API IceUtil::Shared* upCast(::Ice::AMI_Array_Object_ice_invoke*);
+ICE_API IceUtil::Shared* upCast(::Ice::AMI_Object_ice_flushBatchRequests*);
}
@@ -44,6 +54,7 @@ namespace Ice
typedef IceInternal::Handle<AMI_Object_ice_invoke> AMI_Object_ice_invokePtr;
typedef IceInternal::Handle<AMI_Array_Object_ice_invoke> AMI_Array_Object_ice_invokePtr;
+typedef IceInternal::Handle<AMI_Object_ice_flushBatchRequests> AMI_Object_ice_flushBatchRequestsPtr;
}
diff --git a/cpp/include/Ice/ProtocolPluginFacade.h b/cpp/include/Ice/ProtocolPluginFacade.h
index 7228cba5b48..31ff388284f 100644
--- a/cpp/include/Ice/ProtocolPluginFacade.h
+++ b/cpp/include/Ice/ProtocolPluginFacade.h
@@ -15,6 +15,7 @@
#include <Ice/CommunicatorF.h>
#include <Ice/EndpointFactoryF.h>
#include <Ice/InstanceF.h>
+#include <Ice/EndpointIF.h>
namespace IceInternal
{
@@ -51,10 +52,20 @@ public:
const char* getNetworkTraceCategory() const;
//
+ // Get the endpoint host resolver.
+ //
+ EndpointHostResolverPtr getEndpointHostResolver() const;
+
+ //
// Register an EndpointFactory.
//
void addEndpointFactory(const EndpointFactoryPtr&) const;
+ //
+ // Get an EndpointFactory.
+ //
+ EndpointFactoryPtr getEndpointFactory(Ice::Short) const;
+
private:
ProtocolPluginFacade(const Ice::CommunicatorPtr&);
diff --git a/cpp/include/Ice/Proxy.h b/cpp/include/Ice/Proxy.h
index 2e2696b0c86..c3112addc6a 100644
--- a/cpp/include/Ice/Proxy.h
+++ b/cpp/include/Ice/Proxy.h
@@ -15,6 +15,7 @@
#include <Ice/ProxyF.h>
#include <Ice/ProxyFactoryF.h>
#include <Ice/ConnectionIF.h>
+#include <Ice/RequestHandlerF.h>
#include <Ice/EndpointIF.h>
#include <Ice/Endpoint.h>
#include <Ice/ObjectF.h>
@@ -235,6 +236,9 @@ public:
::Ice::ConnectionPtr ice_getConnection();
::Ice::ConnectionPtr ice_getCachedConnection() const;
+ void ice_flushBatchRequests();
+ void ice_flushBatchRequests_async(const ::Ice::AMI_Object_ice_flushBatchRequestsPtr&);
+
::IceInternal::ReferencePtr __reference() const;
void __copyFrom(const ::Ice::ObjectPrx&);
void __handleException(const ::IceInternal::Handle< ::IceDelegate::Ice::Object>&,
@@ -246,7 +250,9 @@ public:
void __checkTwowayOnly(const char*) const;
void __checkTwowayOnly(const ::std::string&) const;
- ::IceInternal::Handle< ::IceDelegate::Ice::Object> __getDelegate();
+ ::IceInternal::Handle< ::IceDelegate::Ice::Object> __getDelegate(bool);
+ void __setRequestHandler(const ::IceInternal::Handle< ::IceDelegate::Ice::Object>&,
+ const ::IceInternal::RequestHandlerPtr&);
protected:
@@ -299,8 +305,10 @@ public:
virtual bool ice_invoke(const ::std::string&, ::Ice::OperationMode,
const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&,
::std::vector< ::Ice::Byte>&, const ::Ice::Context*) = 0;
+ virtual void ice_flushBatchRequests() = 0;
- virtual ::Ice::ConnectionIPtr __getConnection(bool&) const = 0;
+ virtual ::IceInternal::RequestHandlerPtr __getRequestHandler() const = 0;
+ virtual void __setRequestHandler(const ::IceInternal::RequestHandlerPtr&) = 0;
};
} }
@@ -321,20 +329,20 @@ public:
virtual bool ice_invoke(const ::std::string&, ::Ice::OperationMode,
const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&,
::std::vector< ::Ice::Byte>&, const ::Ice::Context*);
+ virtual void ice_flushBatchRequests();
- virtual ::Ice::ConnectionIPtr __getConnection(bool&) const;
+ virtual ::IceInternal::RequestHandlerPtr __getRequestHandler() const;
+ virtual void __setRequestHandler(const ::IceInternal::RequestHandlerPtr&);
void __copyFrom(const ::IceInternal::Handle< ::IceDelegateM::Ice::Object>&);
protected:
- ::IceInternal::ReferencePtr __reference;
- ::Ice::ConnectionIPtr __connection;
- bool __compress;
+ ::IceInternal::RequestHandlerPtr __handler;
private:
- void setup(const ::IceInternal::ReferencePtr&);
+ void setup(const ::IceInternal::ReferencePtr&, const ::Ice::ObjectPrx&, bool);
friend class ::IceProxy::Ice::Object;
};
@@ -354,8 +362,10 @@ public:
virtual bool ice_invoke(const ::std::string&, ::Ice::OperationMode,
const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&,
::std::vector< ::Ice::Byte>&, const ::Ice::Context*);
+ virtual void ice_flushBatchRequests();
- virtual ::Ice::ConnectionIPtr __getConnection(bool&) const;
+ virtual ::IceInternal::RequestHandlerPtr __getRequestHandler() const;
+ virtual void __setRequestHandler(const ::IceInternal::RequestHandlerPtr&);
void __copyFrom(const ::IceInternal::Handle< ::IceDelegateD::Ice::Object>&);
diff --git a/cpp/include/Ice/RequestHandlerF.h b/cpp/include/Ice/RequestHandlerF.h
new file mode 100644
index 00000000000..ee313002dae
--- /dev/null
+++ b/cpp/include/Ice/RequestHandlerF.h
@@ -0,0 +1,25 @@
+// **********************************************************************
+//
+// 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_REQUEST_HANDLER_F_H
+#define ICE_REQUEST_HANDLER_F_H
+
+#include <IceUtil/Shared.h>
+#include <Ice/Handle.h>
+
+namespace IceInternal
+{
+
+class RequestHandler;
+ICE_API IceUtil::Shared* upCast(RequestHandler*);
+typedef IceInternal::Handle<RequestHandler> RequestHandlerPtr;
+
+}
+
+#endif
diff --git a/cpp/include/IceUtil/Timer.h b/cpp/include/IceUtil/Timer.h
index 246d87dcb7a..3725f9e4d46 100644
--- a/cpp/include/IceUtil/Timer.h
+++ b/cpp/include/IceUtil/Timer.h
@@ -25,7 +25,7 @@ class Timer;
typedef IceUtil::Handle<Timer> TimerPtr;
//
-// Extend the TimerTask class and override the run() method to execute
+// Extend the TimerTask class and override the runTimerTask() method to execute
// code at a specific time or repeatedly.
//
class ICE_UTIL_API TimerTask : virtual public IceUtil::Shared
@@ -34,9 +34,7 @@ public:
virtual ~TimerTask() { }
- virtual bool operator<(const TimerTask& r) const;
-
- virtual void run() = 0;
+ virtual void runTimerTask() = 0;
};
typedef IceUtil::Handle<TimerTask> TimerTaskPtr;
@@ -95,7 +93,17 @@ private:
IceUtil::Monitor<IceUtil::Mutex> _monitor;
bool _destroyed;
std::set<Token> _tokens;
- std::map<TimerTaskPtr, IceUtil::Time> _tasks;
+
+ class TimerTaskCompare : public std::binary_function<TimerTaskPtr, TimerTaskPtr, bool>
+ {
+ public:
+
+ bool operator()(const TimerTaskPtr& lhs, const TimerTaskPtr& rhs) const
+ {
+ return lhs.get() < rhs.get();
+ }
+ };
+ std::map<TimerTaskPtr, IceUtil::Time, TimerTaskCompare> _tasks;
IceUtil::Time _wakeUpTime;
};
typedef IceUtil::Handle<Timer> TimerPtr;
@@ -118,7 +126,7 @@ Timer::Token::operator<(const Timer::Token& r) const
return false;
}
- return task < r.task;
+ return task.get() < r.task.get();
}
}