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.
    • Constructor Detail

      • NSXPCConnection

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

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static java.lang.Object 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​(java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

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

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

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

        public static 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

        public 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

        public 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​(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

        public 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

        public 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

        public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(java.lang.String key)
      • new_objc

        public static java.lang.Object new_objc()
      • processIdentifier

        public int processIdentifier()
      • remoteObjectInterface

        public 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

        public 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
      • 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.
      • serviceName

        public java.lang.String serviceName()
      • setExportedInterface

        public void setExportedInterface​(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​(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​(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​(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​(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

        public static 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'.
      • scheduleSendBarrierBlock

        public void scheduleSendBarrierBlock​(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.