Package org.lightfish.business.servermonitoring.entity

Examples of org.lightfish.business.servermonitoring.entity.Snapshot


        this.serverInstance= serverInstance;
    }

    @Override
    public DataPoint<Snapshot> collect() throws Exception {
        Snapshot current = dataProvider.fetchSnapshot(getServerInstance());
        current.setInstanceName(getServerInstance());
        return new DataPoint<>(getServerInstance(), current);
    }
View Full Code Here


    public void escalate(@Observes @Severity(Severity.Level.HEARTBEAT) Snapshot current) {
        List<Script> scripts = this.scripting.activeScripts();
        try {
            Bindings binding = this.scriptEngine.createBindings();
            binding.put("current", current);
            Snapshot recent = this.recentSnapshots.get(current.getInstanceName());
            binding.put("previous", recent);
            long start = System.currentTimeMillis();
            try {
                if (recent != null) {
                    for (Script script : scripts) {
View Full Code Here

            LOG.info("Loaded DataCollector: " + collector);
        }
    }

    public Snapshot fetchSnapshot(String instanceName) throws Exception {
        Snapshot snapshot = null;
        Date start = new Date();

        if (parallelDataCollection.get()) {
            snapshot = parallelDataCollection(instanceName);
        } else {
View Full Code Here

        return snapshot;

    }

    private Snapshot serialDataCollection(String instanceName) throws Exception {
        Snapshot snapshot = new Snapshot.Builder().build();
        DataCollectionBehaviour dataCollectionBehaviour = new DataCollectionBehaviour(mapper, snapshot);
        for (DataCollector collector : retrieveDataCollectorList(instanceName)) {
            DataPoint dataPoint = serialDataCollect(collector, 0);
            dataCollectionBehaviour.perform(dataPoint);
        }
View Full Code Here

            }
        }
    }

    private Snapshot parallelDataCollection(String instanceName) throws Exception {
        Snapshot snapshot = new Snapshot.Builder().build();
        parallelExecutor.execute(new DataCollectionBehaviour(mapper, snapshot), retrieveDataCollectorList(instanceName));

        return snapshot;
    }
View Full Code Here

        }
    }

    private void handleRoundCompletion() {
        LOG.info("All snapshots collected for this round!");
        Snapshot combinedSnapshot = combineSnapshots(currentSnapshots.values());
        em.persist(combinedSnapshot);
        em.flush();
        fireHeartbeat(combinedSnapshot);

        currentSnapshots.clear();
View Full Code Here

            }

            //logs.addAll(current.getLogRecords());
        }

        Snapshot combined = new Snapshot.Builder()
                .activeSessions(activeSessions)
                .committedTX(committedTX)
                .currentThreadBusy(currentThreadBusy)
                .expiredSessions(expiredSessions)
                .peakThreadCount(peakThreadCount)
                .queuedConnections(queuedConnections)
                .rolledBackTX(rolledBackTX)
                .threadCount(threadCount)
                .totalErrors(totalErrors)
                .usedHeapSize(usedHeapSize)
                .instanceName(COMBINED_SNAPSHOT_NAME)
                .logs(new ArrayList<>(logs))
                .build();
        combined.setApps(new ArrayList(applications.values()));
        combined.setPools(new ArrayList(pools.values()));

        return combined;
    }
View Full Code Here

        cut.initScripting();
    }

    @Test
    public void firstEscalation() throws ScriptException {
        Snapshot snapshot = new Snapshot.Builder().instanceName("something").build();
        when(cut.scripting.activeScripts()).thenReturn(scripts(""));
        this.cut.escalate(snapshot);


        this.cut.scriptEngine = mock(ScriptEngine.class);
View Full Code Here

        this.serializer.initialize();
    }
   
    @Test
    public void serialize() {
      Snapshot snapshot = new Snapshot.Builder().usedHeapSize(42).build();
      StringWriter writer = new StringWriter();
      this.serializer.serialize(snapshot, writer);
      String serializedRepresentation = writer.getBuffer().toString();
      assertNotNull(serializedRepresentation);
      assertTrue(serializedRepresentation.contains("42"));
View Full Code Here

                this.cut.scriptEngine, never()).eval(any(String.class), any(Bindings.class));
    }

    @Test
    public void escalation() throws ScriptException {
        Snapshot snapshot = new Snapshot.Builder().instanceName("something").build();
        when(cut.scripting.activeScripts()).thenReturn(scripts("true"));
        this.cut.escalate(snapshot);
        this.cut.escalate(snapshot); //second invocation needed to enable evaluation
        verify(this.cut.escalationSink).fire((Escalation) anyObject());
        assertEquals(snapshot, lastEscalation.getSnapshot());
View Full Code Here

TOP

Related Classes of org.lightfish.business.servermonitoring.entity.Snapshot

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.