Search in sources :

Example 16 with ClientEndpoint

use of com.hazelcast.client.ClientEndpoint in project hazelcast by hazelcast.

the class AbstractAllPartitionsMessageTask method processMessage.

@Override
protected void processMessage() throws Exception {
    ClientEndpoint endpoint = getEndpoint();
    OperationFactory operationFactory = new OperationFactoryWrapper(createOperationFactory(), endpoint.getUuid());
    final InternalOperationService operationService = nodeEngine.getOperationService();
    Map<Integer, Object> map = operationService.invokeOnAllPartitions(getServiceName(), operationFactory);
    sendResponse(reduce(map));
}
Also used : OperationFactoryWrapper(com.hazelcast.client.impl.operations.OperationFactoryWrapper) InternalOperationService(com.hazelcast.spi.impl.operationservice.InternalOperationService) ClientEndpoint(com.hazelcast.client.ClientEndpoint) OperationFactory(com.hazelcast.spi.OperationFactory)

Example 17 with ClientEndpoint

use of com.hazelcast.client.ClientEndpoint in project hazelcast by hazelcast.

the class AddMembershipListenerMessageTask method call.

@Override
protected Object call() {
    String serviceName = ClusterServiceImpl.SERVICE_NAME;
    ClusterServiceImpl service = getService(serviceName);
    ClientEndpoint endpoint = getEndpoint();
    String registrationId = service.addMembershipListener(new MembershipListenerImpl(endpoint));
    endpoint.addListenerDestroyAction(serviceName, serviceName, registrationId);
    return registrationId;
}
Also used : ClusterServiceImpl(com.hazelcast.internal.cluster.impl.ClusterServiceImpl) ClientEndpoint(com.hazelcast.client.ClientEndpoint)

Example 18 with ClientEndpoint

use of com.hazelcast.client.ClientEndpoint in project hazelcast by hazelcast.

the class ClientDisconnectionOperation method run.

@Override
public void run() throws Exception {
    ClientEngineImpl engine = getService();
    final ClientEndpointManagerImpl endpointManager = (ClientEndpointManagerImpl) engine.getEndpointManager();
    if (!engine.removeOwnershipMapping(clientUuid, memberUuid)) {
        return;
    }
    Set<ClientEndpoint> endpoints = endpointManager.getEndpoints(clientUuid);
    // This part cleans up listener and transactions
    for (ClientEndpoint endpoint : endpoints) {
        endpoint.getConnection().close("ClientDisconnectionOperation: Client disconnected from cluster", null);
    }
    // This part cleans up locks conditions semaphore etc..
    NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
    nodeEngine.onClientDisconnected(clientUuid);
    Collection<ClientAwareService> services = nodeEngine.getServices(ClientAwareService.class);
    for (ClientAwareService service : services) {
        service.clientDisconnected(clientUuid);
    }
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) ClientAwareService(com.hazelcast.spi.ClientAwareService) ClientEndpointManagerImpl(com.hazelcast.client.impl.ClientEndpointManagerImpl) ClientEngineImpl(com.hazelcast.client.impl.ClientEngineImpl) ClientEndpoint(com.hazelcast.client.ClientEndpoint)

Example 19 with ClientEndpoint

use of com.hazelcast.client.ClientEndpoint in project hazelcast by hazelcast.

the class CacheAddEntryListenerMessageTask method call.

@Override
protected Object call() {
    ClientEndpoint endpoint = getEndpoint();
    final CacheService service = getService(CacheService.SERVICE_NAME);
    CacheEntryListener cacheEntryListener = new CacheEntryListener(endpoint, this);
    final String registrationId = service.registerListener(parameters.name, cacheEntryListener, cacheEntryListener, parameters.localOnly);
    endpoint.addDestroyAction(registrationId, new Callable<Boolean>() {

        @Override
        public Boolean call() throws Exception {
            return service.deregisterListener(parameters.name, registrationId);
        }
    });
    return registrationId;
}
Also used : ClientEndpoint(com.hazelcast.client.ClientEndpoint) CacheService(com.hazelcast.cache.impl.CacheService)

Example 20 with ClientEndpoint

use of com.hazelcast.client.ClientEndpoint in project hazelcast by hazelcast.

the class MapPublisherCreateWithValueMessageTask method createInvocations.

private void createInvocations(Collection<MemberImpl> members, List<Future> futures) {
    final InternalOperationService operationService = nodeEngine.getOperationService();
    final ClientEndpoint endpoint = getEndpoint();
    for (MemberImpl member : members) {
        Predicate predicate = serializationService.toObject(parameters.predicate);
        AccumulatorInfo accumulatorInfo = AccumulatorInfo.createAccumulatorInfo(parameters.mapName, parameters.cacheName, predicate, parameters.batchSize, parameters.bufferSize, parameters.delaySeconds, true, parameters.populate, parameters.coalesce);
        PublisherCreateOperation operation = new PublisherCreateOperation(accumulatorInfo);
        operation.setCallerUuid(endpoint.getUuid());
        Address address = member.getAddress();
        InvocationBuilder invocationBuilder = operationService.createInvocationBuilder(SERVICE_NAME, operation, address);
        Future future = invocationBuilder.invoke();
        futures.add(future);
    }
}
Also used : Address(com.hazelcast.nio.Address) MemberImpl(com.hazelcast.instance.MemberImpl) Future(java.util.concurrent.Future) AccumulatorInfo(com.hazelcast.map.impl.querycache.accumulator.AccumulatorInfo) InternalOperationService(com.hazelcast.spi.impl.operationservice.InternalOperationService) InvocationBuilder(com.hazelcast.spi.InvocationBuilder) ClientEndpoint(com.hazelcast.client.ClientEndpoint) PublisherCreateOperation(com.hazelcast.map.impl.querycache.subscriber.operation.PublisherCreateOperation) Predicate(com.hazelcast.query.Predicate)

Aggregations

ClientEndpoint (com.hazelcast.client.ClientEndpoint)21 CacheService (com.hazelcast.cache.impl.CacheService)4 Data (com.hazelcast.nio.serialization.Data)4 ClientMessage (com.hazelcast.client.impl.protocol.ClientMessage)3 ItemListener (com.hazelcast.core.ItemListener)3 EventRegistration (com.hazelcast.spi.EventRegistration)3 EventService (com.hazelcast.spi.EventService)3 InternalOperationService (com.hazelcast.spi.impl.operationservice.InternalOperationService)3 CacheContext (com.hazelcast.cache.impl.CacheContext)2 ClientEngineImpl (com.hazelcast.client.impl.ClientEngineImpl)2 OperationFactoryWrapper (com.hazelcast.client.impl.operations.OperationFactoryWrapper)2 CollectionEventFilter (com.hazelcast.collection.impl.collection.CollectionEventFilter)2 MapService (com.hazelcast.map.impl.MapService)2 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)2 EventFilter (com.hazelcast.spi.EventFilter)2 InvocationBuilder (com.hazelcast.spi.InvocationBuilder)2 OperationFactory (com.hazelcast.spi.OperationFactory)2 ICacheService (com.hazelcast.cache.impl.ICacheService)1 CachePartitionLostEvent (com.hazelcast.cache.impl.event.CachePartitionLostEvent)1 CachePartitionLostEventFilter (com.hazelcast.cache.impl.event.CachePartitionLostEventFilter)1