org.apache.ignite.internal

## Class GridKernalGatewayImpl

- java.lang.Object
- - org.apache.ignite.internal.GridKernalGatewayImpl

All Implemented Interfaces:
  Serializable, GridKernalGateway

    @GridToStringExclude
    public class GridKernalGatewayImpl
    extends Object
    implements GridKernalGateway, Serializable

See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`GridKernalGatewayImpl(String igniteInstanceName)`

### Method Summary

All Methods Instance Methods Concrete Methods
`GridKernalState` `getState()` Gets current kernal state.
`GridFutureAdapter<?>` `onDisconnected()` Disconnected callback.
`void` `onReconnected()` Reconnected callback.
`void` `readLock()` Should be called on entering every kernal related call originated directly or indirectly via public API.
`void` `readLockAnyway()` Same as `GridKernalGateway.readLock()` but doesn't throw IllegalStateException if grid stop.
`void` `readUnlock()` Should be called on leaving every kernal related call originated directly or indirectly via public API.
`void` `setState(GridKernalState state)` Sets kernal state.
`String` `toString()`
`boolean` `tryWriteLock(long timeout)`
`String` `userStackTrace()` Gets user stack trace through the first call of grid public API.
`void` `writeLock()` This method waits for all current calls to exit and blocks any further `GridKernalGateway.readLock()` calls until `GridKernalGateway.writeUnlock()` method is called.
`void` `writeUnlock()` This method unblocks `GridKernalGateway.writeLock()`.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### GridKernalGatewayImpl

    public GridKernalGatewayImpl(String igniteInstanceName)

Parameters:
  `igniteInstanceName` - Ignite instance name.

### Method Detail

#### readLock

    public void readLock()
                  throws IgniteIllegalStateException

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.

Specified by:
  `readLock` in interface `GridKernalGateway`
Throws:
  `IgniteIllegalStateException`
See Also:
  `GridKernalGateway.readUnlock()`

#### readLockAnyway

    public void readLockAnyway()

Same as `GridKernalGateway.readLock()` but doesn't throw IllegalStateException if grid stop.

Specified by:
  `readLockAnyway` in interface `GridKernalGateway`

#### readUnlock

    public 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 `GridKernalGateway.readLock()` method.

Specified by:
  `readUnlock` in interface `GridKernalGateway`
See Also:
  `GridKernalGateway.readLock()`

#### writeLock

    public void writeLock()

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

This method essentially acquires the internal write lock.

Specified by:
  `writeLock` in interface `GridKernalGateway`

#### tryWriteLock

    public boolean tryWriteLock(long timeout)
                         throws InterruptedException

Specified by:
  `tryWriteLock` in interface `GridKernalGateway`
Parameters:
  `timeout` - Timeout.
Returns:
  `True` if write lock has been acquired.
Throws:
  `InterruptedException` - If interrupted.

#### onDisconnected

    public GridFutureAdapter<?> onDisconnected()

Disconnected callback.

Specified by:
  `onDisconnected` in interface `GridKernalGateway`
Returns:
  Reconnect future.

#### onReconnected

    public void onReconnected()

Reconnected callback.

Specified by:
  `onReconnected` in interface `GridKernalGateway`

#### writeUnlock

    public void writeUnlock()

This method unblocks `GridKernalGateway.writeLock()`.

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

Specified by:
  `writeUnlock` in interface `GridKernalGateway`

#### setState

    public void setState(GridKernalState state)

Sets kernal state. Various kernal states drive the logic inside of the gateway.

Specified by:
  `setState` in interface `GridKernalGateway`
Parameters:
  `state` - Kernal state to set.

#### getState

    public GridKernalState getState()

Gets current kernal state.

Specified by:
  `getState` in interface `GridKernalGateway`
Returns:
  Kernal state.

#### userStackTrace

    public String userStackTrace()

Gets user stack trace through the first call of grid public API.

Specified by:
  `userStackTrace` in interface `GridKernalGateway`
Returns:
  User stack trace.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.13.0
Release Date | : April 20 2022