ClientProxy Sınıfı
Şu satırı dahil ederiz
import com.hazelcast.client.impl.spi.ClientProxy;
invoke metodu
Metod şöyle. ClientPartitionServiceImpl ile partitionId bulunurinvokeOnPartition metodu
protected <T> T invoke(ClientMessage clientMessage, Object key) { final int partitionId = getContext().getPartitionService().getPartitionId(key); return invokeOnPartition(clientMessage, partitionId); }
Metod şöyle. Burada yeni bir ClientInvocation yaratılıyor.ClientInvocation bir future döndürüyor ve onun üzerinde bekliyor.
protected <T> T invokeOnPartition(ClientMessage clientMessage, int partitionId) { try { final Future future = new ClientInvocation(getClient(),
clientMessage, getName(), partitionId).invoke(); return (T) future.get(); } catch (Exception e) { throw rethrow(e); } }
ClientInvocationService Arayüzü
Bu arayüzü gerçekleştiren tek sınıf ClientInvocationServiceImpl
invoke metodu
Metod şöyle. connectionManager nesnesi bir ClientConnectionManager. Bu arayüzü gerçekleştiren tek sınıf ise TcpClientConnectionManager@Override public boolean invoke(ClientInvocation invocation) { ClientConnection connection = connectionManager.getRandomConnection(); if (connection == null) { if (invocationLogger.isFinestEnabled()) { invocationLogger.finest("No connection found to invoke"); } return false; } return send(invocation, connection); }
NioNetworking Sınıfı
Açıklaması şöyle. Yani Netty projesini tekrar icat etmişler.
A non-blocking Networking implementation that makes use of java.nio.channels.Selector to have a limited set of io threads, handle an arbitrary number of connections.Each NioChannel has 2 parts:1. NioInboundPipeline: triggered by the NioThread when data is available in the socket. The NioInboundPipeline takes care of reading data from the socket and calling the appropriate InboundHandler2. NioOutboundPipeline: triggered by the NioThread when either space is available in the socket for writing, or when there is something that needs to be written e.g. a Packet. The NioOutboundPipeline takes care of calling the appropriate OutboundHandler to convert the com.hazelcast.internal.networking.OutboundFrame to bytes in in the ByteBuffer and writing it to the socket.By default, the NioThread blocks on the Selector, but it can be put in a 'selectNow' mode that makes it spin on the selector. This is an experimental feature and will cause the io threads to run hot. For this reason, when this feature is enabled, the number of io threads should be reduced (preferably 1).
hz.XXX.IO-thread-in-0
hz.XXX.IO-thread-out-0
Hiç yorum yok:
Yorum Gönder