Package com.hazelcast.nio.serialization

Examples of com.hazelcast.nio.serialization.SerializationService


    public Set queryLocalMember(String mapName, final Predicate predicate,
                                final IterationType iterationType, final boolean dataResult) {
        checkIfNotPagingPredicate(predicate);
        final NodeEngine nodeEngine = this.nodeEngine;
        final List<Integer> partitionIds = getLocalPartitionIds(nodeEngine);
        final SerializationService serializationService = nodeEngine.getSerializationService();
        final Set result = new QueryResultSet(serializationService, iterationType, dataResult);
        try {
            final Future future = queryOnLocalMember(mapName, predicate, nodeEngine);
            final List<Future> futures = Collections.singletonList(future);
            addResultsOfPredicate(futures, result, partitionIds);
View Full Code Here


    @Override
    public Set query(String mapName, final Predicate predicate,
                     final IterationType iterationType, final boolean dataResult) {
        checkIfNotPagingPredicate(predicate);
        final NodeEngine nodeEngine = this.nodeEngine;
        final SerializationService serializationService = nodeEngine.getSerializationService();
        final Set<Integer> partitionIds = getAllPartitionIds(nodeEngine);
        final Set result = new QueryResultSet(serializationService, iterationType, dataResult);
        try {
            List<Future> futures = queryOnMembers(mapName, predicate, nodeEngine);
            addResultsOfPredicate(futures, result, partitionIds);
View Full Code Here

        this.hazelcastInstance = hazelcastInstance;
        this.threadGroup = hazelcastInstance.threadGroup;
        this.config = config;
        configClassLoader = config.getClassLoader();
        this.groupProperties = new GroupProperties(config);
        SerializationService ss;
        try {
            String partitioningStrategyClassName = groupProperties.PARTITIONING_STRATEGY_CLASS.getString();
            final PartitioningStrategy partitioningStrategy;
            if (partitioningStrategyClassName != null && partitioningStrategyClassName.length() > 0) {
                partitioningStrategy = ClassLoaderUtil.newInstance(configClassLoader, partitioningStrategyClassName);
View Full Code Here

            final Data key = record.getKey();
            final Object valueBeforeProcess = record.getValue();
            final Object valueBeforeProcessObject = mapServiceContext.toObject(valueBeforeProcess);
            Object objectKey = mapServiceContext.toObject(key);
            if (getPredicate() != null) {
                final SerializationService ss = getNodeEngine().getSerializationService();
                QueryEntry queryEntry = new QueryEntry(ss, key, objectKey, valueBeforeProcessObject);
                if (!getPredicate().apply(queryEntry)) {
                    continue;
                }
            }
View Full Code Here

        MapService mapService = getService();
        MapContainer mapContainer = mapService.getMapServiceContext().getMapContainer(name);
        RecordStore recordStore = mapService.getMapServiceContext()
                .getPartitionContainer(getPartitionId()).getRecordStore(name);
        IndexService indexService = mapContainer.getIndexService();
        SerializationService ss = getNodeEngine().getSerializationService();
        Index index = indexService.addOrGetIndex(attributeName, ordered);
        final Iterator<Record> iterator = recordStore.iterator();
        while (iterator.hasNext()) {
            final Record record = iterator.next();
            Data key = record.getKey();
View Full Code Here

    }

    private byte[] createReplicationData(List<Operation> tasks) throws IOException {
        byte[] data;
        NodeEngine nodeEngine = getNodeEngine();
        SerializationService serializationService = nodeEngine.getSerializationService();
        BufferObjectDataOutput out = serializationService.createObjectDataOutput(DEFAULT_DATA_OUTPUT_BUFFER_SIZE);
        try {
            out.writeInt(tasks.size());
            for (Operation task : tasks) {
                serializationService.writeObject(out, task);
            }
            data = out.toByteArray();
        } finally {
            closeResource(out);
        }
View Full Code Here

    private void spawnMigrationRequestTask(Address destination, long[] replicaVersions, Collection<Operation> tasks)
            throws IOException {
        NodeEngine nodeEngine = getNodeEngine();

        SerializationService serializationService = nodeEngine.getSerializationService();
        BufferObjectDataOutput out = createDataOutput(serializationService);

        out.writeInt(tasks.size());
        Iterator<Operation> iter = tasks.iterator();
        while (iter.hasNext()) {
            Operation task = iter.next();
            if (task instanceof NonThreadSafe) {
                serializationService.writeObject(out, task);
                iter.remove();
            }
        }

        ManagedExecutorService executor = nodeEngine.getExecutionService().getExecutor(ExecutionService.ASYNC_EXECUTOR);
View Full Code Here

    }

    private void sendInternal(ClientCallFuture future, ClientConnection connection) {
        connection.registerCallId(future);
        future.setConnection(connection);
        final SerializationService ss = client.getSerializationService();
        final Data data = ss.toData(future.getRequest());
        if (!connection.write(new Packet(data, ss.getPortableContext()))) {
            final int callId = future.getRequest().getCallId();
            connection.deRegisterCallId(callId);
            connection.deRegisterEventHandler(callId);
            future.notify(new TargetNotMemberException("Address : " + connection.getRemoteEndpoint()));
        }
View Full Code Here

        return socketAddresses;
    }

    private void loadInitialMemberList() throws Exception {
        final SerializationService serializationService = clusterService.getSerializationService();
        final AddMembershipListenerRequest request = new AddMembershipListenerRequest();
        final SerializableCollection coll = (SerializableCollection) connectionManager.sendAndReceive(request, conn);

        Map<String, MemberImpl> prevMembers = Collections.emptyMap();
        if (!members.isEmpty()) {
            prevMembers = new HashMap<String, MemberImpl>(members.size());
            for (MemberImpl member : members) {
                prevMembers.put(member.getUuid(), member);
            }
            members.clear();
        }
        for (Data data : coll) {
            members.add((MemberImpl) serializationService.toObject(data));
        }
        updateMembersRef();
        LOGGER.info(clusterService.membersString());
        fireMembershipEvent(prevMembers);
        latch.countDown();
View Full Code Here

            clusterService.fireMembershipEvent(event);
        }
    }

    private void listenMembershipEvents() throws IOException {
        final SerializationService serializationService = clusterService.getSerializationService();
        while (!Thread.currentThread().isInterrupted()) {
            final Data clientResponseData = conn.read();
            final ClientResponse clientResponse = serializationService.toObject(clientResponseData);
            final Object eventObject = serializationService.toObject(clientResponse.getResponse());
            final ClientMembershipEvent event = (ClientMembershipEvent) eventObject;
            final MemberImpl member = (MemberImpl) event.getMember();
            boolean membersUpdated = false;
            if (event.getEventType() == MembershipEvent.MEMBER_ADDED) {
                members.add(member);
View Full Code Here

TOP

Related Classes of com.hazelcast.nio.serialization.SerializationService

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.