use of com.hazelcast.client.ClientEndpoint in project hazelcast by hazelcast.
the class ClientHeartbeatMonitor method run.
@Override
public void run() {
String memberUuid = clientEngine.getThisUuid();
for (ClientEndpoint ce : clientEndpointManager.getEndpoints()) {
ClientEndpointImpl clientEndpoint = (ClientEndpointImpl) ce;
monitor(memberUuid, clientEndpoint);
}
}
use of com.hazelcast.client.ClientEndpoint in project hazelcast by hazelcast.
the class ClientReAuthOperation method run.
@Override
public void run() throws Exception {
ClientEngineImpl engine = getService();
String memberUuid = getCallerUuid();
if (!engine.trySetLastAuthenticationCorrelationId(clientUuid, authCorrelationId)) {
String message = "Server already processed a newer authentication from client with uuid " + clientUuid + ". Not applying requested ownership change to " + memberUuid;
getLogger().info(message);
throw new AuthenticationException(message);
}
Set<ClientEndpoint> endpoints = engine.getEndpointManager().getEndpoints(clientUuid);
for (ClientEndpoint endpoint : endpoints) {
ClientPrincipal principal = new ClientPrincipal(clientUuid, memberUuid);
endpoint.authenticated(principal);
}
String previousMemberUuid = engine.addOwnershipMapping(clientUuid, memberUuid);
clientDisconnectOperationRun = previousMemberUuid == null;
}
use of com.hazelcast.client.ClientEndpoint in project hazelcast by hazelcast.
the class ClientEndpointManagerImpl method getEndpoints.
@Override
public Set<ClientEndpoint> getEndpoints(String clientUuid) {
checkNotNull(clientUuid, "clientUuid can't be null");
Set<ClientEndpoint> endpointSet = new HashSet<ClientEndpoint>();
for (ClientEndpoint endpoint : endpoints.values()) {
if (clientUuid.equals(endpoint.getUuid())) {
endpointSet.add(endpoint);
}
}
return endpointSet;
}
use of com.hazelcast.client.ClientEndpoint in project hazelcast by hazelcast.
the class CacheAddNearCacheInvalidationListenerTask method call.
@Override
protected Object call() {
ClientEndpoint endpoint = getEndpoint();
CacheService cacheService = getService(CacheService.SERVICE_NAME);
CacheContext cacheContext = cacheService.getOrCreateCacheContext(parameters.name);
NearCacheInvalidationListener listener = new NearCacheInvalidationListener(endpoint, cacheContext, nodeEngine.getLocalMember().getUuid());
String registrationId = cacheService.addInvalidationListener(parameters.name, listener, parameters.localOnly);
endpoint.addListenerDestroyAction(CacheService.SERVICE_NAME, parameters.name, registrationId);
return registrationId;
}
use of com.hazelcast.client.ClientEndpoint in project hazelcast by hazelcast.
the class CacheAddPartitionLostListenerMessageTask method call.
@Override
protected Object call() {
final ClientEndpoint endpoint = getEndpoint();
CachePartitionLostListener listener = new CachePartitionLostListener() {
@Override
public void partitionLost(CachePartitionLostEvent event) {
if (endpoint.isAlive()) {
ClientMessage eventMessage = CacheAddPartitionLostListenerCodec.encodeCachePartitionLostEvent(event.getPartitionId(), event.getMember().getUuid());
sendClientMessage(null, eventMessage);
}
}
};
InternalCachePartitionLostListenerAdapter listenerAdapter = new InternalCachePartitionLostListenerAdapter(listener);
EventFilter filter = new CachePartitionLostEventFilter();
CacheService service = getService(CacheService.SERVICE_NAME);
EventService eventService = service.getNodeEngine().getEventService();
EventRegistration registration;
if (parameters.localOnly) {
registration = eventService.registerLocalListener(ICacheService.SERVICE_NAME, parameters.name, filter, listenerAdapter);
} else {
registration = eventService.registerListener(ICacheService.SERVICE_NAME, parameters.name, filter, listenerAdapter);
}
String registrationId = registration.getId();
endpoint.addListenerDestroyAction(CacheService.SERVICE_NAME, parameters.name, registrationId);
return registrationId;
}
Aggregations