本文整理汇总了C#中Alachisoft类的典型用法代码示例。如果您正苦于以下问题:C# Alachisoft类的具体用法?C# Alachisoft怎么用?C# Alachisoft使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Alachisoft类属于命名空间,在下文中一共展示了Alachisoft类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteCommand
public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.Command command)
{
///Command:
/// GETLOGGINGINFO "requestId"
///
string requestId = string.Empty;
Alachisoft.NCache.Common.Protobuf.GetLoggingInfoCommand getLoggingInfoCommand = command.getLoggingInfoCommand;
requestId = getLoggingInfoCommand.requestId.ToString();
bool errorEnabled = ConnectionManager.GetClientLoggingInfo(LoggingInfo.LoggingType.Error) == LoggingInfo.LogsStatus.Enable;
bool detailedEnabled = ConnectionManager.GetClientLoggingInfo(LoggingInfo.LoggingType.Detailed) == LoggingInfo.LogsStatus.Enable;
if (!errorEnabled)
detailedEnabled = false;
try
{
Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response();
Alachisoft.NCache.Common.Protobuf.GetLoggingInfoResponse loggingInfoResponse = new Alachisoft.NCache.Common.Protobuf.GetLoggingInfoResponse();
response.requestId = command.requestID;
loggingInfoResponse.errorsEnabled = errorEnabled;
loggingInfoResponse.detailedErrorsEnabled = detailedEnabled;
response.getLoggingInfoResponse = loggingInfoResponse;
response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.GET_LOGGING_INFO;
_serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response));
}
catch (Exception exc)
{
_serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID));
}
}
示例2: ExecuteCommandOnCacehServer
protected object ExecuteCommandOnCacehServer(Alachisoft.NCache.Common.Protobuf.ManagementCommand command)
{
ManagementResponse response = null;
if (_requestManager != null)
{
try
{
response = _requestManager.SendRequest(command) as ManagementResponse;
}
catch (System.Exception e)
{
throw new ManagementException(e.Message,e);
}
if (response != null && response.exception != null)
{
throw new ManagementException(response.exception.message);
}
}
if (response != null)
return response.ReturnValue;
return null;
}
示例3: ExecuteCommand
public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.Command command)
{
CommandInfo cmdInfo;
try
{
cmdInfo = ParseCommand(command, clientManager);
if (ServerMonitor.MonitorActivity) ServerMonitor.LogClientActivity("RemCmd.Exec", "cmd parsed");
}
catch (Exception exc)
{
_removeResult = OperationResult.Failure;
if (!base.immatureId.Equals("-2"))
{
//PROTOBUF:RESPONSE
_serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID));
}
return;
}
NCache nCache = clientManager.CmdExecuter as NCache;
try
{
CallbackEntry cbEntry = null;
CompressedValueEntry flagValueEntry = null;
OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation);
flagValueEntry = nCache.Cache.Remove(cmdInfo.Key, cmdInfo.FlagMap, cbEntry, cmdInfo.LockId, cmdInfo.LockAccessType, operationContext);
UserBinaryObject ubObject = (flagValueEntry == null) ? null : (UserBinaryObject) flagValueEntry.Value;
//PROTOBUF:RESPONSE
Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response();
Alachisoft.NCache.Common.Protobuf.RemoveResponse removeResponse =
new Alachisoft.NCache.Common.Protobuf.RemoveResponse();
response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.REMOVE;
response.remove = removeResponse;
response.requestId = Convert.ToInt64(cmdInfo.RequestId);
if (ubObject != null)
{
removeResponse.value.AddRange(ubObject.DataList);
removeResponse.flag = flagValueEntry.Flag.Data;
}
_serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response));
}
catch (Exception exc)
{
_removeResult = OperationResult.Failure;
//PROTOBUF:RESPONSE
_serializedResponsePackets.Add(
Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID));
}
finally
{
if (ServerMonitor.MonitorActivity)
ServerMonitor.LogClientActivity("RemCmd.Exec", "cmd executed on cache");
}
}
示例4: Convert
public Alachisoft.ContentOptimization.Caching.Expiration Convert(Alachisoft.ContentOptimization.Caching.ExpirationType type)
{
var expiration = new Alachisoft.ContentOptimization.Caching.Expiration();
expiration.ExpirationType = type;
expiration.Duration = this.Duration.HasValue ? this.Duration.Value : 5;
return expiration;
}
示例5: ExecuteCommand
//PROTOBUF
public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.ManagementCommand command)
{
object result = null;
try
{
if (command.objectName == ManagementUtil.ManagementObjectName.CacheServer)
{
result = CacheProvider.ManagementRpcService.InvokeMethodOnTarget(command.methodName,
command.overload,
GetTargetMethodParameters(command.arguments));
}
Alachisoft.NCache.Common.Protobuf.ManagementResponse response = new Alachisoft.NCache.Common.Protobuf.ManagementResponse();
response.methodName = command.methodName;
response.version = command.commandVersion;
response.requestId = command.requestId;
response.returnVal = SerializeResponse(result);
_serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response));
}
catch (Exception exc)
{
_serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeManagementExceptionResponse(exc, Convert.ToInt32(command.requestId)));
}
}
示例6: ExecuteCommand
//PROTOBUF
public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.Command command)
{
CommandInfo cmdInfo;
try
{
cmdInfo = ParseCommand(command, clientManager);
}
catch (ArgumentOutOfRangeException arEx)
{
if (SocketServer.Logger.IsErrorLogsEnabled) SocketServer.Logger.NCacheLog.Error( "LockCommand", "command: " + command + " Error" + arEx);
_lockResult = OperationResult.Failure;
if (!base.immatureId.Equals("-2"))
{
//PROTOBUF:RESPONSE
_serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(arEx, command.requestID));
}
return;
}
catch (Exception exc)
{
_lockResult = OperationResult.Failure;
if (!base.immatureId.Equals("-2"))
{
//PROTOBUF:RESPONSE
_serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID));
}
return;
}
try
{
NCache nCache = clientManager.CmdExecuter as NCache;
object lockId = null;
DateTime lockDate = DateTime.Now;
bool res = nCache.Cache.Lock(cmdInfo.Key, cmdInfo.LockTimeout, out lockId, out lockDate, new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation));
//PROTOBUF:RESPONSE
Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response();
Alachisoft.NCache.Common.Protobuf.VerifyLockResponse verifyLockResponse = new Alachisoft.NCache.Common.Protobuf.VerifyLockResponse();
response.requestId = Convert.ToInt64(cmdInfo.RequestId);
response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.LOCK_VERIFY;
response.lockVerify = verifyLockResponse;
verifyLockResponse.lockId = lockId.ToString();
verifyLockResponse.success = res;
verifyLockResponse.lockExpiration = lockDate.Ticks;
_serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response));
}
catch (Exception exc)
{
_lockResult = OperationResult.Failure;
//PROTOBUF:RESPONSE
_serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID));
}
}
示例7: ExecuteCommand
//PROTOBUF
public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.Command command)
{
CommandInfo cmdInfo;
try
{
cmdInfo = ParseCommand(command, clientManager);
if (ServerMonitor.MonitorActivity) ServerMonitor.LogClientActivity("UnlockCmd.Exec", "cmd parsed");
}
catch (ArgumentOutOfRangeException arEx)
{
if (SocketServer.Logger.IsErrorLogsEnabled) SocketServer.Logger.NCacheLog.Error("UnlockCommand", "command: " + command + " Error" + arEx);
_unlockResult = OperationResult.Failure;
if (!base.immatureId.Equals("-2"))
{
//PROTOBUF:RESPONSE
_serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(arEx, command.requestID));
}
return;
}
catch (Exception exc)
{
_unlockResult = OperationResult.Failure;
if (!base.immatureId.Equals("-2"))
{
//PROTOBUF:RESPONSE
_serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID));
}
return;
}
try
{
NCache nCache = clientManager.CmdExecuter as NCache;
nCache.Cache.Unlock(cmdInfo.Key, cmdInfo.lockId, cmdInfo.isPreemptive, new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation));
//PROTOBUF:RESPONSE
Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response();
Alachisoft.NCache.Common.Protobuf.UnlockResponse unlockResponse = new Alachisoft.NCache.Common.Protobuf.UnlockResponse();
response.requestId = Convert.ToInt64(cmdInfo.RequestId);
response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.UNLOCK;
response.unlockResponse = unlockResponse;
_serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response));
}
catch (Exception exc)
{
_unlockResult = OperationResult.Failure;
_serializedResponsePackets.Add(clientManager.ReplyPacket(base.ExceptionPacket(exc, cmdInfo.RequestId), base.ExceptionMessage(exc)));
}
finally
{
if (ServerMonitor.MonitorActivity) ServerMonitor.LogClientActivity("UnlockCmd.Exec", "cmd executed on cache");
}
}
示例8: ConvertToProtobufEnumerationPointer
public static Alachisoft.NCache.Common.Protobuf.EnumerationPointer ConvertToProtobufEnumerationPointer(Alachisoft.NCache.Common.DataStructures.EnumerationPointer pointer)
{
Alachisoft.NCache.Common.Protobuf.EnumerationPointer enumerationPointer = new Alachisoft.NCache.Common.Protobuf.EnumerationPointer();
enumerationPointer.chunkId = pointer.ChunkId;
enumerationPointer.id = pointer.Id;
enumerationPointer.isDisposed = pointer.isDisposable;
return enumerationPointer;
}
示例9: ExecuteCommand
//PROTOBUF
public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.Command command)
{
CommandInfo cmdInfo;
try
{
cmdInfo = ParseCommand(command, clientManager);
}
catch (Exception exc)
{
if (!base.immatureId.Equals("-2"))
//_resultPacket = clientManager.ReplyPacket(base.ExceptionPacket(exc, base.immatureId), base.ParsingExceptionMessage(exc));
_serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID));
return;
}
try
{
//Fetch mapped servers
ServerMapping serverMapping = Management.MappingConfiguration.MappingConfigurationManager.GetMappingConfiguration().ClientIPMapping;
Mapping[] mappedServers = serverMapping.MappingServers;
Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response();
Alachisoft.NCache.Common.Protobuf.GetServerMappingResponse getServerMappingResponse = new Alachisoft.NCache.Common.Protobuf.GetServerMappingResponse();
if (mappedServers != null)
{
for (int i = 0; i < mappedServers.Length; i++)
{
Common.Protobuf.ServerMapping mappingObject = new Common.Protobuf.ServerMapping();
//Map the server list to protobuf object
mappingObject.privateIp = mappedServers[i].PrivateIP;
mappingObject.privatePort = mappedServers[i].PrivatePort;
mappingObject.publicIp = mappedServers[i].PublicIP;
mappingObject.publicPort = mappedServers[i].PublicPort;
//Adding to list to be sent as a response
getServerMappingResponse.serverMapping.Add(mappingObject);
}
}
else
SocketServer.Logger.NCacheLog.Error("Server Mapping is null");
response.getServerMappingResponse = getServerMappingResponse;
response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.GET_SERVER_MAPPING;
response.requestId = command.requestID;
_serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response));
}
catch (Exception exc)
{
//_resultPacket = clientManager.ReplyPacket(base.ExceptionPacket(exc, cmdInfo.RequestId), base.ExceptionMessage(exc));
_serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID));
}
}
示例10: NagglingManager
internal NagglingManager(Connection parent, Socket workingSocket, Alachisoft.NCache.Common.DataStructures.Queue msgQueue, long nagglingSize, object syncLock)
{
_parent = parent;
_workingSocket = workingSocket;
_nagglingSize = nagglingSize;
_msgQueue = msgQueue;
_sendBuffer = new byte[_sendBufferSize];
_syncLock = syncLock;
}
示例11: UpHandler
public UpHandler(Alachisoft.NCache.Common.DataStructures.Queue mq, Protocol handler, string name, int id)
{
this.mq = mq;
this.handler = handler;
if(name != null)
Name = name;
IsBackground = true;
this.id = id;
}
示例12: ExecuteCommand
public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.Command command)
{
CommandInfo cmdInfo;
ClientId = clientManager.ClientID; //Asif Imam
NCache nCache = clientManager.CmdExecuter as NCache;
try
{
serailizationContext = nCache.CacheId;
cmdInfo = base.ParseCommand(command, clientManager, serailizationContext);
if (ServerMonitor.MonitorActivity) ServerMonitor.LogClientActivity("BulkInsCmd.Exec", "cmd parsed");
}
catch (Exception exc)
{
_insertBulkResult = OperationResult.Failure;
//if (!base.immatureId.Equals("-2"))
{
//PROTOBUF:RESPONSE
_serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID));
}
return;
}
//TODO
byte[] dataPackage = null;
try
{
OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation);
operationContext.Add(OperationContextFieldName.ClientLastViewId, cmdInfo.ClientLastViewId);
if (!string.IsNullOrEmpty(cmdInfo.IntendedRecipient))
operationContext.Add(OperationContextFieldName.IntendedRecipient, cmdInfo.IntendedRecipient);
Hashtable insertResult = (Hashtable)nCache.Cache.Insert(cmdInfo.Keys, cmdInfo.Values, cmdInfo.CallbackEnteries, cmdInfo.ExpirationHint, cmdInfo.EvictionHint, cmdInfo.QueryInfo, cmdInfo.Flags, operationContext);
Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response();
Alachisoft.NCache.Common.Protobuf.BulkInsertResponse bulkInsertResponse = new Alachisoft.NCache.Common.Protobuf.BulkInsertResponse();
response.requestId = Convert.ToInt64(cmdInfo.RequestId);
response.intendedRecipient = cmdInfo.IntendedRecipient;
bulkInsertResponse.keyExceptionPackage = new Alachisoft.NCache.Common.Protobuf.KeyExceptionPackageResponse();
//TODO : Package Key Value
Alachisoft.NCache.SocketServer.Util.KeyPackageBuilder.PackageKeysExceptions(insertResult, bulkInsertResponse.keyExceptionPackage);
response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.INSERT_BULK;
response.bulkInsert = bulkInsertResponse;
_serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response));
}
catch (Exception exc)
{
_insertBulkResult = OperationResult.Failure;
//PROTOBUF:RESPONSE
_serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID));
}
if (ServerMonitor.MonitorActivity) ServerMonitor.LogClientActivity("BulkInsCmd.Exec", "cmd executed on cache");
}
示例13: ExecuteCommand
//PROTOBUF
public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.Command command)
{
CommandInfo cmdInfo;
try
{
cmdInfo = ParseCommand(command, clientManager);
}
catch (Exception exc)
{
if (!base.immatureId.Equals("-2"))
_serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID));
return;
}
try
{
NCache nCache = clientManager.CmdExecuter as NCache;
int bucketSize = 0;
NewHashmap hashmap = nCache.Cache.GetOwnerHashMap(out bucketSize);
byte[] buffer = new byte[0];
//TODO:Incomplete conversion
Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response();
Alachisoft.NCache.Common.Protobuf.GetHashmapResponse getHashmapResponse = new Alachisoft.NCache.Common.Protobuf.GetHashmapResponse();
response.getHashmap = getHashmapResponse;
response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.GET_HASHMAP;
response.requestId = command.requestID;
if (hashmap != null)
{
getHashmapResponse.viewId = hashmap.LastViewId;
getHashmapResponse.bucketSize = bucketSize;
foreach (string member in hashmap.Members)
{
getHashmapResponse.members.Add(member);
}
foreach (DictionaryEntry entry in hashmap.Map)
{
Alachisoft.NCache.Common.Protobuf.KeyValuePair keyValue =
new Alachisoft.NCache.Common.Protobuf.KeyValuePair();
keyValue.key = entry.Key.ToString();
keyValue.value = entry.Value.ToString();
getHashmapResponse.keyValuePair.Add(keyValue);
}
}
_serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response));
}
catch (Exception exc)
{
_serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID));
}
}
示例14: ExecuteCommand
//PROTOBUF
public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.Command command)
{
CommandInfo cmdInfo;
try
{
cmdInfo = ParseCommand(command, clientManager);
}
catch (Exception exc)
{
if (!base.immatureId.Equals("-2"))
{
//PROTOBUF:RESPONSE
_serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID));
}
return;
}
try
{
CallbackInfo cbUpdate = null;
CallbackInfo cbRemove = null;
if(cmdInfo.dataFilter != -1) //Default value in protbuf set to -1
{
EventDataFilter datafilter = (EventDataFilter)cmdInfo.dataFilter;
cbUpdate = new CallbackInfo(clientManager.ClientID, cmdInfo.UpdateCallbackId, datafilter);
cbRemove = new CallbackInfo(clientManager.ClientID, cmdInfo.RemoveCallbackId, datafilter, cmdInfo.NotifyOnExpiration);
}
else
{
cbUpdate = new CallbackInfo(clientManager.ClientID, cmdInfo.UpdateCallbackId, EventDataFilter.None);
cbRemove = new CallbackInfo(clientManager.ClientID, cmdInfo.RemoveCallbackId,EventDataFilter.DataWithMetadata, cmdInfo.NotifyOnExpiration);
}
NCache nCache = clientManager.CmdExecuter as NCache;
nCache.Cache.RegisterKeyNotificationCallback(cmdInfo.Key, cbUpdate, cbRemove
, new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation));
//PROTOBUF:RESPONSE
Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response();
Alachisoft.NCache.Common.Protobuf.RegisterKeyNotifResponse registerKeyNotifResponse = new Alachisoft.NCache.Common.Protobuf.RegisterKeyNotifResponse();
response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.REGISTER_KEY_NOTIF;
response.registerKeyNotifResponse = registerKeyNotifResponse;
response.requestId = command.registerKeyNotifCommand.requestId;
_serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response));
}
catch (Exception exc)
{
//PROTOBUF:RESPONSE
_serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID));
}
}
示例15: ParseCommand
//PROTOBUF
private CommandInfo ParseCommand(Alachisoft.NCache.Common.Protobuf.Command command, ClientManager clientManager)
{
CommandInfo cmdInfo = new CommandInfo();
Alachisoft.NCache.Common.Protobuf.ClearCommand clearCommand= command.clearCommand;
cmdInfo.FlagMap = new BitSet((byte)clearCommand.flag);
cmdInfo.RequestId = clearCommand.requestId.ToString();
return cmdInfo;
}