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

Alachisoft.NCache.Common.Mirroring.CacheNode Maven / Gradle / Ivy

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

import java.io.Serializable;

/**
 * ***********************************************************************
 * Author: Hasan Khan Date created: 17-04-2008
 * 

* Modified By: Arif Iftikhar, Hasan Khan Last modified by: Arif Iftikhar Date modified: 06-05-2008 * /************************************************************************ */ /** * It serves as a node in the logical linked list of cache nodes in which each node's mirror is maintained on the next node in the list. * * Note: Mirror of a node is knows as backup (next node in the list). */ /* * Mansoor: In java we dont have Iserializable interface that provides Serialization Info and StreamingContext. We only have Externalizable Inteface to control reading and writing * of Objects * */ public class CacheNode implements Cloneable, Serializable //Basit: Implemented Serializable instead of commenting the whole class, let Java handle serialization { ////, ISerializable, Serializable { private static int sequenceSeed = 1; private String nodeId; private String backupNodeId; private String prevNodeId; private int mySequence; private CacheNode() { } public CacheNode(String nodeId, int sequence) { this.nodeId = nodeId; this.mySequence = sequence; } // protected CacheNode(SerializationInfo info, StreamingContext context) // { // nodeId = info.GetString("nodeId"); // backupNodeId = info.GetString("backupNodeId"); // prevNodeId = info.GetString("prevNodeId"); // mySequence = info.GetInt32("mySequence"); // } public final int getSequence() { return mySequence; } public final String getNodeId() { return nodeId; } public final String getBackupNodeId() { return backupNodeId; } public final void setBackupNodeId(String value) { backupNodeId = value; } public final String getPreviousNodeId() { return prevNodeId; } public final void setPreviousNodeId(String value) { prevNodeId = value; } @Override public String toString() { return String.format("Node: %1$s, Backup: %2$s", nodeId, backupNodeId); } //C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: ///#region ICloneable Members public final Object clone() { CacheNode clone = new CacheNode(); clone.nodeId = getNodeId(); clone.setPreviousNodeId(getPreviousNodeId()); clone.setBackupNodeId(getBackupNodeId()); clone.mySequence = getSequence(); return clone; } //C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: ///#endregion //C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: ///#region ISerializable Members //C# TO JAVA CONVERTER TODO TASK: Java annotations will not correspond to .NET attributes: //[SecurityPermissionAttribute(SecurityAction.Demand, SerializationFormatter =true)] // public final void GetObjectData(SerializationInfo info, StreamingContext context) // { // info.AddValue("nodeId", nodeId); // info.AddValue("backupNodeId", backupNodeId); // info.AddValue("prevNodeId", prevNodeId); // info.AddValue("mySequence", mySequence); // } //C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: ///#endregion }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy