Exemplo n.º 1
0
 internal ListConnectionResult(TrackedNetworkConnection connection, ZoneId timeZone)
 {
     ConnectionId  = connection.Id();
     ConnectTime   = ProceduresTimeFormatHelper.FormatTime(connection.ConnectTime(), timeZone);
     Connector     = connection.Connector();
     Username      = connection.Username();
     UserAgent     = connection.UserAgent();
     ServerAddress = SocketAddress.format(connection.ServerAddress());
     ClientAddress = SocketAddress.format(connection.ClientAddress());
 }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public TransactionStatusResult(org.neo4j.kernel.api.KernelTransactionHandle transaction, TransactionDependenciesResolver transactionDependenciesResolver, java.util.Map<org.neo4j.kernel.api.KernelTransactionHandle,java.util.List<org.neo4j.kernel.api.query.QuerySnapshot>> handleSnapshotsMap, java.time.ZoneId zoneId) throws org.neo4j.kernel.api.exceptions.InvalidArgumentsException
        public TransactionStatusResult(KernelTransactionHandle transaction, TransactionDependenciesResolver transactionDependenciesResolver, IDictionary <KernelTransactionHandle, IList <QuerySnapshot> > handleSnapshotsMap, ZoneId zoneId)
        {
            this.TransactionId = transaction.UserTransactionName;
            this.Username      = transaction.Subject().username();
            this.StartTime     = ProceduresTimeFormatHelper.FormatTime(transaction.StartTime(), zoneId);
            Optional <Status> terminationReason = transaction.TerminationReason();

            this.ActiveLockCount = transaction.ActiveLocks().count();
            IList <QuerySnapshot>         querySnapshots = handleSnapshotsMap[transaction];
            TransactionExecutionStatistic statistic      = transaction.TransactionStatistic();

            ElapsedTimeMillis    = statistic.ElapsedTimeMillis;
            CpuTimeMillis        = statistic.CpuTimeMillis;
            AllocatedBytes       = statistic.HeapAllocatedBytes;
            AllocatedDirectBytes = statistic.DirectAllocatedBytes;
            WaitTimeMillis       = statistic.WaitTimeMillis;
            IdleTimeMillis       = statistic.IdleTimeMillis;
            PageHits             = statistic.PageHits;
            PageFaults           = statistic.PageFaults;

            if (querySnapshots.Count > 0)
            {
                QuerySnapshot        snapshot             = querySnapshots[0];
                ClientConnectionInfo clientConnectionInfo = snapshot.ClientConnection();
                this.CurrentQueryId = ofInternalId(snapshot.InternalQueryId()).ToString();
                this.CurrentQuery   = snapshot.QueryText();
                this.Protocol       = clientConnectionInfo.Protocol();
                this.ClientAddress  = clientConnectionInfo.ClientAddress();
                this.RequestUri     = clientConnectionInfo.RequestURI();
                this.ConnectionId   = clientConnectionInfo.ConnectionId();
            }
            else
            {
                this.CurrentQueryId = StringUtils.EMPTY;
                this.CurrentQuery   = StringUtils.EMPTY;
                this.Protocol       = StringUtils.EMPTY;
                this.ClientAddress  = StringUtils.EMPTY;
                this.RequestUri     = StringUtils.EMPTY;
                this.ConnectionId   = StringUtils.EMPTY;
            }
            this.ResourceInformation = transactionDependenciesResolver.DescribeBlockingLocks(transaction);
            this.Status   = GetStatus(transaction, terminationReason, transactionDependenciesResolver);
            this.MetaData = transaction.MetaData;
        }