Package com.hazelcast.nio.serialization

Examples of com.hazelcast.nio.serialization.SerializationService


    @Override
    public void run() throws Exception {
        NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
        InternalPartitionServiceImpl partitionService = (InternalPartitionServiceImpl) nodeEngine.getPartitionService();
        SerializationService serializationService = nodeEngine.getSerializationService();
        int partitionId = getPartitionId();
        int replicaIndex = getReplicaIndex();
        BufferObjectDataInput in = null;
        try {
            if (data != null && data.length > 0) {
                logApplyReplicaSync(partitionId, replicaIndex);
                byte[] taskData = compressed ? IOUtil.decompress(data) : data;
                in = serializationService.createObjectDataInput(taskData);
                int size = in.readInt();
                for (int i = 0; i < size; i++) {
                    Operation op = (Operation) serializationService.readObject(in);
                    try {
                        ErrorLoggingResponseHandler responseHandler
                                = new ErrorLoggingResponseHandler(nodeEngine.getLogger(op.getClass()));
                        op.setNodeEngine(nodeEngine)
                                .setPartitionId(partitionId)
View Full Code Here


        final QueryResult result = new QueryResult();
        List<QueryEntry> list = new LinkedList<QueryEntry>();
        PartitionContainer container = getPartitionContainer(partitionId);
        RecordStore recordStore = container.getRecordStore(mapName);
        Map<Data, Record> records = recordStore.getReadonlyRecordMapByWaitingMapStoreLoad();
        SerializationService serializationService = nodeEngine.getSerializationService();
        final PagingPredicate pagingPredicate = predicate instanceof PagingPredicate ? (PagingPredicate) predicate : null;
        Comparator<Map.Entry> wrapperComparator = SortingUtil.newComparator(pagingPredicate);
        for (Record record : records.values()) {
            Data key = record.getKey();
            Object value = record.getValue();
View Full Code Here

        InternalPartitionServiceImpl partitionService = getService();
        partitionService.addActiveMigration(migrationInfo);
    }

    private void buildMigrationTasks() throws IOException {
        SerializationService serializationService = getNodeEngine().getSerializationService();
        BufferObjectDataInput in = serializationService.createObjectDataInput(toData());
        try {
            int size = in.readInt();
            tasks = new ArrayList<Operation>(size);
            for (int i = 0; i < size; i++) {
                Operation task = (Operation) serializationService.readObject(in);
                tasks.add(task);
            }
        } finally {
            closeResource(in);
        }
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

            socketAddresses.addAll(getConfigAddresses());
            return socketAddresses;
        }

        private void loadInitialMemberList() throws Exception {
            final SerializationService serializationService = 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(membersString());
            final List<MembershipEvent> events = new LinkedList<MembershipEvent>();
            final Set<Member> eventMembers = Collections.unmodifiableSet(new LinkedHashSet<Member>(members));
View Full Code Here

            }
            latch.countDown();
        }

        private void listenMembershipEvents() throws IOException {
            final SerializationService serializationService = 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

    }

    private Result processQueryEventFilter(EventFilter filter, EntryEventType eventType,
                                           final Data dataKey, Data dataOldValue, Data dataValue) {
        final NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
        final SerializationService serializationService = nodeEngine.getSerializationService();
        Object testValue;
        if (eventType == EntryEventType.REMOVED || eventType == EntryEventType.EVICTED) {
            testValue = serializationService.toObject(dataOldValue);
        } else {
            testValue = serializationService.toObject(dataValue);
        }
        Object key = serializationService.toObject(dataKey);
        QueryEventFilter queryEventFilter = (QueryEventFilter) filter;
        QueryEntry entry = new QueryEntry(serializationService, dataKey, key, testValue);
        if (queryEventFilter.eval(entry)) {
            if (queryEventFilter.isIncludeValue()) {
                return Result.VALUE_INCLUDED;
View Full Code Here

     */
    public static <K, V> MapDataStore<K, V> createWriteBehindStore(MapContainer mapContainer, int partitionId,
                                                                   WriteBehindProcessor writeBehindProcessor) {
        final MapServiceContext mapServiceContext = mapContainer.getMapServiceContext();
        final MapStoreWrapper store = mapContainer.getStore();
        final SerializationService serializationService = mapServiceContext.getNodeEngine().getSerializationService();
        final int writeDelaySeconds = mapContainer.getMapConfig().getMapStoreConfig().getWriteDelaySeconds();
        final long millis = mapServiceContext.convertTime(writeDelaySeconds, TimeUnit.SECONDS);
        // TODO writeCoalescing should be configurable.
        boolean writeCoalescing = true;
        final WriteBehindStore mapDataStore
View Full Code Here

    protected void saveIndex(Record record) {
        Data dataKey = record.getKey();
        final IndexService indexService = mapContainer.getIndexService();
        if (indexService.hasIndex()) {
            SerializationService ss = mapServiceContext.getNodeEngine().getSerializationService();
            QueryableEntry queryableEntry = new QueryEntry(ss, dataKey, dataKey, record.getValue());
            indexService.saveEntryIndex(queryableEntry);
        }
    }
View Full Code Here

    @Override
    public Collection<QueryableEntry> queryOnPartition(String mapName, Predicate predicate, int partitionId) {
        final PartitionContainer container = mapServiceContext.getPartitionContainer(partitionId);
        final RecordStore recordStore = container.getRecordStore(mapName);
        final SerializationService serializationService = nodeEngine.getSerializationService();
        final PagingPredicate pagingPredicate = predicate instanceof PagingPredicate ? (PagingPredicate) predicate : null;
        List<QueryEntry> list = new LinkedList<QueryEntry>();
        final Iterator<Record> iterator = recordStore.loadAwareIterator();
        while (iterator.hasNext()) {
            final Record record = iterator.next();
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.