本文整理汇总了C#中Alachisoft.NCache.Common.Net.Address类的典型用法代码示例。如果您正苦于以下问题:C# Address类的具体用法?C# Address怎么用?C# Address使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Address类属于Alachisoft.NCache.Common.Net命名空间,在下文中一共展示了Address类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: leave
/// <summary> Loop: determine coord. If coord is me --> handleLeave().
/// Else send handleLeave() to coord until success
/// </summary>
public override void leave(Address mbr)
{
Address coord;
int max_tries = 3;
object result;
leave_promise.Reset();
if (mbr.Equals(gms.local_addr))
leaving = true;
while ((coord = gms.determineCoordinator()) != null && max_tries-- > 0)
{
if (gms.local_addr.Equals(coord))
{
// I'm the coordinator
gms.becomeCoordinator();
gms.Impl.handleLeave(mbr, false); // regular leave
return ;
}
gms.Stack.NCacheLog.Debug("sending LEAVE request to " + coord);
sendLeaveMessage(coord, mbr);
lock (leave_promise)
{
result = leave_promise.WaitResult(gms.leave_timeout);
if (result != null)
break;
}
}
gms.becomeClient();
}
开发者ID:javithalion,项目名称:NCache,代码行数:36,代码来源:ParticipantGmsImpl.cs
示例2: OnMemberJoined
internal void OnMemberJoined(Address address)
{
if (!_activeClusterMbrs.Contains(address.IpAddress))
{
_activeClusterMbrs.Add(address.IpAddress);
}
}
开发者ID:javithalion,项目名称:NCache,代码行数:7,代码来源:ClientsManager.cs
示例3: BucketTxfrInfo
public BucketTxfrInfo(ArrayList bucketIds, bool isSparsed, Address owner)
{
this.bucketIds = bucketIds;
this.isSparsed = isSparsed;
this.owner = owner;
this.end = false;
}
开发者ID:javithalion,项目名称:NCache,代码行数:7,代码来源:BucketTxfrInfo.cs
示例4: NodeLeftEvent
internal NodeLeftEvent(string cacheId, Address clusterAddress, Address serverAddress, string clientid)
{
_cacheId = cacheId;
_clusterAddress = clusterAddress;
_serverAddress = serverAddress;
_clientId = clientid;
}
开发者ID:javithalion,项目名称:NCache,代码行数:7,代码来源:NodeLeftEvent.cs
示例5: BucketsPack
public BucketsPack(ArrayList buckets, Address owner)
{
if (buckets != null)
_bucketIds = buckets;
_owner = owner;
}
开发者ID:javithalion,项目名称:NCache,代码行数:7,代码来源:BucketsPack.cs
示例6: StateTxfrCorresponder
internal StateTxfrCorresponder(ClusterCacheBase parent, DistributionManager distMgr, Address requestingNode, byte transferType)
{
_parent = parent;
_distMgr = distMgr;
_clientNode = requestingNode;
_transferType = transferType;
}
开发者ID:christrotter,项目名称:NCache,代码行数:7,代码来源:StateTxfrCorresponder.cs
示例7: PartNodeInfo
public PartNodeInfo()
{
_address = new Address();
_subGroupId = "";
_isCoordinator = false;
_priorityIndex = -1;
}
开发者ID:javithalion,项目名称:NCache,代码行数:7,代码来源:PartNodeInfo.cs
示例8: PingRsp
/// <summary>
/// Constructor
/// </summary>
/// <param name="own_addr">Local Address</param>
/// <param name="coord_addr">Coordinator Address</param>
/// <param name="is_server">if the node is a participant of group</param>
public PingRsp(Address own_addr, Address coord_addr, bool is_server,bool started)
{
this.own_addr=own_addr;
this.coord_addr=coord_addr;
this.is_server = is_server;
this.started = started;
}
开发者ID:javithalion,项目名称:NCache,代码行数:14,代码来源:PingRsp.cs
示例9: NodeJoinedEvent
internal NodeJoinedEvent(string cacheId, Address clusterAddress, Address serverAddress, string clientid, bool reconn)
{
_cacheId = cacheId;
_clusterAddress = clusterAddress;
_serverAddress = serverAddress;
_clientId = clientid;
_reconnect = reconn;
}
开发者ID:javithalion,项目名称:NCache,代码行数:8,代码来源:NodeJoinedEvent.cs
示例10: ReAllocBucketsInTransfer
//While a node leaves, all those buckets that were in transfer of buckets to the leaving node, should sieze transfer and would
// clear up tempAdd to be the same as the perm. addr.
private static ArrayList ReAllocBucketsInTransfer(ArrayList hashMap, Address leavingNode)
{
for (int i = 0; i < hashMap.Count; i++)
{
if (((HashMapBucket)hashMap[i]).TempAddress.CompareTo(leavingNode) == 0)
((HashMapBucket)hashMap[i]).TempAddress = ((HashMapBucket)hashMap[i]).PermanentAddress;
}
return hashMap;
}
开发者ID:javithalion,项目名称:NCache,代码行数:11,代码来源:DistributeHashMap.cs
示例11: DistributionInfoData
public DistributionInfoData(DistributionMode distMode, ClusterActivity clustActivity, ManualDistType manDistType, int percentMove, Address source, Address[] dests)
{
_distMode = distMode;
_clustActivity = clustActivity;
_manualDistType = manDistType;
_percentToMove = percentMove;
_source = source;
_destinations = dests;
}
开发者ID:christrotter,项目名称:NCache,代码行数:9,代码来源:DistributionInfoData.cs
示例12: handleIsClusterInStateTransfer
public virtual void handleIsClusterInStateTransfer(Address sender)
{
Message msg = new Message(sender, null, new byte[0]);
GMS.HDR hdr = new GMS.HDR(GMS.HDR.IS_NODE_IN_STATE_TRANSFER_RSP);
gms.Stack.NCacheLog.Debug("gmsImpl.handleIsClusterInStateTransfer", "(state transfer request) sender: " + sender + " ->" + isInStateTransfer);
hdr.arg = isInStateTransfer;
msg.putHeader(HeaderType.GMS,hdr);
gms.passDown(new Event(Event.MSG,msg,Alachisoft.NCache.Common.Enum.Priority.Critical));
}
开发者ID:javithalion,项目名称:NCache,代码行数:9,代码来源:GmsImpl.cs
示例13: leave
/// <summary>The coordinator itself wants to leave the group </summary>
public override void leave(Address mbr)
{
if (mbr == null)
{
gms.Stack.NCacheLog.Error("CoordGmsImpl.leave", "member's address is null !");
return;
}
if (mbr.Equals(gms.local_addr))
leaving = true;
handleLeave(mbr, false); // regular leave
}
开发者ID:javithalion,项目名称:NCache,代码行数:12,代码来源:CoordGmsImpl.cs
示例14: DistributeOrphanBuckets
public static ArrayList DistributeOrphanBuckets(ArrayList hashMap, Address leavingNode, ArrayList members)
{
HashMapBucket tempBuck;
ArrayList orphanBuckets = new ArrayList();
hashMap = ReAllocBucketsInTransfer(hashMap, leavingNode);
int[] bucketsInEachNode = NodeBucketsCount(hashMap, members); //node vs bucket count.
bool bAssigned = false;
int memberCount = members.Count;
if (memberCount == 0)
return null;
int bucketsPerNode = hashMap.Count / members.Count;
for (int i = 0, j = 0; i < hashMap.Count; i++)
{
j = (j == memberCount) ? 0 : j;
tempBuck = (HashMapBucket)hashMap[i];
if (tempBuck.PermanentAddress.CompareTo(leavingNode) == 0)
{
bAssigned = false;
for (int k = 0; k < memberCount; k++)
{
if (bucketsInEachNode[j] < bucketsPerNode)
{
Address mbr = members[j] as Address;
bucketsInEachNode[j] = (bucketsInEachNode[j])++; //increment bucket count as next j is incremented.
tempBuck.PermanentAddress = mbr;
tempBuck.TempAddress = mbr;
tempBuck.Status = BucketStatus.Functional;
j++;
bAssigned = true;
break;
}
else
{
j++;
j = (j == memberCount) ? 0 : j;
}
}
//exceptional case when last node gets few more buckets. Assign those leftover buckets to ANY node.
if (bAssigned == false)
{
tempBuck.PermanentAddress = (Address)members[j++];
}
}
}
return hashMap;
}
开发者ID:javithalion,项目名称:NCache,代码行数:53,代码来源:DistributeHashMap.cs
示例15: addRsp
public void addRsp(Address sender, object retval)
{
Rsp rsp = find(sender);
if (rsp != null)
{
rsp.sender = sender; rsp.retval = retval; rsp.received = true; rsp.suspected = false;
return;
}
rsp = new Rsp(sender, retval);
rsps.Add(rsp);
}
开发者ID:javithalion,项目名称:NCache,代码行数:13,代码来源:RspList.cs
示例16: NodeInfo
/// <summary>
/// Copy constructor
/// </summary>
/// <param name="info"></param>
protected NodeInfo(NodeInfo info)
{
this._address = info._address == null ? null : info._address.Clone() as Address;
this._rendererAddress = info._rendererAddress != null ? info._rendererAddress.Clone() as Address : null;
this._stats = info._stats == null ? null:info._stats.Clone() as CacheStatistics;
this._status = info._status;
this._subgroupName = info._subgroupName;
this._isInproc = info._isInproc;
this._dataAffinity = info._dataAffinity == null ? null : info._dataAffinity.Clone() as DataAffinity;
_isStartedAsMirror = info.IsStartedAsMirror;
if(info._connectedClients != null)
{
lock(info._connectedClients.SyncRoot)
this._connectedClients = info._connectedClients.Clone() as ArrayList;
}
}
开发者ID:javithalion,项目名称:NCache,代码行数:20,代码来源:NodeInfo.cs
示例17: add
public void add(Address sender, long low_seqno, long high_seqno, long high_seqno_seen)
{
if (index >= senders.Length)
{
return ;
}
if (sender == null)
{
return ;
}
senders[index] = sender;
low_seqnos[index] = low_seqno;
high_seqnos[index] = high_seqno;
high_seqnos_seen[index] = high_seqno_seen;
index++;
}
开发者ID:javithalion,项目名称:NCache,代码行数:16,代码来源:Digest.cs
示例18: WaitForStatus
public void WaitForStatus(Address tmpOwner, byte status)
{
if (tmpOwner != null)
{
while (tmpOwner == _tempAddress)
{
if (_stateTxfrLatch.IsAnyBitsSet(status)) return;
lock (_status_wait_mutex)
{
if ((tmpOwner == _tempAddress) || _stateTxfrLatch.IsAnyBitsSet(status))
return;
Monitor.Wait(_status_wait_mutex);
}
}
}
}
开发者ID:javithalion,项目名称:NCache,代码行数:17,代码来源:HashMapBucket.cs
示例19: BalanceDataForNode
long _totalWeight; //total weight of this node.
public BalanceDataForNode(ArrayList weightIdList, Address address, long clusterWeight)
{
_address = address;
_filteredWeightIdList = new ArrayList();
_totalWeight = 1;
foreach (WeightIdPair wiPair in weightIdList)
{
if (wiPair.Address.compare(address) == 0)
{
_filteredWeightIdList.Add(wiPair);
_totalWeight += wiPair.Weight;
}
}
_filteredWeightIdList.Sort();
_itemsCount = _filteredWeightIdList.Count;
_percentData = Convert.ToInt32(((double)_totalWeight / (double)clusterWeight) * 100);
}
开发者ID:javithalion,项目名称:NCache,代码行数:20,代码来源:BalanceDataForNode.cs
示例20: DistributionMatrix
private long _weightBalanceThreshold = 0 ; //at what weight should the node be treated as contributor to incoming nodes.
public DistributionMatrix(ArrayList weightIdList, Address address, DistributionData distData, ILogger NCacheLog)
{
_address = address;
_distData = distData;
_filteredWeightIdList = new ArrayList();
_itemsCount = weightIdList.Count;
_totalWeight = 1;
_weightToSacrifice = 0;
_cushionFactor = 10;
_percentWeightToSacrifice = 0;
_weightBalanceThreshold = Convert.ToInt32((_maxCacheSize * WeightBalanceThresholdPercent) / 100); //10%, threshold at which we feel to balance weight for incoming nodes. its value is percent of MaxCacheSize
if (NCacheLog.IsInfoEnabled) NCacheLog.Error("DistributionMatrix.ctor", "Address->" + address.ToString() + ", DistributionData->" + distData.ToString());
//muds:
//this is the temp code just to put some trace...
int bucketCount = 0;
foreach (WeightIdPair wiPair in weightIdList)
{
if (wiPair.Address.compare(address) == 0)
{
if(NCacheLog.IsInfoEnabled) NCacheLog.Info("DistributionMatrix.ctor", "waitPair" + wiPair.Address.ToString() + ", wiPait->" + wiPair.BucketId);
_filteredWeightIdList.Add(wiPair);
bucketCount++;
}
}
if (NCacheLog.IsInfoEnabled) NCacheLog.Info("DistributionMatrix..ctor", address + " owns " + bucketCount + " buckets");
_filteredWeightIdList.Sort();
if (NCacheLog.IsInfoEnabled) NCacheLog.Info("DistributionMatrix.ctor", "_filterWeightIdList.Count:" + _filteredWeightIdList.Count + ", distData.BucketPerNode: " + distData.BucketsPerNode);
//Current bucket count - bucketss count after division gives buckets count to be sacrificed.
_bucketsToSacrifice = _filteredWeightIdList.Count - distData.BucketsPerNode;
if (_bucketsToSacrifice <= 0)
{
NCacheLog.Error("DistributionMatrix", "Address::" + address.ToString() + " cant sacrifice any bucket. Buckets/Node = " + distData.BucketsPerNode + " My Buckets Count = " + _filteredWeightIdList.Count);
return;
}
int rows = Convert.ToInt32(Math.Ceiling((double)((decimal)_filteredWeightIdList.Count /(decimal)_bucketsToSacrifice)));
int cols = _bucketsToSacrifice;
InitializeMatrix(rows, cols);
}
开发者ID:javithalion,项目名称:NCache,代码行数:42,代码来源:DistributionMatrix.cs
注:本文中的Alachisoft.NCache.Common.Net.Address类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论