com.hazelcast.client.spi

## Class ClientProxy

- java.lang.Object
- - com.hazelcast.client.spi.ClientProxy

- All Implemented Interfaces:
    DistributedObject
  Direct Known Subclasses:
    ClientAtomicLongProxy, ClientAtomicReferenceProxy, ClientCardinalityEstimatorProxy, ClientConditionProxy, ClientCountDownLatchProxy, ClientDurableExecutorServiceProxy, ClientExecutorServiceProxy, ClientFlakeIdGeneratorProxy, ClientIdGeneratorProxy, ClientListProxy, ClientLockProxy, ClientMapProxy, ClientMapReduceProxy, ClientMultiMapProxy, ClientPNCounterProxy, ClientQueueProxy, ClientReliableTopicProxy, ClientReplicatedMapProxy, ClientRingbufferProxy, ClientScheduledExecutorProxy, ClientScheduledFutureProxy, ClientSemaphoreProxy, ClientSetProxy, ClientTopicProxy, XAResourceProxy

      public abstract class ClientProxy
      extends Object
      implements DistributedObject

  Base class for client proxies.

  Allows the client to proxy operations through member nodes.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected String` | `name`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `ClientProxy(String serviceName, String name)` Deprecated. since 3.9, please use `ClientProxy(String, String, ClientContext)`
    `protected` | `ClientProxy(String serviceName, String name, ClientContext context)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected boolean` | `deregisterListener(String registrationId)`
    `void` | `destroy()` Destroys this object cluster-wide.
    `void` | `destroyLocally()` Destroys this client proxy instance locally without issuing distributed object destroy request to the cluster as the `destroy()` method does.
    `void` | `destroyRemotely()` Destroys the remote distributed object counterpart of this proxy by issuing the destruction request to the cluster.
    `boolean` | `equals(Object o)`
    `protected com.hazelcast.client.impl.clientside.HazelcastClientInstanceImpl` | `getClient()`
    `protected int` | `getConnectedServerVersion()`
    `ClientContext` | `getContext()`
    `protected String` | `getDistributedObjectName()`
    `Object` | `getId()` Deprecated.
    `String` | `getName()` Returns the unique name for this DistributedObject.
    `String` | `getPartitionKey()` Returns the key of the partition that this DistributedObject is assigned to.
    `protected SerializationService` | `getSerializationService()`
    `String` | `getServiceName()` Returns the service name for this object.
    `int` | `hashCode()`
    `protected <T> T` | `invoke(com.hazelcast.client.impl.protocol.ClientMessage clientMessage)`
    `protected <T> T` | `invoke(com.hazelcast.client.impl.protocol.ClientMessage clientMessage, Object key)`
    `protected <T> T` | `invokeOnAddress(com.hazelcast.client.impl.protocol.ClientMessage clientMessage, Address address)`
    `protected <T> T` | `invokeOnPartition(com.hazelcast.client.impl.protocol.ClientMessage clientMessage, int partitionId)`
    `protected <T> T` | `invokeOnPartitionInterruptibly(com.hazelcast.client.impl.protocol.ClientMessage clientMessage, int partitionId)`
    `protected void` | `onDestroy()` Called before proxy is destroyed.
    `protected void` | `onInitialize()` Called when proxy is created.
    `protected void` | `onShutdown()` Called before client shutdown.
    `protected void` | `postDestroy()` Called after proxy is destroyed.
    `protected boolean` | `preDestroy()` Called before proxy is destroyed and determines whether destroy should be done.
    `protected String` | `registerListener(com.hazelcast.client.spi.impl.ListenerMessageCodec codec, EventHandler handler)`
    `protected ClientProxy` | `setContext(ClientContext context)`
    `protected Data` | `toData(Object o)`
    `protected <T> T` | `toObject(Object data)`

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

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### name

          protected final String name

  - ### Constructor Detail

    - #### ClientProxy

          @Deprecated
          protected ClientProxy(String serviceName,
                                            String name)

      Deprecated. since 3.9, please use `ClientProxy(String, String, ClientContext)`

    - #### ClientProxy

          protected ClientProxy(String serviceName,
                                String name,
                                ClientContext context)

  - ### Method Detail

    - #### registerListener

          protected final String registerListener(com.hazelcast.client.spi.impl.ListenerMessageCodec codec,
                                                  EventHandler handler)

    - #### deregisterListener

          protected final boolean deregisterListener(String registrationId)

    - #### getContext

          public final ClientContext getContext()

    - #### setContext

          protected final ClientProxy setContext(ClientContext context)

    - #### getSerializationService

          protected SerializationService getSerializationService()

    - #### toData

          protected Data toData(Object o)

    - #### toObject

          protected <T> T toObject(Object data)

    - #### getClient

          protected final com.hazelcast.client.impl.clientside.HazelcastClientInstanceImpl getClient()

    - #### getConnectedServerVersion

          protected final int getConnectedServerVersion()

    - #### getId

          @Deprecated
          public final Object getId()

      Deprecated.

    - #### getName

          public final String getName()

      Description copied from interface: `DistributedObject`
      Returns the unique name for this DistributedObject. The returned value will never be null. The suggested way for getting name is retrieving it through `DistributedObjectUtil.getName(DistributedObject)` because this might be also a `PrefixedDistributedObject`.
      Specified by:
        `getName` in interface `DistributedObject`
      Returns:
        the unique name for this object.

    - #### getPartitionKey

          public String getPartitionKey()

      Description copied from interface: `DistributedObject`
      Returns the key of the partition that this DistributedObject is assigned to. The returned value only has meaning for a non-partitioned data structure like an `IAtomicLong`. For a partitioned data structure like an `IMap`, the returned value will not be null, but otherwise undefined.
      Specified by:
        `getPartitionKey` in interface `DistributedObject`
      Returns:
        the partition key.

    - #### getServiceName

          public final String getServiceName()

      Description copied from interface: `DistributedObject`
      Returns the service name for this object.
      Specified by:
        `getServiceName` in interface `DistributedObject`
      Returns:
        the service name for this object.

    - #### getDistributedObjectName

          protected String getDistributedObjectName()

    - #### destroy

          public final void destroy()

      Description copied from interface: `DistributedObject`
      Destroys this object cluster-wide. Clears and releases all resources for this object.
      Specified by:
        `destroy` in interface `DistributedObject`

    - #### destroyLocally

          public final void destroyLocally()

      Destroys this client proxy instance locally without issuing distributed object destroy request to the cluster as the `destroy()` method does.

      The local destruction operation still may perform some communication with the cluster; for example, to unregister remote event subscriptions.

    - #### destroyRemotely

          public final void destroyRemotely()

      Destroys the remote distributed object counterpart of this proxy by issuing the destruction request to the cluster.

    - #### onInitialize

          protected void onInitialize()

      Called when proxy is created. Overriding implementations can add initialization specific logic into this method like registering a listener, creating a cleanup task etc.

    - #### onDestroy

          protected void onDestroy()

      Called before proxy is destroyed. Overriding implementations should clean/release resources created during initialization.

    - #### preDestroy

          protected boolean preDestroy()

      Called before proxy is destroyed and determines whether destroy should be done.
      Returns:
        `true` if destroy should be done, otherwise `false`

    - #### postDestroy

          protected void postDestroy()

      Called after proxy is destroyed.

    - #### onShutdown

          protected void onShutdown()

      Called before client shutdown. Overriding implementations can add shutdown specific logic here.

    - #### invoke

          protected <T> T invoke(com.hazelcast.client.impl.protocol.ClientMessage clientMessage,
                                 Object key)

    - #### invokeOnPartition

          protected <T> T invokeOnPartition(com.hazelcast.client.impl.protocol.ClientMessage clientMessage,
                                            int partitionId)

    - #### invokeOnAddress

          protected <T> T invokeOnAddress(com.hazelcast.client.impl.protocol.ClientMessage clientMessage,
                                          Address address)

    - #### invokeOnPartitionInterruptibly

          protected <T> T invokeOnPartitionInterruptibly(com.hazelcast.client.impl.protocol.ClientMessage clientMessage,
                                                         int partitionId)
                                                  throws InterruptedException

      Throws:
        `InterruptedException`

    - #### invoke

          protected <T> T invoke(com.hazelcast.client.impl.protocol.ClientMessage clientMessage)

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

Copyright © 2019. All rights reserved.