Interface GridKernalGateway

  • All Known Implementing Classes:
    GridKernalGatewayImpl

    @GridToStringExclude
    public interface GridKernalGateway
    This interface guards access to implementations of public methods that access kernal functionality from the following main API interfaces: Note that this kernal gateway should not be used to guard against method from the following non-rich interfaces since their implementations are already managed by their respective implementing classes: Kernal gateway is also responsible for notifying various futures about the change in kernal state so that issued futures could properly interrupt themselves when kernal becomes unavailable while future is held externally by the user.
    • Method Detail

      • readLock

        void readLock()
               throws IllegalStateException
        Should be called on entering every kernal related call originated directly or indirectly via public API.

        This method essentially acquires a read lock and multiple threads can enter the call without blocking.

        Throws:
        IllegalStateException - Thrown in case when no kernal calls are allowed.
        See Also:
        readUnlock()
      • readLockAnyway

        void readLockAnyway()
        Same as readLock() but doesn't throw IllegalStateException if grid stop.
      • setState

        void setState​(GridKernalState state)
        Sets kernal state. Various kernal states drive the logic inside of the gateway.
        Parameters:
        state - Kernal state to set.
      • getState

        GridKernalState getState()
        Gets current kernal state.
        Returns:
        Kernal state.
      • readUnlock

        void readUnlock()
        Should be called on leaving every kernal related call originated directly or indirectly via public API.

        This method essentially releases the internal read-lock acquired previously by readLock() method.

        See Also:
        readLock()
      • writeLock

        void writeLock()
        This method waits for all current calls to exit and blocks any further readLock() calls until writeUnlock() method is called.

        This method essentially acquires the internal write lock.

      • writeUnlock

        void writeUnlock()
        This method unblocks writeLock().

        This method essentially releases internal write lock previously acquired by writeLock() method.

      • userStackTrace

        String userStackTrace()
        Gets user stack trace through the first call of grid public API.
        Returns:
        User stack trace.
      • tryWriteLock

        boolean tryWriteLock​(long timeout)
                      throws InterruptedException
        Parameters:
        timeout - Timeout.
        Returns:
        True if write lock has been acquired.
        Throws:
        InterruptedException - If interrupted.
      • onDisconnected

        @Nullable
        @Nullable GridFutureAdapter<?> onDisconnected()
        Disconnected callback.
        Returns:
        Reconnect future.
      • onReconnected

        void onReconnected()
        Reconnected callback.