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

Alachisoft.NCache.Common.Monitoring.ServerNode Maven / Gradle / Ivy

package Alachisoft.NCache.Common.Monitoring;

import Alachisoft.NCache.Common.Common;
import Alachisoft.NCache.Common.Net.Address;
import com.alachisoft.ncache.serialization.core.io.InternalCompactSerializable;
import com.alachisoft.ncache.serialization.standard.io.CompactReader;
import com.alachisoft.ncache.serialization.standard.io.CompactWriter;

import java.io.IOException;

public class ServerNode extends Node implements Cloneable, InternalCompactSerializable {

    private boolean _isRepica;
    private boolean _inProcInstance;
    private int _clientPort;
    private String _nodeAt;

    public ServerNode() {
    }

    public ServerNode(String name, Address address) {
        super(name, address);
    }

    /**
     * Gets/Sets the identity of the node in case of Partitioned-of-replica.
     *
     * @return
     */
    public final boolean getIsReplica() {
        return _isRepica;
    }

    public final void setIsReplica(boolean value) {
        _isRepica = value;
    }

    /**
     * Gets/Sets the status of the node whether it is running as inproc or outproc.
     *
     * @return
     */
    public final boolean getInProcInstance() {
        return _inProcInstance;
    }

    public final void setInProcInstance(boolean value) {
        _inProcInstance = value;
    }

    /**
     * Gets/Sets the socket server port of this node.
     *
     * @return
     */
    public final int getClientPort() {
        return _clientPort;
    }

    public final void setClientPort(int value) {
        _clientPort = value;
    }

    /**
     * Gets/Sets node ip address where replica residing.
     *
     * @return
     */
    public final String getNodeAt() {
        return _nodeAt;
    }

    public final void setNodeAt(String value) {
        _nodeAt = value;
    }

    //C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
    ///#region ICloneable Members
    @Override
    public final Object clone() {
        ServerNode node = new ServerNode();
        node.setInProcInstance(this.getInProcInstance());
        node.setIsReplica(this.getIsReplica());
        node.setNodeAt(this.getNodeAt());
        node.setName(this.getName());
        node.setAddress(this.getAddress() != null ? (Address) this.getAddress() : null);
        return node;
    }
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
    ///#endregion

    //
    public void Deserialize(CompactReader reader) throws IOException, ClassNotFoundException {
        _isRepica = reader.ReadBoolean();
        _inProcInstance = reader.ReadBoolean();
        _clientPort = reader.ReadInt32();
        _nodeAt = (String) Common.readAs(reader.ReadObject(), String.class);
        super.Deserialize(reader);
    }

    public void Serialize(CompactWriter writer) throws IOException {
        writer.Write(_isRepica);
        writer.Write(_inProcInstance);
        writer.Write(_clientPort);
        writer.WriteObject(_nodeAt);
        super.Serialize(writer);
    }
    //
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy