Package com.hazelcast.spi.impl

Examples of com.hazelcast.spi.impl.PortableCollection


    }

    protected Object filter(Object response) {
        if (response instanceof SerializableCollection){
            Collection<Data> coll = ((SerializableCollection) response).getCollection();
            return new PortableCollection(coll);
        }
        return super.filter(response);
    }
View Full Code Here


    }

    protected Object filter(Object response) {
        if (response instanceof SerializableCollection){
             Collection<Data> coll = ((SerializableCollection) response).getCollection();
            return new PortableCollection(coll);
        }
        return super.filter(response);
    }
View Full Code Here

        return result;
    }

    public Collection<V> get(K key) {
        TxnMultiMapGetRequest request = new TxnMultiMapGetRequest(getName(), toData(key));
        final PortableCollection portableCollection = invoke(request);
        final Collection<Data> collection = portableCollection.getCollection();
        Collection<V> coll;
        if (collection instanceof List){
            coll = new ArrayList<V>(collection.size());
        } else {
            coll = new HashSet<V>(collection.size());
View Full Code Here

        return result;
    }

    public Collection<V> remove(Object key) {
        TxnMultiMapRemoveAllRequest request = new TxnMultiMapRemoveAllRequest(getName(), toData(key));
        PortableCollection portableCollection = invoke(request);
        final Collection<Data> collection = portableCollection.getCollection();
        Collection<V> coll;
        if (collection instanceof List){
            coll = new ArrayList<V>(collection.size());
        } else {
            coll = new HashSet<V>(collection.size());
View Full Code Here

            }
            for (MultiMapRecord record: coll){
                list.add(getClientEngine().toData(record.getObject()));
            }
        }
        return new PortableCollection(list);
    }
View Full Code Here

        return drainTo(objects, -1);
    }

    public int drainTo(Collection<? super E> c, int maxElements) {
        DrainRequest request = new DrainRequest(name, maxElements);
        PortableCollection result = invoke(request);
        Collection<Data> coll = result.getCollection();
        for (Data data : coll) {
            E e = (E) getContext().getSerializationService().toObject(data);
            c.add(e);
        }
        return coll.size();
View Full Code Here

        return size() == 0;
    }

    public Iterator<E> iterator() {
        IteratorRequest request = new IteratorRequest(name);
        PortableCollection result = invoke(request);
        Collection<Data> coll = result.getCollection();
        return new QueueIterator<E>(coll.iterator(), getContext().getSerializationService(), false);
    }
View Full Code Here

        return new QueueIterator<E>(coll.iterator(), getContext().getSerializationService(), false);
    }

    public Object[] toArray() {
        IteratorRequest request = new IteratorRequest(name);
        PortableCollection result = invoke(request);
        Collection<Data> coll = result.getCollection();
        int i = 0;
        Object[] array = new Object[coll.size()];
        for (Data data : coll) {
            array[i++] = getContext().getSerializationService().toObject(data);
        }
View Full Code Here

        return array;
    }

    public <T> T[] toArray(T[] ts) {
        IteratorRequest request = new IteratorRequest(name);
        PortableCollection result = invoke(request);
        Collection<Data> coll = result.getCollection();
        int size = coll.size();
        if (ts.length < size) {
            ts = (T[]) java.lang.reflect.Array.newInstance(ts.getClass().getComponentType(), size);
        }
        int i = 0;
View Full Code Here

        Collection<Data> coll = createCollection(objects.size());
        for (Object object : objects) {
            final Data data = toData(object);
            coll.add(data);
        }
        return new PortableCollection(coll);
    }
View Full Code Here

TOP

Related Classes of com.hazelcast.spi.impl.PortableCollection

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.