Package org.apache.qpid.server.model

Examples of org.apache.qpid.server.model.Statistics


     */
    @Override
    public Map<String, Object> mapEncode()
    {
        // Statistics
        Statistics stats = _exchange.getStatistics();
        long msgReceives = ((Long)stats.getStatistic("messagesIn")).longValue();
        long msgDrops = ((Long)stats.getStatistic("messagesDropped")).longValue();
        long msgRoutes = msgReceives - msgDrops;

        long byteReceives = ((Long)stats.getStatistic("bytesIn")).longValue();
        long byteDrops = ((Long)stats.getStatistic("bytesDropped")).longValue();
        long byteRoutes = byteReceives - byteDrops;

        setValue("producerCount", "Not yet implemented"); // In Qpid 0.20 producerCount statistic returns null.

        // We have to modify the value of bindingCount for Exchange because the QmfManagementAgent "hides" the
        // QMF Objects that relate to its own AMQP Connection/Queues/Bindings so the bindingCount for default direct
        // qmf.default.direct and qmf.default.topic is different to the actual number of QMF bindings.
        long bindingCount = ((Long)stats.getStatistic("bindingCount")).longValue();
        if (_name.equals(""))
        {
            bindingCount -= 3;
        }
        else if (_name.equals("qmf.default.direct"))
View Full Code Here


     */
    @Override
    public Map<String, Object> mapEncode()
    {
        // Statistics
        Statistics stats = _connection.getStatistics();
        // closing Not implemented in Qpid 0.20
        setValue("framesFromClient", 0); // framesFromClient Not implemented in Qpid 0.20
        setValue("framesToClient", 0); // framesToClient Not implemented in Qpid 0.20
        setValue("bytesFromClient", stats.getStatistic("bytesIn"));
        setValue("bytesToClient", stats.getStatistic("bytesOut"));
        setValue("msgsFromClient", stats.getStatistic("messagesIn"));
        setValue("msgsToClient", stats.getStatistic("messagesOut"));

        update(); // TODO set update if statistics change.
        return super.mapEncode();
    }
View Full Code Here

    @Override
    public Map<String, Object> mapEncode()
    {
        // Statistics

        Statistics stats = _session.getStatistics();
        setValue("unackedMessages", stats.getStatistic("unacknowledgedMessages"));

        update(); // TODO Only Update if statistics have changes.

        return super.mapEncode();
    }
View Full Code Here

     */
    @Override
    public Map<String, Object> mapEncode()
    {
        // Statistics
        Statistics stats = _subscription.getStatistics();
        setValue("delivered", stats.getStatistic("messagesOut"));

        setValue("exclusive", _exclusive);

        update(); // TODO Only Update if statistics have changes.
        return super.mapEncode();
View Full Code Here

                setRefValue("altExchange", _alternateExchange);
            }
        }

        // Statistics
        Statistics stats = _queue.getStatistics();
        setValue("msgTotalEnqueues", stats.getStatistic("totalEnqueuedMessages"));
        setValue("msgTotalDequeues", stats.getStatistic("totalDequeuedMessages"));
        // msgTxnEnqueues not implemented in Qpid 0.20
        // msgTxnDequeues not implemented in Qpid 0.20
        setValue("msgPersistEnqueues", stats.getStatistic("persistentEnqueuedMessages"));
        setValue("msgPersistDequeues", stats.getStatistic("persistentDequeuedMessages"));
        setValue("msgDepth", stats.getStatistic("queueDepthMessages"));
        setValue("byteDepth", stats.getStatistic("queueDepthBytes"));
        setValue("byteTotalEnqueues", stats.getStatistic("totalEnqueuedBytes"));
        setValue("byteTotalDequeues", stats.getStatistic("totalDequeuedBytes"));
        // byteTxnEnqueues not implemented in Qpid 0.20
        // byteTxnDequeues not implemented in Qpid 0.20
        setValue("bytePersistEnqueues", stats.getStatistic("persistentEnqueuedBytes"));
        setValue("bytePersistDequeues", stats.getStatistic("persistentDequeuedBytes"));

        // Flow-to-disk Statistics not implemented in Qpid 0.20
        // releases & acquires not implemented in Qpid 0.20
        // discardsTtl (discardsTtlMessages) not implemented in Qpid 0.20
        // discardsRing not implemented in Qpid 0.20
        // discardsLvq not implemented in Qpid 0.20
        // discardsOverflow not implemented in Qpid 0.20
        // discardsSubscriber not implemented in Qpid 0.20
        // discardsPurge not implemented in Qpid 0.20
        // reroutes not implemented in Qpid 0.20

        setValue("consumerCount", stats.getStatistic("consumerCount"));
        setValue("bindingCount", stats.getStatistic("bindingCount"));
        setValue("unackedMessages", stats.getStatistic("unacknowledgedMessages"));

        setValue("messageLatency", "Not yet implemented");
        // flowStopped not implemented in Qpid 0.20
        // flowStoppedCount not implemented in Qpid 0.20
View Full Code Here

    }

    private void incorporateStatisticsIntoMap(
            final ConfiguredObject confObject, Map<String, Object> object)
    {
        Statistics statistics = confObject.getStatistics();
        Map<String, Object> statMap = new HashMap<String, Object>();

        if (statistics != null)
        {
            for(String name : statistics.getStatisticNames())
            {
                Object value = statistics.getStatistic(name);
                if(value != null)
                {
                    statMap.put(name, value);
                }
            }
View Full Code Here

        TabularDataSupport sessionTable = new TabularDataSupport(CHANNELS_TYPE);
        Collection<Session> list = getConfiguredObject().getSessions();

        for (Session session : list)
        {
            Statistics statistics = session.getStatistics();
            Long txnBegins = (Long) statistics.getStatistic(Session.LOCAL_TRANSACTION_BEGINS);
            Integer channelId = (Integer) session.getAttribute(Session.CHANNEL_ID);
            int unacknowledgedSize = ((Number) statistics.getStatistic(Session.UNACKNOWLEDGED_MESSAGES)).intValue();
            boolean blocked = (Boolean) session.getAttribute(Session.PRODUCER_FLOW_BLOCKED);
            boolean isTransactional = (txnBegins>0l);

            Object[] itemValues =
                    {
View Full Code Here

        assertAttribute("remoteAddress", "testRemoteAddress", Connection.REMOTE_ADDRESS);
    }

    public void testGetLastIoTime()
    {
        Statistics mockStatistics = mock(Statistics.class);
        when(_mockConnection.getStatistics()).thenReturn(mockStatistics);
        when(mockStatistics.getStatistic(Connection.LAST_IO_TIME)).thenReturn(1L);

        Object actualValue = _connectionMBean.getLastIoTime();
        assertEquals("Unexpected lastIoTime", new Date(1L), actualValue);
    }
View Full Code Here

    }

    private Session createMockedSession(int channelId, int unacknowledgedMessages, long localTransactionBegins, boolean blocked)
    {
        Session mockSession = mock(Session.class);
        Statistics mockSessionStatistics = mock(Statistics.class);
        when(mockSessionStatistics.getStatistic(Session.LOCAL_TRANSACTION_BEGINS)).thenReturn(localTransactionBegins);
        when(mockSessionStatistics.getStatistic(Session.UNACKNOWLEDGED_MESSAGES)).thenReturn(unacknowledgedMessages);

        when(mockSession.getStatistics()).thenReturn(mockSessionStatistics);
        when(mockSession.getAttribute(Session.CHANNEL_ID)).thenReturn(channelId);
        when(mockSession.getAttribute(Session.PRODUCER_FLOW_BLOCKED)).thenReturn(blocked);
        return mockSession;
View Full Code Here

    public void testConfiguredObjectWithSingleStatistics() throws Exception
    {
        final String statisticName = "statisticName";
        final int statisticValue = 10;

        Statistics mockStatistics = createMockStatistics(statisticName, statisticValue);
        when(_configuredObject.getStatistics()).thenReturn(mockStatistics);

        Map<String, Object> resultMap = _converter.convertObjectToMap(_configuredObject, ConfiguredObject.class, 0);
        Map<String, Object> statsAsMap = (Map<String, Object>) resultMap.get(STATISTICS_MAP_KEY);
        assertNotNull("Statistics should be part of map", statsAsMap);
View Full Code Here

TOP

Related Classes of org.apache.qpid.server.model.Statistics

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.