All Downloads are FREE. Search and download functionalities are using the official Maven repository.

Alachisoft.NCache.Common.DataStructures.StateTransferInfo Maven / Gradle / Ivy

There is a newer version: 5.3.3
Show newest version
package Alachisoft.NCache.Common.DataStructures;


import com.alachisoft.ncache.serialization.core.io.ICompactSerializable;
import com.alachisoft.ncache.serialization.core.io.NCacheObjectInput;
import com.alachisoft.ncache.serialization.core.io.NCacheObjectOutput;

import java.io.IOException;

/**
 * Represents the actual status of the state transfer.
 */
public class StateTransferInfo implements ICompactSerializable {
    private StateTransferStatus _stateTransferStatus = StateTransferStatus.NO_NEED_FOR_STATE_TRANSFER; //Changed the default status to No NEED for state transfer becoz only coordinator source cache will do state transfer
    private java.util.ArrayList _keyList;
    private Object _syncRoot = new Object();

    /**
     * Gets/sets the status of the state transfer.
     */
    public final StateTransferStatus getStatus() {
        return _stateTransferStatus;
    }

    public final void setStatus(StateTransferStatus value) {
        _stateTransferStatus = value;
    }

    /**
     * Gets the synchronization object.
     */
    public final Object getSyncRoot() {
        return _syncRoot;
    }

    /**
     * Gets the list of keys for the items which are not transfered yet.
     */
    public final java.util.ArrayList getTransferableKeys() {
        return _keyList;
    }

    public final void setTransferableKeys(java.util.ArrayList value) {
        _keyList = value;
    }

    public final void deserialize(NCacheObjectInput reader) throws IOException, ClassNotFoundException {
        _stateTransferStatus = StateTransferStatus.forValue(reader.readByte());
        Object tempVar = reader.readObject();
        _keyList = (java.util.ArrayList) ((tempVar instanceof java.util.ArrayList) ? tempVar : null);
        _syncRoot = new Object();
    }

    public final void serialize(NCacheObjectOutput writer) throws IOException {
        writer.write(_stateTransferStatus.getValue());
        writer.writeObject(_keyList);
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy