1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
|
// **********************************************************************
//
// Copyright (c) 2003-2009 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_OUTGOING_ASYNC_H
#define ICE_OUTGOING_ASYNC_H
#include <IceUtil/Monitor.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>
namespace IceInternal
{
class BasicStream;
class LocalExceptionWrapper;
class Outgoing;
class RetryTask;
class ICE_API OutgoingAsyncMessageCallback : virtual public IceUtil::Shared
{
public:
OutgoingAsyncMessageCallback();
virtual ~OutgoingAsyncMessageCallback();
virtual void __sent(Ice::ConnectionI*) = 0;
virtual void __finished(const Ice::LocalException&) = 0;
virtual void ice_exception(const Ice::Exception&) = 0;
BasicStream*
__getOs()
{
return __os;
}
void __sentCallback(const InstancePtr&);
void __exception(const Ice::Exception&);
protected:
friend class ::IceInternal::RetryTask;
void __acquireCallback(const Ice::ObjectPrx&);
void __releaseCallback(const Ice::LocalException&);
void __releaseCallback()
{
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(__monitor);
__releaseCallbackNoSync();
}
void __releaseCallbackNoSync();
void __warning(const InstancePtr&, const std::exception&) const;
void __warning(const InstancePtr&) const;
void __warning(const std::exception&) const;
void __warning() const;
IceUtil::Monitor<IceUtil::Mutex> __monitor;
BasicStream* __is;
BasicStream* __os;
};
//
// We need virtual inheritance from shared, because the user might use
// multiple inheritance from IceUtil::Shared.
//
class ICE_API OutgoingAsync : public OutgoingAsyncMessageCallback, private IceUtil::TimerTask
{
public:
void __sent(Ice::ConnectionI*);
void __finished(BasicStream&);
void __finished(const Ice::LocalException&);
void __finished(const LocalExceptionWrapper&);
void __retry(int);
bool __send();
protected:
void __prepare(const Ice::ObjectPrx&, const std::string&, Ice::OperationMode, const Ice::Context*);
virtual void __response(bool) = 0;
void __throwUserException();
private:
void handleException(const Ice::LocalException&);
void handleException(const LocalExceptionWrapper&);
void runTimerTask(); // Implementation of TimerTask::runTimerTask()
Ice::ConnectionIPtr _timerTaskConnection;
bool _sent;
bool _sentSynchronously;
bool _response;
::Ice::ObjectPrx _proxy;
Handle< ::IceDelegate::Ice::Object> _delegate;
int _cnt;
Ice::OperationMode _mode;
};
class ICE_API BatchOutgoingAsync : public OutgoingAsyncMessageCallback
{
public:
virtual void __sent(Ice::ConnectionI*);
virtual void __finished(const Ice::LocalException&);
protected:
void __prepare(const InstancePtr&);
};
}
namespace Ice
{
class ICE_API AMISentCallback
{
public:
virtual ~AMISentCallback() { }
virtual void ice_sent() = 0;
};
class ICE_API AMI_Object_ice_invoke : public IceInternal::OutgoingAsync
{
public:
virtual void ice_response(bool, const std::vector<Ice::Byte>&) = 0;
virtual void ice_exception(const Ice::Exception&) = 0;
bool __invoke(const Ice::ObjectPrx&, const std::string& operation, OperationMode,
const std::vector<Ice::Byte>&, const Context*);
protected:
virtual void __response(bool);
};
class ICE_API AMI_Array_Object_ice_invoke : public IceInternal::OutgoingAsync
{
public:
virtual void ice_response(bool, const std::pair<const Byte*, const Byte*>&) = 0;
virtual void ice_exception(const Ice::Exception&) = 0;
bool __invoke(const Ice::ObjectPrx&, const std::string& operation, OperationMode,
const std::pair<const Byte*, const Byte*>&, const Context*);
protected:
virtual void __response(bool);
};
class ICE_API AMI_Object_ice_flushBatchRequests : public IceInternal::BatchOutgoingAsync
{
public:
bool __invoke(const Ice::ObjectPrx&);
virtual void ice_exception(const Ice::Exception&) = 0;
};
}
#endif
|