Package com.hazelcast.map

Examples of com.hazelcast.map.MapService.toObject()


        if (k == null) {
            throw new NullPointerException(NULL_KEY_IS_NOT_ALLOWED);
        }
        MapService service = getService();
        Data key = service.toData(k, partitionStrategy);
        return (V) service.toObject(getInternal(key));
    }

    @Override
    public V put(final K k, final V v) {
        return put(k, v, -1, null);
View Full Code Here


        }
        MapService service = getService();
        final Data key = service.toData(k, partitionStrategy);
        final Data value = service.toData(v);
        final Data result = putInternal(key, value, ttl, timeunit);
        return (V) service.toObject(result);
    }

    @Override
    public boolean tryPut(final K k, final V v, final long timeout, final TimeUnit timeunit) {
        if (k == null) {
View Full Code Here

        } else {
            Data oldValue = putIfAbsentInternal(service.toData(key, partitionStrategy), service.toData(value));
            if (oldValue == null) {
                txMap.put(key, new TxnValueWrapper(value, TxnValueWrapper.Type.NEW));
            }
            return service.toObject(oldValue);
        }
    }

    public Object replace(Object key, Object value) {
        checkTransactionState();
View Full Code Here

        }
        MapService service = getService();
        final Data key = service.toData(k, partitionStrategy);
        final Data value = service.toData(v);
        final Data result = putIfAbsentInternal(key, value, ttl, timeunit);
        return (V) service.toObject(result);
    }

    @Override
    public void putTransient(final K k, final V v, final long ttl, final TimeUnit timeunit) {
        if (k == null) {
View Full Code Here

        } else {
            Data oldValue = replaceInternal(service.toData(key, partitionStrategy), service.toData(value));
            if (oldValue != null) {
                txMap.put(key, new TxnValueWrapper(value, TxnValueWrapper.Type.UPDATED));
            }
            return service.toObject(oldValue);
        }
    }

    public boolean replace(Object key, Object oldValue, Object newValue) {
        checkTransactionState();
View Full Code Here

            throw new NullPointerException(NULL_VALUE_IS_NOT_ALLOWED);
        }
        MapService service = getService();
        final Data key = service.toData(k, partitionStrategy);
        final Data value = service.toData(v);
        return (V) service.toObject(replaceInternal(key, value));
    }

    @Override
    public void set(K key, V value) {
        set(key, value, -1, TimeUnit.MILLISECONDS);
View Full Code Here

            throw new NullPointerException(NULL_KEY_IS_NOT_ALLOWED);
        }
        MapService service = getService();
        final Data key = service.toData(k, partitionStrategy);
        final Data result = removeInternal(key);
        return (V) service.toObject(result);
    }

    @Override
    public boolean remove(final Object k, final Object v) {
        if (k == null) {
View Full Code Here

    }

    public Object remove(Object key) {
        checkTransactionState();
        MapService service = getService();
        final Object valueBeforeTxn = service.toObject(removeInternal(service.toData(key, partitionStrategy)));
        TxnValueWrapper wrapper = null;
        if (valueBeforeTxn != null || txMap.containsKey(key)) {
            wrapper = txMap.put(key, new TxnValueWrapper(valueBeforeTxn, TxnValueWrapper.Type.REMOVED));
        }
        return wrapper == null ? valueBeforeTxn : checkIfRemoved(wrapper);
View Full Code Here

    public void delete(Object key) {
        checkTransactionState();
        MapService service = getService();
        Data data = removeInternal(service.toData(key, partitionStrategy));
        if (data != null || txMap.containsKey(key)) {
            txMap.put(key, new TxnValueWrapper(service.toObject(data), TxnValueWrapper.Type.REMOVED));
        }
    }

    public Set<Object> keySet() {
        checkTransactionState();
View Full Code Here

        final Set<Data> keySet = keySetInternal();
        final Set<Object> keys = new HashSet<Object>(keySet.size());
        final MapService service = getService();
        // convert Data to Object
        for (final Data data : keySet) {
            keys.add(service.toObject(data));
        }

        for (final Map.Entry<Object, TxnValueWrapper> entry : txMap.entrySet()) {
            if (TxnValueWrapper.Type.NEW.equals(entry.getValue().type)) {
                keys.add(entry.getKey());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.