All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.headlessintrace.client.connection.DefaultCallback Maven / Gradle / Ivy

Go to download

A headless java API that collects events from other JVMs. Events=method invocations. Initial code taken from http://mchr3k.github.io/org.intrace/. Intended for building diagnostic applications.

There is a newer version: 0.0.4
Show newest version
package org.headlessintrace.client.connection;

import java.util.List;
import java.util.Map;

import org.headlessintrace.client.DefaultFactory;
import org.headlessintrace.client.IFactory;
import org.headlessintrace.client.model.FixedLengthQueue;
import org.headlessintrace.client.IFactory;

public class DefaultCallback implements IConnectionStateCallback {
	
	/**
	 * Keep a history of recent status messages...but it is a limited history.
	 */
	FixedLengthQueue m_connectionStatusMessages = 
			new FixedLengthQueue(
					DefaultFactory.getFactory().getConfig().getFixedMessageCount() );

	/**
	 * Keep a history of recent connections states...but it is a limited history.
	 */
	FixedLengthQueue m_connectStates = 
			new FixedLengthQueue(
					DefaultFactory.getFactory().getConfig().getFixedMessageCount() );
	
	public ConnectState getConnectState() {
		return m_connectStates.getLast();
	}
	
	public List getConnectStates() {
		return m_connectStates;
	}
	@Override
	public void setConnectionStatusMsg(String msg) {
		m_connectionStatusMessages.add(msg);
	}
	public List getConnectionStatusMsgs() {
		return m_connectionStatusMessages;
	}

	@Override
	public void setConnectState(ConnectState state) {
		m_connectStates.add(state);
	}

	/**
	 * org/intrace/agent/ClassTransformer.java (part of agent code) drives the traffic to this method.
	 * If you place this line of code in the method:
	 * 
		System.out.println("DefaultCallback.setProgress() [" + progress.toString() + "]");
		
		...then you'll get output that looks like this:
		
	   	DefaultCallback.setProgress() [{NUM_PROGRESS_COUNT=2700, NUM_PROGRESS_ID=NUM_PROGRESS_ID, NUM_PROGRESS_TOTAL=2740}]
	  	DefaultCallback.setProgress() [{NUM_PROGRESS_COUNT=2710, NUM_PROGRESS_ID=NUM_PROGRESS_ID, NUM_PROGRESS_TOTAL=2740}]
	  	DefaultCallback.setProgress() [{NUM_PROGRESS_COUNT=2720, NUM_PROGRESS_ID=NUM_PROGRESS_ID, NUM_PROGRESS_TOTAL=2740}]
	  	DefaultCallback.setProgress() [{NUM_PROGRESS_COUNT=2730, NUM_PROGRESS_ID=NUM_PROGRESS_ID, NUM_PROGRESS_TOTAL=2740}]
	  	DefaultCallback.setProgress() [{NUM_PROGRESS_DONE=true, NUM_PROGRESS_ID=NUM_PROGRESS_ID, NUM_PROGRESS_TOTAL=2740, NUM_PROGRESS_COUNT=2740}]
	   
*/ @Override public void setProgress(Map progress) { } /** * Need to learn how to use this. Is it even useful? */ @Override public void setStatus(Map progress) { } /** * Need to learn how to use this. Is it even useful? */ @Override public void setConfig(Map progress) { } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy