private void incCtr(NamedInterlocked counter, string table) { if (!m_InstrumentationEnabled) { return; } counter.IncrementLong(Datum.UNSPECIFIED_SOURCE); if (table != null) { counter.IncrementLong(table); } }
/// <summary> /// Routes todos to appropriate queue and enqueues for processing /// </summary> public int Enqueue(TodoFrame[] todos) { CheckDaemonActive(); if (todos == null || todos.Length == 0) { return(FULL_BATCH_SIZE); } TodoQueueAttribute attr = null; foreach (var todo in todos) { if (!todo.Assigned) { continue; } var todoAttr = GuidTypeAttribute.GetGuidTypeAttribute <Todo, TodoQueueAttribute>(todo.Type, App.AsSky().ProcessManager.TodoTypeResolver); if (attr == null) { attr = todoAttr; } if (attr.QueueName != todoAttr.QueueName) { throw new WorkersException(StringConsts.TODO_QUEUE_ENQUEUE_DIFFERENT_ERROR); } } var queue = m_Queues[attr.QueueName]; if (queue == null) { throw new WorkersException(StringConsts.TODO_QUEUE_NOT_FOUND_ERROR.Args(attr.QueueName)); } if (InstrumentationEnabled) { Interlocked.Increment(ref m_stat_EnqueueCalls); m_stat_EnqueueTodoCount.IncrementLong(ALL); m_stat_EnqueueTodoCount.IncrementLong(queue.Name); } enqueue(queue, todos); return(m_QueueStore.GetInboundCapacity(queue)); }
public LockTransactionResult ExecuteLockTransaction(LockSession session, LockTransaction transaction) { if (!Running) { return(LockTransactionResult.CallFailed); } if (session == null || transaction == null) { throw new LockingException(StringConsts.ARGUMENT_ERROR + GetType().Name + ".ExecuteLockTransaction(session|tran==null)"); } checkSessionExists(session); if (m_InstrumentationEnabled) { m_Stats.IncrementLong(session.Path); } return(DoExecuteLockTransaction(session, transaction)); }
public LockTransactionResult ExecuteLockTransaction(LockSessionData session, LockTransaction transaction) { var result = executeLockTransaction(session, transaction); if (m_InstrumentationEnabled) { var key = result.Status == LockStatus.TransactionOK ? "OK" //for speed not to concat strings : result.Status.ToString() + ':' + result.ErrorCause.ToString(); m_stat_ExecuteTranCalls.IncrementLong(key); } return(result); }
public static bool ResolveNamedVar(IApplication app, string name, out string value) { app.NonNull(nameof(app)); value = ""; if (name.IsNullOrWhiteSpace()) { return(false); } if (name.EqualsOrdIgnoreCase(HOST)) { value = Azos.Platform.Computer.HostName; return(true); } if (name.EqualsOrdIgnoreCase(FID)) { value = Azos.FID.Generate().ToString(); return(true); } if (name.EqualsOrdIgnoreCase(FIDX)) { value = Azos.FID.Generate().ID.ToString("X8"); return(true); } if (name.EqualsOrdIgnoreCase(INSTANCE)) { value = app.InstanceId.ToString("D");// 00000000 - 0000 - 0000 - 0000 - 000000000000 return(true); } if (name.EqualsOrdIgnoreCase(INSTANCEX)) { value = app.InstanceId.ToString("N");// 00000000000000000000000000000000 return(true); } if (name.EqualsOrdIgnoreCase(nameof(IApplication.StartTime))) { value = app.StartTime.ToString(); return(true); } if (name.StartsWith(COUNTER_PREFIX)) { var cname = name.Substring(COUNTER_PREFIX.Length).Trim(); if (cname.IsNullOrWhiteSpace()) { return(false); } value = s_Counters.IncrementLong(cname).ToString(); return(true); } if (name.StartsWith(CORE_CONSTS_PREFIX)) { var sname = name.Substring(CORE_CONSTS_PREFIX.Length).Trim(); if (sname.IsNullOrWhiteSpace()) { return(false); } var tp = typeof(CoreConsts); var fld = tp.GetField(sname, BindingFlags.Public | BindingFlags.IgnoreCase | BindingFlags.Static); if (fld != null) { var val = fld.GetValue(null); if (val != null) { value = val.ToString(); return(true); } } } return(false); }