Package com.hazelcast.client

Examples of com.hazelcast.client.ClientEndpoint


        this.includeValue = includeValue;
    }

    @Override
    public Object call() throws Exception {
        final ClientEndpoint endpoint = getEndpoint();
        final ClientEngine clientEngine = getClientEngine();

        ItemListener listener = createItemListener(endpoint);
        final EventService eventService = clientEngine.getEventService();
        final CollectionEventFilter filter = new CollectionEventFilter(includeValue);
        final EventRegistration registration = eventService.registerListener(getServiceName(), name, filter, listener);
        final String registrationId = registration.getId();
        endpoint.setListenerRegistration(getServiceName(), name, registrationId);
        return registrationId;
    }
View Full Code Here


    }

    @Override
    public Object call()
            throws Exception {
        final ClientEndpoint endpoint = getEndpoint();
        final ReplicatedRecordStore replicatedRecordStore = getReplicatedRecordStore();
        final EntryListener<Object, Object> listener = new ClientReplicatedMapEntryListener();
        String registrationId;
        if (predicate == null) {
            registrationId = replicatedRecordStore.addEntryListener(listener, key);
        } else {
            registrationId = replicatedRecordStore.addEntryListener(listener, predicate, key);
        }
        endpoint.setListenerRegistration(ReplicatedMapService.SERVICE_NAME, getMapName(), registrationId);
        return registrationId;
    }
View Full Code Here

public class GetDistributedObjectsRequest extends ClientRequest {

    @Override
    public void process() throws Exception {
        ClientEndpoint endpoint = getEndpoint();
        Collection<DistributedObject> distributedObjects = clientEngine.getProxyService().getAllDistributedObjects();

        List<Data> dataArrayList = new ArrayList<Data>(distributedObjects.size());
        for (DistributedObject distributedObject : distributedObjects) {
            DistributedObjectInfo distributedObjectInfo = new DistributedObjectInfo(
                    distributedObject.getServiceName(), distributedObject.getName());
            Data data = serializationService.toData(distributedObjectInfo);
            dataArrayList.add(data);
        }
        SerializableCollection collection = new SerializableCollection(dataArrayList);
        endpoint.sendResponse(collection, getCallId());
    }
View Full Code Here

    private static final int TRY_COUNT = 100;

    @Override
    public final void process() throws Exception {
        ClientEndpoint endpoint = getEndpoint();
        OperationFactory operationFactory = createOperationFactory();
        Collection<Address> targets = getTargets();
        if (targets.isEmpty()) {
            endpoint.sendResponse(reduce(new HashMap<Address, Object>()), getCallId());
            return;
        }

        MultiTargetCallback callback = new MultiTargetCallback(targets);
        for (Address target : targets) {
            Operation op = operationFactory.createOperation();
            op.setCallerUuid(endpoint.getUuid());
            InvocationBuilder builder = operationService.createInvocationBuilder(getServiceName(), op, target)
                    .setTryCount(TRY_COUNT)
                    .setResultDeserialized(false)
                    .setCallback(new SingleTargetCallback(target, callback));
            builder.invoke();
View Full Code Here

    }

    @Override
    public final void process()
            throws Exception {
        final ClientEndpoint endpoint = getEndpoint();
        final Operation op = prepareOperation();
        op.setCallerUuid(endpoint.getUuid());
        final InvocationBuilder builder = operationService.createInvocationBuilder(getServiceName(), op, partitionId);
        builder.setTryCount(TRY_COUNT).setResultDeserialized(false).setCallback(new Callback<Object>() {
            public void notify(Object object) {
                endpoint.sendResponse(object, getCallId());
            }
        });
        builder.invoke();
    }
View Full Code Here

public abstract class CallableClientRequest extends ClientRequest implements Callable {

    @Override
    public final void process() throws Exception {
        ClientEndpoint endpoint = getEndpoint();
        try {
            Object result = call();
            endpoint.sendResponse(result, getCallId());
        } catch (Exception e) {
            clientEngine.getLogger(getClass()).warning(e);
            endpoint.sendResponse(e, getCallId());
        }
    }
View Full Code Here

*/
public abstract class AllPartitionsClientRequest extends ClientRequest {

    @Override
    public final void process() throws Exception {
        ClientEndpoint endpoint = getEndpoint();
        OperationFactory operationFactory = new OperationFactoryWrapper(createOperationFactory(), endpoint.getUuid());
        Map<Integer, Object> map = operationService.invokeOnAllPartitions(getServiceName(), operationFactory);
        Object result = reduce(map);
        endpoint.sendResponse(result, getCallId());
    }
View Full Code Here

    private static final int TRY_COUNT = 100;

    @Override
    public final void process() throws Exception {
        final ClientEndpoint endpoint = getEndpoint();
        Operation op = prepareOperation();
        op.setCallerUuid(endpoint.getUuid());
        InvocationBuilder builder = operationService.createInvocationBuilder(getServiceName(), op, getTarget())
                .setTryCount(TRY_COUNT)
                .setResultDeserialized(false)
                .setCallback(new Callback<Object>() {
                    public void notify(Object object) {
                        endpoint.sendResponse(filter(object), getCallId());
                    }
                });
        builder.invoke();
    }
View Full Code Here

    }

    @Override
    public final void process() {
        beforeProcess();
        ClientEndpoint endpoint = getEndpoint();
        Operation op = prepareOperation();
        op.setCallerUuid(endpoint.getUuid());
        InvocationBuilder builder = operationService.createInvocationBuilder(getServiceName(), op, getPartition())
                .setReplicaIndex(getReplicaIndex())
                .setTryCount(TRY_COUNT)
                .setResultDeserialized(false)
                .setCallback(new CallbackImpl(endpoint));
View Full Code Here

public abstract class MultiPartitionClientRequest extends ClientRequest {

    @Override
    public final void process() throws Exception {
        ClientEndpoint endpoint = getEndpoint();
        OperationFactory operationFactory = new OperationFactoryWrapper(createOperationFactory(), endpoint.getUuid());
        Map<Integer, Object> map = operationService.invokeOnPartitions(getServiceName(), operationFactory, getPartitions());
        Object result = reduce(map);
        endpoint.sendResponse(result, getCallId());
    }
View Full Code Here

TOP

Related Classes of com.hazelcast.client.ClientEndpoint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.