diff options
-rw-r--r-- | cppe/include/IceE/Proxy.h | 1 | ||||
-rw-r--r-- | cppe/src/IceE/Proxy.cpp | 7 | ||||
-rw-r--r-- | javae/src/Ice/ObjectPrx.java | 1 | ||||
-rw-r--r-- | javae/src/Ice/ObjectPrxHelperBase.java | 6 | ||||
-rw-r--r-- | php/src/ice/ice_proxy.h | 2 | ||||
-rw-r--r-- | php/src/ice/proxy.cpp | 27 | ||||
-rw-r--r-- | py/modules/IcePy/Proxy.cpp | 32 | ||||
-rw-r--r-- | rb/src/IceRuby/Makefile.mak | 4 | ||||
-rw-r--r-- | rb/src/IceRuby/Proxy.cpp | 18 |
9 files changed, 96 insertions, 2 deletions
diff --git a/cppe/include/IceE/Proxy.h b/cppe/include/IceE/Proxy.h index 4efb088512b..60e2f49b853 100644 --- a/cppe/include/IceE/Proxy.h +++ b/cppe/include/IceE/Proxy.h @@ -159,6 +159,7 @@ public: ICE_DEPRECATED_API ::Ice::ConnectionPtr ice_connection(); ::Ice::ConnectionPtr ice_getConnection(); + ::Ice::ConnectionPtr ice_getCachedConnection() const; ::IceInternal::ReferencePtr __reference() const; void __copyFrom(const ::Ice::ObjectPrx&); diff --git a/cppe/src/IceE/Proxy.cpp b/cppe/src/IceE/Proxy.cpp index da3f5a36812..2608eda96c8 100644 --- a/cppe/src/IceE/Proxy.cpp +++ b/cppe/src/IceE/Proxy.cpp @@ -691,6 +691,13 @@ IceProxy::Ice::Object::ice_getConnection() return _connection; } +ConnectionPtr +IceProxy::Ice::Object::ice_getCachedConnection() +{ + ::IceUtil::Mutex::Lock sync(*this); + return _connection; +} + ReferencePtr IceProxy::Ice::Object::__reference() const { diff --git a/javae/src/Ice/ObjectPrx.java b/javae/src/Ice/ObjectPrx.java index 24681237c49..804f35fa971 100644 --- a/javae/src/Ice/ObjectPrx.java +++ b/javae/src/Ice/ObjectPrx.java @@ -79,6 +79,7 @@ public interface ObjectPrx **/ Connection ice_connection(); Connection ice_getConnection(); + Connection ice_getCachedConnection(); // // javac 1.1 emits a bogus error about this method causing ambiguity with diff --git a/javae/src/Ice/ObjectPrxHelperBase.java b/javae/src/Ice/ObjectPrxHelperBase.java index 35595527a5f..ea65567657f 100644 --- a/javae/src/Ice/ObjectPrxHelperBase.java +++ b/javae/src/Ice/ObjectPrxHelperBase.java @@ -542,6 +542,12 @@ public class ObjectPrxHelperBase implements ObjectPrx return _connection; } + public synchronized final Connection + ice_getCachedConnection() + { + return _connection; + } + public final boolean equals(java.lang.Object r) { diff --git a/php/src/ice/ice_proxy.h b/php/src/ice/ice_proxy.h index a5bb29861ba..ce475301605 100644 --- a/php/src/ice/ice_proxy.h +++ b/php/src/ice/ice_proxy.h @@ -58,6 +58,7 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_compress); ZEND_FUNCTION(Ice_ObjectPrx_ice_timeout); ZEND_FUNCTION(Ice_ObjectPrx_ice_connectionId); ZEND_FUNCTION(Ice_ObjectPrx_ice_getConnection); +ZEND_FUNCTION(Ice_ObjectPrx_ice_getCachedConnection); ZEND_FUNCTION(Ice_ObjectPrx_ice_uncheckedCast); ZEND_FUNCTION(Ice_ObjectPrx_ice_checkedCast); @@ -116,6 +117,7 @@ ZEND_FUNCTION(Ice_Connection_toString); ZEND_FE(Ice_ObjectPrx_ice_timeout, NULL) \ ZEND_FE(Ice_ObjectPrx_ice_connectionId, NULL) \ ZEND_FE(Ice_ObjectPrx_ice_getConnection, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_getCachedConnection, NULL) \ ZEND_FE(Ice_ObjectPrx_ice_uncheckedCast, NULL) \ ZEND_FE(Ice_ObjectPrx_ice_checkedCast, NULL) diff --git a/php/src/ice/proxy.cpp b/php/src/ice/proxy.cpp index ae577ad0a12..f88e7daa21d 100644 --- a/php/src/ice/proxy.cpp +++ b/php/src/ice/proxy.cpp @@ -199,6 +199,7 @@ static function_entry _proxyMethods[] = {"ice_timeout", PHP_FN(Ice_ObjectPrx_ice_timeout), NULL}, {"ice_connectionId", PHP_FN(Ice_ObjectPrx_ice_connectionId), NULL}, {"ice_getConnection", PHP_FN(Ice_ObjectPrx_ice_getConnection), NULL}, + {"ice_getCachedConnection", PHP_FN(Ice_ObjectPrx_ice_getCachedConnection), NULL}, {"ice_uncheckedCast", PHP_FN(Ice_ObjectPrx_ice_uncheckedCast), NULL}, {"ice_checkedCast", PHP_FN(Ice_ObjectPrx_ice_checkedCast), NULL}, {NULL, NULL, NULL} @@ -1543,6 +1544,32 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_getConnection) } } +ZEND_FUNCTION(Ice_ObjectPrx_ice_getCachedConnection) +{ + if(ZEND_NUM_ARGS() != 0) + { + WRONG_PARAM_COUNT; + } + + ice_object* obj = static_cast<ice_object*>(zend_object_store_get_object(getThis() TSRMLS_CC)); + assert(obj->ptr); + Proxy* _this = static_cast<Proxy*>(obj->ptr); + + try + { + Ice::ConnectionPtr con = _this->getProxy()->ice_getCachedConnection(); + if(!con || !createConnection(return_value, con TSRMLS_CC)) + { + RETURN_NULL(); + } + } + catch(const IceUtil::Exception& ex) + { + throwException(ex TSRMLS_CC); + RETURN_NULL(); + } +} + static void do_cast(INTERNAL_FUNCTION_PARAMETERS, bool check) { diff --git a/py/modules/IcePy/Proxy.cpp b/py/modules/IcePy/Proxy.cpp index 4e7b0b9b7d5..557d1fc674c 100644 --- a/py/modules/IcePy/Proxy.cpp +++ b/py/modules/IcePy/Proxy.cpp @@ -1494,6 +1494,36 @@ proxyIceGetConnection(ProxyObject* self) extern "C" #endif static PyObject* +proxyIceGetCachedConnection(ProxyObject* self) +{ + assert(self->proxy); + + Ice::ConnectionPtr con; + try + { + con = (*self->proxy)->ice_getCachedConnection(); + } + catch(const Ice::Exception& ex) + { + setPythonException(ex); + return NULL; + } + + if(con) + { + return createConnection(con, *self->communicator); + } + else + { + Py_INCREF(Py_None); + return Py_None; + } +} + +#ifdef WIN32 +extern "C" +#endif +static PyObject* proxyIceConnection(ProxyObject* self) { PyErr_Warn(PyExc_DeprecationWarning, STRCAST("ice_connection is deprecated, use ice_getConnection instead.")); @@ -1916,6 +1946,8 @@ static PyMethodDef ProxyMethods[] = PyDoc_STR(STRCAST("ice_connection() -> Ice.Connection")) }, // Deprecated { STRCAST("ice_getConnection"), (PyCFunction)proxyIceGetConnection, METH_NOARGS, PyDoc_STR(STRCAST("ice_getConnection() -> Ice.Connection")) }, + { STRCAST("ice_getCachedConnection"), (PyCFunction)proxyIceGetCachedConnection, METH_NOARGS, + PyDoc_STR(STRCAST("ice_getCachedConnection() -> Ice.Connection")) }, { STRCAST("ice_checkedCast"), (PyCFunction)proxyIceCheckedCast, METH_VARARGS | METH_CLASS, PyDoc_STR(STRCAST("ice_checkedCast(proxy, id[, facetOrCtx[, ctx]]) -> proxy")) }, { STRCAST("ice_uncheckedCast"), (PyCFunction)proxyIceUncheckedCast, METH_VARARGS | METH_CLASS, diff --git a/rb/src/IceRuby/Makefile.mak b/rb/src/IceRuby/Makefile.mak index d3c7f1afc35..0b84e1197ff 100644 --- a/rb/src/IceRuby/Makefile.mak +++ b/rb/src/IceRuby/Makefile.mak @@ -9,8 +9,8 @@ top_srcdir = ..\.. -LIBNAME = IceRuby$(RBLIBSUFFIX).lib -DLLNAME = $(rubydir)\IceRuby$(RBLIBSUFFIX).dll +LIBNAME = IceRuby$(LIBSUFFIX).lib +DLLNAME = $(rubydir)\IceRuby$(LIBSUFFIX).dll TARGETS = $(LIBNAME) $(DLLNAME) diff --git a/rb/src/IceRuby/Proxy.cpp b/rb/src/IceRuby/Proxy.cpp index 6165d6a72f1..a7207ae21b3 100644 --- a/rb/src/IceRuby/Proxy.cpp +++ b/rb/src/IceRuby/Proxy.cpp @@ -945,6 +945,23 @@ IceRuby_ObjectPrx_ice_getConnection(VALUE self) extern "C" VALUE +IceRuby_ObjectPrx_ice_getCachedConnection(VALUE self) +{ + ICE_RUBY_TRY + { + Ice::ObjectPrx p = getProxy(self); + Ice::ConnectionPtr conn = p->ice_getCachedConnection(); + if(!NIL_P(conn)) + { + return createConnection(conn); + } + } + ICE_RUBY_CATCH + return Qnil; +} + +extern "C" +VALUE IceRuby_ObjectPrx_equals(VALUE self, VALUE other) { ICE_RUBY_TRY @@ -1337,6 +1354,7 @@ IceRuby::initProxy(VALUE iceModule) rb_define_method(_proxyClass, "ice_timeout", CAST_METHOD(IceRuby_ObjectPrx_ice_timeout), 1); rb_define_method(_proxyClass, "ice_connectionId", CAST_METHOD(IceRuby_ObjectPrx_ice_connectionId), 1); rb_define_method(_proxyClass, "ice_getConnection", CAST_METHOD(IceRuby_ObjectPrx_ice_getConnection), 0); + rb_define_method(_proxyClass, "ice_getCachedConnection", CAST_METHOD(IceRuby_ObjectPrx_ice_getCachedConnection), 0); rb_define_method(_proxyClass, "hash", CAST_METHOD(IceRuby_ObjectPrx_ice_getHash), 0); rb_define_method(_proxyClass, "to_s", CAST_METHOD(IceRuby_ObjectPrx_ice_toString), 0); |