summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpp/src/Ice/CommunicatorI.cpp4
-rw-r--r--cpp/src/Ice/CommunicatorI.h4
-rw-r--r--cpp/src/Ice/ObjectAdapterI.cpp6
-rw-r--r--cpp/src/Ice/ObjectAdapterI.h2
-rw-r--r--cpp/src/Ice/ThreadPool.cpp4
-rw-r--r--cpp/src/Ice/ThreadPool.h2
-rw-r--r--slice/Ice/Communicator.ice21
-rw-r--r--slice/Ice/ObjectAdapter.ice9
-rw-r--r--swift/src/Ice/CommunicatorI.swift12
-rw-r--r--swift/src/Ice/ObjectAdapterI.swift6
-rw-r--r--swift/src/IceObjc/Communicator.h18
-rw-r--r--swift/src/IceObjc/Communicator.mm26
-rw-r--r--swift/src/IceObjc/ObjectAdapter.h2
-rw-r--r--swift/src/IceObjc/ObjectAdapter.mm12
-rw-r--r--swift/test/Ice/timeout/TestI.swift2
15 files changed, 90 insertions, 40 deletions
diff --git a/cpp/src/Ice/CommunicatorI.cpp b/cpp/src/Ice/CommunicatorI.cpp
index 4355ad80977..a23570870f1 100644
--- a/cpp/src/Ice/CommunicatorI.cpp
+++ b/cpp/src/Ice/CommunicatorI.cpp
@@ -384,13 +384,13 @@ Ice::CommunicatorI::getValueFactoryManager() const ICE_NOEXCEPT
#ifdef ICE_SWIFT
dispatch_queue_t
-Ice::CommunicatorI::getClientDispatchQueue() const ICE_NOEXCEPT
+Ice::CommunicatorI::getClientDispatchQueue() const
{
return _instance->clientThreadPool()->getDispatchQueue();
}
dispatch_queue_t
-Ice::CommunicatorI::getServerDispatchQueue() const ICE_NOEXCEPT
+Ice::CommunicatorI::getServerDispatchQueue() const
{
return _instance->serverThreadPool()->getDispatchQueue();
}
diff --git a/cpp/src/Ice/CommunicatorI.h b/cpp/src/Ice/CommunicatorI.h
index ae0f4e817c8..3e24479691e 100644
--- a/cpp/src/Ice/CommunicatorI.h
+++ b/cpp/src/Ice/CommunicatorI.h
@@ -98,8 +98,8 @@ public:
virtual ValueFactoryManagerPtr getValueFactoryManager() const ICE_NOEXCEPT;
#ifdef ICE_SWIFT
- virtual dispatch_queue_t getClientDispatchQueue() const ICE_NOEXCEPT;
- virtual dispatch_queue_t getServerDispatchQueue() const ICE_NOEXCEPT;
+ virtual dispatch_queue_t getClientDispatchQueue() const;
+ virtual dispatch_queue_t getServerDispatchQueue() const;
#endif
#ifdef ICE_CPP11_MAPPING
diff --git a/cpp/src/Ice/ObjectAdapterI.cpp b/cpp/src/Ice/ObjectAdapterI.cpp
index 102636af70d..69c25758483 100644
--- a/cpp/src/Ice/ObjectAdapterI.cpp
+++ b/cpp/src/Ice/ObjectAdapterI.cpp
@@ -737,8 +737,12 @@ Ice::ObjectAdapterI::setPublishedEndpoints(const EndpointSeq& newEndpoints)
#ifdef ICE_SWIFT
dispatch_queue_t
-Ice::ObjectAdapterI::getDispatchQueue() const ICE_NOEXCEPT
+Ice::ObjectAdapterI::getDispatchQueue() const
{
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+
+ checkForDeactivation();
+
return getThreadPool()->getDispatchQueue();
}
#endif
diff --git a/cpp/src/Ice/ObjectAdapterI.h b/cpp/src/Ice/ObjectAdapterI.h
index 00496d9133d..c4676186ce6 100644
--- a/cpp/src/Ice/ObjectAdapterI.h
+++ b/cpp/src/Ice/ObjectAdapterI.h
@@ -86,7 +86,7 @@ public:
virtual void setPublishedEndpoints(const EndpointSeq&);
#ifdef ICE_SWIFT
- virtual dispatch_queue_t getDispatchQueue() const ICE_NOEXCEPT;
+ virtual dispatch_queue_t getDispatchQueue() const;
#endif
bool isLocal(const ObjectPrxPtr&) const;
diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp
index 2994f292d86..7ffb9016a1e 100644
--- a/cpp/src/Ice/ThreadPool.cpp
+++ b/cpp/src/Ice/ThreadPool.cpp
@@ -246,7 +246,7 @@ IceInternal::ThreadPoolWorkQueue::getNativeInfo()
IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance, const string& prefix, int timeout) :
_instance(instance),
#ifdef ICE_SWIFT
- _dispatchQueue(dispatch_queue_create(prefix.c_str(), DISPATCH_QUEUE_CONCURRENT)),
+ _dispatchQueue(dispatch_queue_create(("com.zeroc." + prefix).c_str(), DISPATCH_QUEUE_CONCURRENT)),
#else
_dispatcher(_instance->initializationData().dispatcher),
#endif
@@ -620,7 +620,7 @@ IceInternal::ThreadPool::prefix() const
#ifdef ICE_SWIFT
dispatch_queue_t
-IceInternal::ThreadPool::getDispatchQueue() const
+IceInternal::ThreadPool::getDispatchQueue() const ICE_NOEXCEPT
{
return _dispatchQueue;
}
diff --git a/cpp/src/Ice/ThreadPool.h b/cpp/src/Ice/ThreadPool.h
index daff7373f1a..1b6bf254467 100644
--- a/cpp/src/Ice/ThreadPool.h
+++ b/cpp/src/Ice/ThreadPool.h
@@ -111,7 +111,7 @@ public:
std::string prefix() const;
#ifdef ICE_SWIFT
- dispatch_queue_t getDispatchQueue() const;
+ dispatch_queue_t getDispatchQueue() const ICE_NOEXCEPT;
#endif
private:
diff --git a/slice/Ice/Communicator.ice b/slice/Ice/Communicator.ice
index cbf42e5d93f..066d3f48354 100644
--- a/slice/Ice/Communicator.ice
+++ b/slice/Ice/Communicator.ice
@@ -614,10 +614,23 @@ local interface Communicator
#endif
#if defined(__SLICE2SWIFT__) || defined(ICE_SWIFT)
- ["cpp:const", "cpp:noexcept", "swift:nonnull", "swift:noexcept",
- "cpp:type:dispatch_queue_t", "swift:type:Dispatch.DispatchQueue"] LocalObject getClientDispatchQueue();
- ["cpp:const", "cpp:noexcept", "swift:nonnull", "swift:noexcept",
- "cpp:type:dispatch_queue_t", "swift:type:Dispatch.DispatchQueue"] LocalObject getServerDispatchQueue();
+ /*
+ * Returns the client dispatch queue.
+ *
+ * @return The dispatch queue associated wih this Communicator's
+ * client thread pool.
+ **/
+ ["cpp:const", "swift:nonnull", "cpp:type:dispatch_queue_t", "swift:type:Dispatch.DispatchQueue"]
+ LocalObject getClientDispatchQueue();
+
+ /*
+ * Returns the server dispatch queue.
+ *
+ * @return The dispatch queue associated wih the Communicator's
+ * server thread pool.
+ **/
+ ["cpp:const", "swift:nonnull", "cpp:type:dispatch_queue_t", "swift:type:Dispatch.DispatchQueue"]
+ LocalObject getServerDispatchQueue();
#endif
}
diff --git a/slice/Ice/ObjectAdapter.ice b/slice/Ice/ObjectAdapter.ice
index 3d8fca1cd59..e748b909a70 100644
--- a/slice/Ice/ObjectAdapter.ice
+++ b/slice/Ice/ObjectAdapter.ice
@@ -694,9 +694,12 @@ local interface ObjectAdapter
void setPublishedEndpoints(EndpointSeq newEndpoints);
#if defined(__SLICE2SWIFT__) || defined(ICE_SWIFT)
- // Get the dispatch queue associated with this Object Adapter
- ["cpp:const", "cpp:noexcept", "swift:nonnull", "swift:noexcept",
- "cpp:type:dispatch_queue_t", "swift:type:Dispatch.DispatchQueue"]
+ /*
+ * Returns the dispatch queue.
+ *
+ * @return The dispatch queue associated wih this Object Adapter.
+ **/
+ ["cpp:const", "swift:nonnull", "cpp:type:dispatch_queue_t", "swift:type:Dispatch.DispatchQueue"]
LocalObject getDispatchQueue();
#endif
}
diff --git a/swift/src/Ice/CommunicatorI.swift b/swift/src/Ice/CommunicatorI.swift
index 5d210a526f0..c29312b0421 100644
--- a/swift/src/Ice/CommunicatorI.swift
+++ b/swift/src/Ice/CommunicatorI.swift
@@ -242,12 +242,16 @@ class CommunicatorI: LocalObject<ICECommunicator>, Communicator {
}
}
- func getClientDispatchQueue() -> Dispatch.DispatchQueue {
- return _handle.getClientDispatchQueue()
+ func getClientDispatchQueue() throws -> DispatchQueue {
+ return try autoreleasepool {
+ try _handle.getClientDispatchQueue()
+ }
}
- func getServerDispatchQueue() -> Dispatch.DispatchQueue {
- return _handle.getServerDispatchQueue()
+ func getServerDispatchQueue() throws -> DispatchQueue {
+ return try autoreleasepool {
+ try _handle.getServerDispatchQueue()
+ }
}
}
diff --git a/swift/src/Ice/ObjectAdapterI.swift b/swift/src/Ice/ObjectAdapterI.swift
index e23e2f10482..4a192866d25 100644
--- a/swift/src/Ice/ObjectAdapterI.swift
+++ b/swift/src/Ice/ObjectAdapterI.swift
@@ -182,8 +182,10 @@ class ObjectAdapterI: LocalObject<ICEObjectAdapter>, ObjectAdapter, ICEBlobjectF
try _handle.setPublishedEndpoints(newEndpoints.toObjc())
}
- func getDispatchQueue() -> DispatchQueue {
- return _handle.getDispatchQueue()
+ func getDispatchQueue() throws -> DispatchQueue {
+ return try autoreleasepool {
+ try _handle.getDispatchQueue()
+ }
}
func facadeInvoke(_ adapter: ICEObjectAdapter,
diff --git a/swift/src/IceObjc/Communicator.h b/swift/src/IceObjc/Communicator.h
index d36e76fa5d7..c72290d982f 100644
--- a/swift/src/IceObjc/Communicator.h
+++ b/swift/src/IceObjc/Communicator.h
@@ -27,10 +27,10 @@ NS_ASSUME_NONNULL_BEGIN
-(ICEImplicitContext*) getImplicitContext;
-(id<ICELoggerProtocol>) getLogger;
-(nullable ICEObjectPrx*) getDefaultRouter;
--(BOOL) setDefaultRouter:(ICEObjectPrx* _Nullable)router error:(NSError**)error;
+-(BOOL) setDefaultRouter:(ICEObjectPrx* _Nullable)router error:(NSError* _Nullable * _Nullable)error;
-(nullable ICEObjectPrx*) getDefaultLocator;
--(BOOL) setDefaultLocator:(ICEObjectPrx* _Nullable)locator error:(NSError**)error;
--(BOOL) flushBatchRequests:(uint8_t)compress error:(NSError**)error;
+-(BOOL) setDefaultLocator:(ICEObjectPrx* _Nullable)locator error:(NSError* _Nullable * _Nullable)error;
+-(BOOL) flushBatchRequests:(uint8_t)compress error:(NSError* _Nullable * _Nullable)error;
-(BOOL) flushBatchRequestsAsync:(uint8_t)compress
exception:(void (^)(NSError*))exception
sent:(void (^_Nullable)(bool))sent
@@ -41,15 +41,15 @@ NS_ASSUME_NONNULL_BEGIN
error:(NSError**)error;
-(nullable id) getAdmin:(NSError**)error;
-(BOOL) addAdminFacet:(id<ICEBlobjectFacade>)servant facet:(NSString*)facet error:(NSError**)error;
--(nullable id<ICEBlobjectFacade>) removeAdminFacet:(NSString*)facet error:(NSError**)error;
--(nullable id) findAdminFacet:(NSString*)facet error:(NSError**)error;
--(nullable NSDictionary<NSString*, id<ICEBlobjectFacade>>*) findAllAdminFacets:(NSError**)error;
+-(nullable id<ICEBlobjectFacade>) removeAdminFacet:(NSString*)facet error:(NSError* _Nullable * _Nullable)error;
+-(nullable id) findAdminFacet:(NSString*)facet error:(NSError* _Nullable * _Nullable)error;
+-(nullable NSDictionary<NSString*, id<ICEBlobjectFacade>>*) findAllAdminFacets:(NSError* _Nullable * _Nullable)error;
-(ICEProperties*) getProperties;
--(dispatch_queue_t) getClientDispatchQueue;
--(dispatch_queue_t) getServerDispatchQueue;
+-(nullable dispatch_queue_t) getClientDispatchQueue:(NSError* _Nullable * _Nullable)error;
+-(nullable dispatch_queue_t) getServerDispatchQueue:(NSError* _Nullable * _Nullable)error;
// DefaultsAndOverrides
--(void) getDefaultEncoding:(nonnull uint8_t*)major minor:(nonnull uint8_t*)minor
+-(void) getDefaultEncoding:(uint8_t*)major minor:(uint8_t*)minor
NS_SWIFT_NAME(getDefaultEncoding(major:minor:));
-(uint8_t) getDefaultFormat;
diff --git a/swift/src/IceObjc/Communicator.mm b/swift/src/IceObjc/Communicator.mm
index ad76fe04413..006bb07ba03 100644
--- a/swift/src/IceObjc/Communicator.mm
+++ b/swift/src/IceObjc/Communicator.mm
@@ -350,17 +350,33 @@
return [ICEProperties getHandle:props];
}
--(dispatch_queue_t) getClientDispatchQueue
+-(nullable dispatch_queue_t) getClientDispatchQueue:(NSError* _Nullable * _Nullable)error
{
- return self.communicator->getClientDispatchQueue();
+ try
+ {
+ return self.communicator->getClientDispatchQueue();
+ }
+ catch(const std::exception& ex)
+ {
+ *error = convertException(ex);
+ return nil;
+ }
}
--(dispatch_queue_t) getServerDispatchQueue
+-(nullable dispatch_queue_t) getServerDispatchQueue:(NSError* _Nullable * _Nullable)error
{
- return self.communicator->getServerDispatchQueue();
+ try
+ {
+ return self.communicator->getServerDispatchQueue();
+ }
+ catch(const std::exception& ex)
+ {
+ *error = convertException(ex);
+ return nil;
+ }
}
--(void) getDefaultEncoding:(nonnull uint8_t*)major minor:(nonnull uint8_t*)minor
+-(void) getDefaultEncoding:(uint8_t*)major minor:(uint8_t*)minor
{
auto defaultEncoding = IceInternal::getInstance(self.communicator)->defaultsAndOverrides()->defaultEncoding;
*major = defaultEncoding.major;
diff --git a/swift/src/IceObjc/ObjectAdapter.h b/swift/src/IceObjc/ObjectAdapter.h
index 2efb237e2fa..d763bc61c3b 100644
--- a/swift/src/IceObjc/ObjectAdapter.h
+++ b/swift/src/IceObjc/ObjectAdapter.h
@@ -32,7 +32,7 @@ NS_ASSUME_NONNULL_BEGIN
-(BOOL) refreshPublishedEndpoints:(NSError* _Nullable * _Nullable)error;
-(NSArray<ICEEndpoint*>*) getPublishedEndpoints;
-(BOOL) setPublishedEndpoints:(NSArray<ICEEndpoint*>*)newEndpoints error:(NSError* _Nullable * _Nullable)error;
--(dispatch_queue_t) getDispatchQueue;
+-(nullable dispatch_queue_t) getDispatchQueue:(NSError* _Nullable * _Nullable)error;
-(void) registerDefaultServant:(id<ICEBlobjectFacade>)facade NS_SWIFT_NAME(registerDefaultServant(_:));
@end
diff --git a/swift/src/IceObjc/ObjectAdapter.mm b/swift/src/IceObjc/ObjectAdapter.mm
index 7268996c0b5..d2a5dfec592 100644
--- a/swift/src/IceObjc/ObjectAdapter.mm
+++ b/swift/src/IceObjc/ObjectAdapter.mm
@@ -204,9 +204,17 @@
}
}
--(dispatch_queue_t) getDispatchQueue
+-(dispatch_queue_t) getDispatchQueue:(NSError* _Nullable * _Nullable)error
{
- return self.objectAdapter->getDispatchQueue();
+ try
+ {
+ return self.objectAdapter->getDispatchQueue();
+ }
+ catch(const std::exception& ex)
+ {
+ *error = convertException(ex);
+ return nil;
+ }
}
-(void) registerDefaultServant:(id<ICEBlobjectFacade>)facade
diff --git a/swift/test/Ice/timeout/TestI.swift b/swift/test/Ice/timeout/TestI.swift
index 7ae441eec83..d33a3b36ee2 100644
--- a/swift/test/Ice/timeout/TestI.swift
+++ b/swift/test/Ice/timeout/TestI.swift
@@ -24,7 +24,7 @@ class ControllerI: Controller {
func holdAdapter(to: Int32, current: Ice.Current) throws {
_adapter.hold()
if to >= 0 {
- let queue = current.adapter!.getDispatchQueue()
+ let queue = try current.adapter!.getDispatchQueue()
queue.async {
self._adapter.waitForHold()
queue.asyncAfter(deadline: .now() + .milliseconds(Int(to))) {