Package com.hazelcast.nio.serialization

Examples of com.hazelcast.nio.serialization.Data


    }

    public static Data readNullableData(ObjectDataInput in) throws IOException {
        final boolean isNotNull = in.readBoolean();
        if (isNotNull) {
            Data data = new Data();
            data.readData(in);
            return data;
        }
        return null;
    }
View Full Code Here


        }
        return null;
    }

    public static Data readData(ObjectDataInput in) throws IOException {
        Data data = new Data();
        data.readData(in);
        return data;
    }
View Full Code Here

        return false;
    }

    public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException {
        checkTransactionState();
        Data data = getNodeEngine().toData(e);
        return offerInternal(data, unit.toMillis(timeout));
    }
View Full Code Here

        return null;
    }

    public E poll(long timeout, TimeUnit unit) throws InterruptedException {
        checkTransactionState();
        Data data = pollInternal(unit.toMillis(timeout));
        return getNodeEngine().toObject(data);
    }
View Full Code Here

    }

    @Override
    public E peek(long timeout, TimeUnit unit) throws InterruptedException {
        checkTransactionState();
        Data data = peekInternal(unit.toMillis(timeout));
        return getNodeEngine().toObject(data);
    }
View Full Code Here

    }

    protected void readInternal(ObjectDataInput in) throws IOException {
        super.readInternal(in);
        itemId = in.readLong();
        data = new Data();
        data.readData(in);
    }
View Full Code Here

    }

    public void read(PortableReader reader) throws IOException {
        name = reader.readUTF("n");
        final ObjectDataInput in = reader.getRawDataInput();
        key = new Data();
        key.readData(in);
        processor = in.readObject();
    }
View Full Code Here

            final Object valueBeforeProcess = mapEntry.getValue();
            final Object valueBeforeProcessObject = mapService.toObject(valueBeforeProcess);
            entry = new MapEntrySimple(objectKey, valueBeforeProcessObject);
            final Object result = entryProcessor.process(entry);
            final Object valueAfterProcess = entry.getValue();
            Data dataValue = null;
            if (result != null) {
                dataValue = mapService.toData(result);
                response.add(new AbstractMap.SimpleImmutableEntry<Data, Data>(key, dataValue));
            }
            EntryEventType eventType;
            if (valueAfterProcess == null) {
                recordStore.remove(key);
                mapStats.incrementRemoves(getLatencyFrom(start));
                eventType = EntryEventType.REMOVED;
            } else {
                if (valueBeforeProcessObject == null) {
                    mapStats.incrementPuts(getLatencyFrom(start));
                    eventType = EntryEventType.ADDED;
                }
                // take this case as a read so no need to fire an event.
                else if (!entry.isModified()) {
                    mapStats.incrementGets(getLatencyFrom(start));
                    eventType = __NO_NEED_TO_FIRE_EVENT;
                } else {
                    mapStats.incrementPuts(getLatencyFrom(start));
                    eventType = EntryEventType.UPDATED;
                }
                // todo if this is a read only operation, record access operations should be done.
                if (eventType != __NO_NEED_TO_FIRE_EVENT) {
                    recordStore.put(new AbstractMap.SimpleImmutableEntry<Data, Object>(key, valueAfterProcess));
                }
            }

            if (eventType != __NO_NEED_TO_FIRE_EVENT) {
                final Data oldValue = mapService.toData(valueBeforeProcess);
                final Data value = mapService.toData(valueAfterProcess);
                mapService.publishEvent(getCallerAddress(), name, eventType, key, oldValue, value);
                if (mapService.isNearCacheAndInvalidationEnabled(name)) {
                    mapService.invalidateAllNearCaches(name, key);
                }
                if (mapContainer.getWanReplicationPublisher() != null && mapContainer.getWanMergePolicy() != null) {
                    if (EntryEventType.REMOVED.equals(eventType)) {
                        mapService.publishWanReplicationRemove(name, key, Clock.currentTimeMillis());
                    } else {
                        Record record = recordStore.getRecord(key);
                        Data tempValue = mapService.toData(dataValue);
                        final SimpleEntryView entryView = mapService.createSimpleEntryView(key, tempValue, record);
                        mapService.publishWanReplicationUpdate(name, entryView);
                    }
                }
            }
View Full Code Here

        super.readInternal(in);
        entryProcessor = in.readObject();
        int size = in.readInt();
        keys = new HashSet<Data>(size);
        for (int i = 0; i < size; i++) {
            Data key = new Data();
            key.readData(in);
            keys.add(key);
        }

    }
View Full Code Here

    void sendBindRequest(final TcpIpConnection connection, final Address remoteEndPoint, final boolean replyBack) {
        connection.setEndPoint(remoteEndPoint);
        //make sure bind packet is the first packet sent to the end point.
        final BindOperation bind = new BindOperation(ioService.getThisAddress(), remoteEndPoint, replyBack);
        final Data bindData = ioService.toData(bind);
        final Packet packet = new Packet(bindData, serializationContext);
        packet.setHeader(Packet.HEADER_OP);
        connection.write(packet);
        //now you can send anything...
    }
View Full Code Here

TOP

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

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.