Package com.hazelcast.client

Examples of com.hazelcast.client.ClientEndpoint


        return MapReduceService.SERVICE_NAME;
    }

    @Override
    protected void invoke() {
        final ClientEndpoint endpoint = getEndpoint();

        MapReduceService mapReduceService = getService();
        Address jobOwner = mapReduceService.getLocalAddress();
        mapReduceService.registerJobSupervisorCancellation(name, jobId, jobOwner);

        JobSupervisor supervisor = mapReduceService.getJobSupervisor(name, jobId);
        if (supervisor != null && supervisor.isOwnerNode()) {
            Exception exception = new CancellationException("Operation was cancelled by the user");
            supervisor.cancelAndNotify(exception);
        }
        endpoint.sendResponse(Boolean.TRUE, getCallId());
    }
View Full Code Here


    public PrepareTransactionRequest() {
    }

    @Override
    protected Object innerCall() throws Exception {
        ClientEndpoint endpoint = getEndpoint();
        TransactionContext transactionContext = endpoint.getTransactionContext(txnId);
        Transaction transaction = TransactionAccessor.getTransaction(transactionContext);
        transaction.prepare();
        return null;
    }
View Full Code Here

                logger.warning("Member left while recovering: " + e);
            } catch (Throwable e) {
                handleException(clientEngine, e);
            }
        }
        ClientEndpoint endpoint = getEndpoint();
        endpoint.sendResponse(new SerializableCollection(xids), getCallId());
    }
View Full Code Here

        this.prepareAndCommit = prepareAndCommit;
    }

    @Override
    public Object innerCall() throws Exception {
        ClientEndpoint endpoint = getEndpoint();
        TransactionContext transactionContext = endpoint.getTransactionContext(txnId);
        if (prepareAndCommit) {
            transactionContext.commitTransaction();
        } else {
            Transaction transaction = TransactionAccessor.getTransaction(transactionContext);
            transaction.commit();
        }
        endpoint.removeTransactionContext(txnId);
        return null;
    }
View Full Code Here

    @Override
    public String call() throws Exception {
        TopicService service = getService();
        ClientEngine clientEngine = getClientEngine();
        ClientEndpoint endpoint = getEndpoint();
        MessageListener listener = new MessageListenerImpl(endpoint, clientEngine, getCallId());
        String registrationId = service.addMessageListener(name, listener);
        endpoint.setListenerRegistration(TopicService.SERVICE_NAME, name, registrationId);
        return registrationId;
    }
View Full Code Here

                logger.warning("Member left while recovering: " + e);
            } catch (Throwable e) {
                handleException(clientEngine, e);
            }
        }
        ClientEndpoint endpoint = getEndpoint();
        endpoint.sendResponse(new SerializableCollection(xids), getCallId());
    }
View Full Code Here

    }

    @Override
    public Object call() throws Exception {
        final ClusterServiceImpl service = getService();
        final ClientEndpoint endpoint = getEndpoint();

        final String registrationId = service.addMembershipListener(new MembershipListener() {
            @Override
            public void memberAdded(MembershipEvent membershipEvent) {
                if (endpoint.live()) {
                    final MemberImpl member = (MemberImpl) membershipEvent.getMember();
                    endpoint.sendEvent(new ClientMembershipEvent(member, MembershipEvent.MEMBER_ADDED), getCallId());
                }
            }

            @Override
            public void memberRemoved(MembershipEvent membershipEvent) {
                if (endpoint.live()) {
                    final MemberImpl member = (MemberImpl) membershipEvent.getMember();
                    endpoint.sendEvent(new ClientMembershipEvent(member, MembershipEvent.MEMBER_REMOVED), getCallId());
                }
            }

            public void memberAttributeChanged(MemberAttributeEvent memberAttributeEvent) {
                if (endpoint.live()) {
                    final MemberImpl member = (MemberImpl) memberAttributeEvent.getMember();
                    final String uuid = member.getUuid();
                    final MemberAttributeOperationType op = memberAttributeEvent.getOperationType();
                    final String key = memberAttributeEvent.getKey();
                    final Object value = memberAttributeEvent.getValue();
                    final MemberAttributeChange memberAttributeChange = new MemberAttributeChange(uuid, op, key, value);
                    endpoint.sendEvent(new ClientMembershipEvent(member, memberAttributeChange), getCallId());
                }
            }
        });

        final String name = ClusterServiceImpl.SERVICE_NAME;
        endpoint.setListenerRegistration(name, name, registrationId);

        final Collection<MemberImpl> memberList = service.getMemberList();
        final Collection<Data> response = new ArrayList<Data>(memberList.size());
        for (MemberImpl member : memberList) {
            response.add(serializationService.toData(member));
View Full Code Here

        this.timeout = timeout;
    }

    @Override
    public Object innerCall() throws Exception {
        final ClientEndpoint endpoint = getEndpoint();
        final TransactionContext context = endpoint.getTransactionContext(txnId);
        final TransactionalQueue queue = context.getQueue(name);
        return queue.poll(timeout, TimeUnit.MILLISECONDS);
    }
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

        this.data = data;
    }

    @Override
    public Object innerCall() throws Exception {
        final ClientEndpoint endpoint = getEndpoint();
        final TransactionContext context = endpoint.getTransactionContext(txnId);
        final TransactionalQueue queue = context.getQueue(name);
        return queue.offer(data, timeout, TimeUnit.MILLISECONDS);
    }
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.