Package com.hazelcast.core

Examples of com.hazelcast.core.EntryView


    @Override
    public void writeResponse(ManagementCenterService mcs, ObjectDataOutput dos) throws Exception {
        IMap map = mcs.getHazelcastInstance().getMap(mapName);

        EntryView entry = null;
        if (type.equals("string")) {
            entry = map.getEntryView(key);
        } else if (type.equals("long")) {
            entry = map.getEntryView(Long.valueOf(key));
        } else if (type.equals("integer")) {
            entry = map.getEntryView(Integer.valueOf(key));
        }

        TreeMap<String, String> result = new TreeMap<String, String>();

        if (entry == null) {
            result.put("No Value Found!", " ");
        } else {
            Object value = entry.getValue();
            result.put("browse_value", value != null ? value.toString() : "null");
            result.put("browse_class", value != null ? value.getClass().getName() : "null");
            result.put("memory_cost", Long.toString(entry.getCost()));
            result.put("date_creation_time", Long.toString(entry.getCreationTime()));
            result.put("date_expiration_time", Long.toString(entry.getExpirationTime()));
            result.put("browse_hits", Long.toString(entry.getHits()));
            result.put("date_access_time", Long.toString(entry.getLastAccessTime()));
            result.put("date_update_time", Long.toString(entry.getLastUpdateTime()));
            result.put("browse_version", Long.toString(entry.getVersion()));
        }

        dos.writeInt(result.size());

        for (Map.Entry<String,String> propertyEntry : result.entrySet()) {
View Full Code Here


            record = mapService.createRecord(name, dataKey, newValue, DEFAULT_TTL);
            records.put(dataKey, record);
            updateSizeEstimator(calculateRecordSize(record));
        } else {
            Object oldValue = record.getValue();
            EntryView existingEntry = mapService.createLazyEntryView(record.getKey(), record.getValue(),
                    record, serializationService, mergePolicy);
            newValue = mergePolicy.merge(name, mergingEntry, existingEntry);
            if (newValue == null) { // existing entry will be removed
                removeIndex(dataKey);
                mapStoreDelete(record, dataKey);
View Full Code Here

    }

    public long getSizeInMemory() {
        long size = 0;
        for (final Object key : map.keySet()) {
            final EntryView entry = map.getEntryView(key);
            if (entry != null) {
                size += entry.getCost();
            }
        }
        return size;
    }
View Full Code Here

                        = mapServiceContext.getMergePolicyProvider().getMergePolicy(mergePolicyName);
                for (final Record record : recordList) {
                    // todo too many submission. should submit them in subgroups
                    nodeEngine.getExecutionService().submit("hz:map-merge", new Runnable() {
                        public void run() {
                            final EntryView entryView = EntryViews.createSimpleEntryView(record.getKey(),
                                    mapServiceContext.toData(record.getValue()), record);
                            MergeOperation operation = new MergeOperation(mapContainer.getName(),
                                    record.getKey(), entryView, finalMergePolicy);
                            try {
                                int partitionId = nodeEngine.getPartitionService().getPartitionId(record.getKey());
View Full Code Here

            if (EntryEventType.REMOVED.equals(eventType)) {
                mapEventPublisher.publishWanReplicationRemove(mapName, key, Clock.currentTimeMillis());
            } else {
                Record record = recordStore.getRecord(key);
                if (record != null) {
                    final EntryView entryView = EntryViews.createSimpleEntryView(key, dataValue, record);
                    mapEventPublisher.publishWanReplicationUpdate(mapName, entryView);
                }
            }
        }
    }
View Full Code Here

                keysToInvalidate.add(dataKey);
                if (mapContainer.getWanReplicationPublisher() != null && mapContainer.getWanMergePolicy() != null) {
                    Record record = recordStore.getRecord(dataKey);
                    if (record != null) {
                        final Data dataValueAsData = mapServiceContext.toData(dataValue);
                        final EntryView entryView = EntryViews.createSimpleEntryView(dataKey, dataValueAsData, record);
                        mapEventPublisher.publishWanReplicationUpdate(name, entryView);
                    }
                }
                backupEntrySet.add(entry);
                RecordInfo replicationInfo = Records.buildRecordInfo(recordStore.getRecord(dataKey));
View Full Code Here

    @Override
    public void writeResponse(ManagementCenterService mcs, JsonObject root) throws Exception {
        IMap map = mcs.getHazelcastInstance().getMap(mapName);
        JsonObject result = new JsonObject();
        EntryView entry = null;
        if (type.equals("string")) {
            entry = map.getEntryView(key);
        } else if (type.equals("long")) {
            entry = map.getEntryView(Long.valueOf(key));
        } else if (type.equals("integer")) {
            entry = map.getEntryView(Integer.valueOf(key));
        }
        if (entry != null) {
            Object value = entry.getValue();
            result.add("browse_value", value != null ? value.toString() : "null");
            result.add("browse_class", value != null ? value.getClass().getName() : "null");
            result.add("memory_cost", Long.toString(entry.getCost()));
            result.add("date_creation_time", Long.toString(entry.getCreationTime()));
            result.add("date_expiration_time", Long.toString(entry.getExpirationTime()));
            result.add("browse_hits", Long.toString(entry.getHits()));
            result.add("date_access_time", Long.toString(entry.getLastAccessTime()));
            result.add("date_update_time", Long.toString(entry.getLastUpdateTime()));
            result.add("browse_version", Long.toString(entry.getVersion()));
        }
        root.add("result", result);
    }
View Full Code Here

    @Override
    public void onReplicationEvent(WanReplicationEvent replicationEvent) {
        Object eventObject = replicationEvent.getEventObject();
        if (eventObject instanceof MapReplicationUpdate) {
            MapReplicationUpdate replicationUpdate = (MapReplicationUpdate) eventObject;
            EntryView entryView = replicationUpdate.getEntryView();
            MapMergePolicy mergePolicy = replicationUpdate.getMergePolicy();
            String mapName = replicationUpdate.getMapName();
            MapContainer mapContainer = mapServiceContext.getMapContainer(mapName);
            MergeOperation operation = new MergeOperation(mapName, mapServiceContext.toData(entryView.getKey(),
                    mapContainer.getPartitioningStrategy()), entryView, mergePolicy);
            try {
                int partitionId = nodeEngine.getPartitionService().getPartitionId(entryView.getKey());
                Future f = nodeEngine.getOperationService()
                        .invokeOnPartition(mapServiceContext.serviceName(), operation, partitionId);
                f.get();
            } catch (Throwable t) {
                throw ExceptionUtil.rethrow(t);
View Full Code Here

    private void publishWanReplicationEvent(Data key, Data value, Record record) {
        if (record == null) {
            return;
        }
        if (mapContainer.getWanReplicationPublisher() != null && mapContainer.getWanMergePolicy() != null) {
            final EntryView entryView = EntryViews.createSimpleEntryView(key, value, record);
            mapService.getMapServiceContext().getMapEventPublisher().publishWanReplicationUpdate(name, entryView);
        }
    }
View Full Code Here

                mapEventPublisher.publishWanReplicationRemove(mapName, key, Clock.currentTimeMillis());
            } else {
                Record record = recordStore.getRecord(key);
                if (record != null) {
                    Data tempValue = mapServiceContext.toData(dataValue);
                    final EntryView entryView = EntryViews.createSimpleEntryView(key, tempValue, record);
                    mapEventPublisher.publishWanReplicationUpdate(mapName, entryView);
                }
            }
        }
    }
View Full Code Here

TOP

Related Classes of com.hazelcast.core.EntryView

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.