Package com.hazelcast.cache.impl.client

Source Code of com.hazelcast.cache.impl.client.AbstractCacheAllPartitionsRequest

package com.hazelcast.cache.impl.client;

import com.hazelcast.cache.impl.CacheOperationProvider;
import com.hazelcast.cache.impl.CacheService;
import com.hazelcast.cache.impl.ICacheService;
import com.hazelcast.client.impl.client.AllPartitionsClientRequest;
import com.hazelcast.config.CacheConfig;
import com.hazelcast.nio.serialization.PortableReader;
import com.hazelcast.nio.serialization.PortableWriter;

import java.io.IOException;

/**
* Abstract Cache All Partitions request to handle InMemoryFormat which needed for operation provider
*/
abstract class AbstractCacheAllPartitionsRequest extends AllPartitionsClientRequest {

    protected String name;

    protected AbstractCacheAllPartitionsRequest() {
    }

    protected AbstractCacheAllPartitionsRequest(String name) {
        this.name = name;
    }

    CacheOperationProvider getOperationProvider() {
        ICacheService service = getService();
        CacheConfig cacheConfig = service.getCacheConfig(name);
        return service.getCacheOperationProvider(name, cacheConfig.getInMemoryFormat());
    }

    public void write(PortableWriter writer)
            throws IOException {
        writer.writeUTF("n", name);
    }

    public void read(PortableReader reader)
            throws IOException {
        name = reader.readUTF("n");

    }

    @Override
    public String getDistributedObjectName() {
        return name;
    }

    public String getServiceName() {
        return CacheService.SERVICE_NAME;
    }
}
TOP

Related Classes of com.hazelcast.cache.impl.client.AbstractCacheAllPartitionsRequest

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.