Class NSXPCConnection

  • All Implemented Interfaces:
    NSXPCProxyCreating, NSObject

    public class NSXPCConnection
    extends NSObject
    implements NSXPCProxyCreating
    This object is the main configuration mechanism for the communication between two processes. Each NSXPCConnection instance has a private serial queue. This queue is used when sending messages to reply handlers, interruption handlers, and invalidation handlers. API-Since: 6.0
    • Constructor Detail

      • NSXPCConnection

        protected NSXPCConnection​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static NSXPCConnection allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • auditSessionIdentifier

        public int auditSessionIdentifier()
        These attributes describe the security attributes of the connection. They may be used by the listener delegate to accept or reject connections.
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(@NotNull
                                                                   @NotNull java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(@NotNull
                                                                   @NotNull java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(@NotNull
                                                                                 @NotNull java.lang.Object aTarget,
                                                                                 @NotNull
                                                                                 @NotNull org.moe.natj.objc.SEL aSelector,
                                                                                 @Nullable
                                                                                 @Nullable java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        @NotNull
        public static @NotNull NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        @NotNull
        public static @NotNull org.moe.natj.objc.Class classForKeyedUnarchiver()
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • description_static

        public static java.lang.String description_static()
      • effectiveGroupIdentifier

        public int effectiveGroupIdentifier()
      • effectiveUserIdentifier

        public int effectiveUserIdentifier()
      • exportedInterface

        @Nullable
        public @Nullable NSXPCInterface exportedInterface()
        The interface that describes messages that are allowed to be received by the exported object on this connection. This value is required if a exported object is set.
      • exportedObject

        @Nullable
        public @Nullable java.lang.Object exportedObject()
        Set an exported object for the connection. Messages sent to the remoteObjectProxy from the other side of the connection will be dispatched to this object. Messages delivered to exported objects are serialized and sent on a non-main queue. The receiver is responsible for handling the messages on a different queue or thread if it is required.
      • hash_static

        public static long hash_static()
      • initWithListenerEndpoint

        public NSXPCConnection initWithListenerEndpoint​(@NotNull
                                                        @NotNull NSXPCListenerEndpoint endpoint)
        Initialize an NSXPCConnection that will connect to an NSXPCListener (identified by its NSXPCListenerEndpoint).
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • interruptionHandler

        @Nullable
        public @Nullable NSXPCConnection.Block_interruptionHandler_ret interruptionHandler()
        The interruption handler will be called if the remote process exits or crashes. It may be possible to re-establish the connection by simply sending another message. The handler will be invoked on the same queue as replies and other handlers, but there is no guarantee of ordering between those callbacks and this one. The interruptionHandler property is cleared after the connection becomes invalid. This is to mitigate the impact of a retain cycle created by referencing the NSXPCConnection instance inside this block.
      • invalidate

        public void invalidate()
        Invalidate the connection. All outstanding error handling blocks and invalidation blocks will be called on the message handling queue. The connection must be invalidated before it is deallocated. After a connection is invalidated, no more messages may be sent or received.
      • invalidationHandler

        @Nullable
        public @Nullable NSXPCConnection.Block_invalidationHandler_ret invalidationHandler()
        The invalidation handler will be called if the connection can not be formed or the connection has terminated and may not be re-established. The invalidation handler will also be called if a connection created with an NSXPCListenerEndpoint is invalidated from the remote side, or if the NSXPCListener used to create that endpoint is invalidated. The handler will be invoked on the same queue as replies and other handlers, but there is no guarantee of ordering between those callbacks and this one. You may not send messages over the connection from within an invalidation handler block. The invalidationHandler property is cleared after the connection becomes invalid. This is to mitigate the impact of a retain cycle created by referencing the NSXPCConnection instance inside this block.
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        @NotNull
        public static @NotNull NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(@NotNull
                                                                                             @NotNull java.lang.String key)
      • processIdentifier

        public int processIdentifier()
      • remoteObjectInterface

        @Nullable
        public @Nullable NSXPCInterface remoteObjectInterface()
        The interface that describes messages that are allowed to be received by object that has been "imported" to this connection (exported from the other side). This value is required if messages are sent over this connection.
      • remoteObjectProxy

        @NotNull
        public @NotNull java.lang.Object remoteObjectProxy()
        Description copied from interface: NSXPCProxyCreating
        Returns a proxy object with no error handling block. Messages sent to the proxy object will be sent over the wire to the other side of the connection. All messages must be 'oneway void' return type. Control may be returned to the caller before the message is sent. This proxy object will conform with the NSXPCProxyCreating protocol.
        Specified by:
        remoteObjectProxy in interface NSXPCProxyCreating
      • remoteObjectProxyWithErrorHandler

        @NotNull
        public @NotNull java.lang.Object remoteObjectProxyWithErrorHandler​(@NotNull
                                                                           NSXPCProxyCreating.Block_remoteObjectProxyWithErrorHandler handler)
        Description copied from interface: NSXPCProxyCreating
        Returns a proxy object which will invoke the error handling block if an error occurs on the connection. If the message sent to the proxy has a reply handler, then either the error handler or the reply handler will be called exactly once. This proxy object will also conform with the NSXPCProxyCreating protocol.
        Specified by:
        remoteObjectProxyWithErrorHandler in interface NSXPCProxyCreating
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • resume

        public void resume()
        All connections start suspended. You must resume them before they will start processing received messages or sending messages through the remoteObjectProxy. Note: Calling resume does not immediately launch the XPC service. The service will be started on demand when the first message is sent. However, if the name specified when creating the connection is determined to be invalid, your invalidation handler will be called immediately (and asynchronously) after calling resume. For new code, calling `-activate` is preferred for the initial activation of the connection.
      • serviceName

        @Nullable
        public @Nullable java.lang.String serviceName()
      • setExportedInterface

        public void setExportedInterface​(@Nullable
                                         @Nullable NSXPCInterface value)
        The interface that describes messages that are allowed to be received by the exported object on this connection. This value is required if a exported object is set.
      • setExportedObject

        public void setExportedObject​(@Nullable
                                      @Nullable java.lang.Object value)
        Set an exported object for the connection. Messages sent to the remoteObjectProxy from the other side of the connection will be dispatched to this object. Messages delivered to exported objects are serialized and sent on a non-main queue. The receiver is responsible for handling the messages on a different queue or thread if it is required.
      • setInterruptionHandler

        public void setInterruptionHandler​(@Nullable
                                           @Nullable NSXPCConnection.Block_setInterruptionHandler value)
        The interruption handler will be called if the remote process exits or crashes. It may be possible to re-establish the connection by simply sending another message. The handler will be invoked on the same queue as replies and other handlers, but there is no guarantee of ordering between those callbacks and this one. The interruptionHandler property is cleared after the connection becomes invalid. This is to mitigate the impact of a retain cycle created by referencing the NSXPCConnection instance inside this block.
      • setInvalidationHandler

        public void setInvalidationHandler​(@Nullable
                                           @Nullable NSXPCConnection.Block_setInvalidationHandler value)
        The invalidation handler will be called if the connection can not be formed or the connection has terminated and may not be re-established. The invalidation handler will also be called if a connection created with an NSXPCListenerEndpoint is invalidated from the remote side, or if the NSXPCListener used to create that endpoint is invalidated. The handler will be invoked on the same queue as replies and other handlers, but there is no guarantee of ordering between those callbacks and this one. You may not send messages over the connection from within an invalidation handler block. The invalidationHandler property is cleared after the connection becomes invalid. This is to mitigate the impact of a retain cycle created by referencing the NSXPCConnection instance inside this block.
      • setRemoteObjectInterface

        public void setRemoteObjectInterface​(@Nullable
                                             @Nullable NSXPCInterface value)
        The interface that describes messages that are allowed to be received by object that has been "imported" to this connection (exported from the other side). This value is required if messages are sent over this connection.
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • suspend

        public void suspend()
        Suspend the connection. Suspends must be balanced with resumes before the connection may be invalidated.
      • version_static

        public static long version_static()
      • currentConnection

        @Nullable
        public static @Nullable NSXPCConnection currentConnection()
        Get the current connection, in the context of a call to a method on your exported object. Useful for determining 'who called this'. API-Since: 6.0
      • scheduleSendBarrierBlock

        public void scheduleSendBarrierBlock​(@NotNull
                                             @NotNull NSXPCConnection.Block_scheduleSendBarrierBlock block)
        Add a barrier block to be executed on the connection. This barrier block will run after any outstanding sends have completed. Note: This does not guarantee that messages will be received by the remote process by the time the block is invoked. If you need to ensure receipt of a message by the remote process, waiting for a reply to come back is the best option. API-Since: 13.0
      • activate

        public void activate()
        Activates the connection. Connections start in an inactive state. You must call `-activate` on a connection before it will send or receive any messages. Calling `-activate` on an active connection has no effect. For backward compatibility reasons, `-resume` on an inactive and otherwise not suspended NSXPCConnection has the same effect as calling `-activate`. For new code, using `-activate` is preferred. API-Since: 14.0
      • useStoredAccessor

        @Deprecated
        public static boolean useStoredAccessor()
        Deprecated.