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

com.genexus.search.ActionBuffer Maven / Gradle / Ivy

Go to download

Core classes for the runtime used by Java and Android apps generated with GeneXus

The newest version!
package com.genexus.search;

import java.util.Vector;

public class ActionBuffer {
	private Vector m_buff = new Vector();
	private Object m_lock = new Object();
	private int m_maxsize;

	public ActionBuffer(int maxsize) {
		m_maxsize = maxsize;
	}

	public void addAction(Action action) {
		synchronized (m_lock) {
			m_buff.add(action);
		}
		try {
			while (m_buff.size() > m_maxsize) {
				Thread.sleep(50);
			}
		} catch (Exception ex) {
		}
	}

	public Action getAction() {
		synchronized (m_lock) {
			if (m_buff.size() > 0) {
				Action action = (Action) m_buff.elementAt(0);
				m_buff.removeElementAt(0);
				return action;
			}
		}
		return null;
	}

	public int getCount() {
		synchronized (m_lock) {
			return m_buff.size();
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy