<commit_before>package ActiveMQ;

import javax.jms.DeliveryMode;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.MessageProducer;
import javax.jms.Session;

import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.command.ActiveMQDestination;

import com.google.gson.Gson;

import shared.MsgEvent;


public class ActiveProducerWorker
{

	public boolean ActiveProducer;
	private Session sess;
	private ActiveMQConnection  conn;
	private Destination destination;
	private MessageProducer producer;
	private Gson gson;
	public boolean isActive;
	private String queueName;
	
public ActiveProducerWorker(String TXQueueName, String URI) 
{
	try
	{
		queueName = TXQueueName;
		gson = new Gson();
		//ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(URI);
		conn = (ActiveMQConnection) new ActiveMQConnectionFactory(URI).createConnection();
		//conn = factory.createConnection();
		conn.start();
		this.sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
		//this.TXqueue = sess.createQueue(TXQueueName);
		destination = sess.createQueue(TXQueueName);
		producer = this.sess.createProducer(destination);
        producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
        isActive = true;
	}
	catch (JMSException e)
	{
		System.out.println("ActiveConsumer JMS " + e.getMessage());
	}
	catch(Exception ex)
	{
		System.out.println("ActiveConsumer Init " + ex.toString());
	}
}

public boolean shutdown()
{
	boolean isShutdown = false;
    try {
		System.out.println("Closing Producer");
    	producer.close();
		System.out.println("Closing Session");
    	sess.close();
		System.out.println("Destroying Destination");
        conn.destroyDestination((ActiveMQDestination) destination);
		System.out.println("Cleaning up Connection");
        conn.cleanup();
		System.out.println("Cleaning up Connection Again");
        conn.doCleanup(true);
		System.out.println("Stopping Connection");
        conn.stop();
        System.out.println("CODY 1 Ended Producer Thread :" + Thread.currentThread());
        isShutdown = true;
    } catch (JMSException jmse) {
		jmse.printStackTrace();
        System.out.println(jmse.getErrorCode());
    }
    return isShutdown;
    
	
}
public boolean sendMessage(MsgEvent se) {
	boolean isSent = false;
    try {
    	String sendJson = gson.toJson(se);

    	producer.send(this.sess.createTextMessage(sendJson));
        
    } catch (JMSException jmse) {
        System.out.println(jmse.getErrorCode());<commit_msg>Debug message change<commit_after>package ActiveMQ;

import javax.jms.DeliveryMode;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.MessageProducer;
import javax.jms.Session;

import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.command.ActiveMQDestination;

import com.google.gson.Gson;

import shared.MsgEvent;


public class ActiveProducerWorker
{

	public boolean ActiveProducer;
	private Session sess;
	private ActiveMQConnection  conn;
	private Destination destination;
	private MessageProducer producer;
	private Gson gson;
	public boolean isActive;
	private String queueName;
	
public ActiveProducerWorker(String TXQueueName, String URI) 
{
	try
	{
		queueName = TXQueueName;
		gson = new Gson();
		//ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(URI);
		conn = (ActiveMQConnection) new ActiveMQConnectionFactory(URI).createConnection();
		//conn = factory.createConnection();
		conn.start();
		this.sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
		//this.TXqueue = sess.createQueue(TXQueueName);
		destination = sess.createQueue(TXQueueName);
		producer = this.sess.createProducer(destination);
        producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
        isActive = true;
	}
	catch (JMSException e)
	{
		System.out.println("ActiveConsumer JMS " + e.getMessage());
	}
	catch(Exception ex)
	{
		System.out.println("ActiveConsumer Init " + ex.toString());
	}
}

public boolean shutdown()
{
	boolean isShutdown = false;
    try {
		System.out.println("Closing Producer");
    	producer.close();
		System.out.println("Closing Session");
    	sess.close();
		System.out.println("Destroying Destination");
        conn.destroyDestination((ActiveMQDestination) destination);
		System.out.println("Cleaning up Connection");
        conn.cleanup();
		System.out.println("Cleaning up Connection Again");
        conn.doCleanup(true);
		System.out.println("Stopping Connection");
        conn.stop();
        System.out.println("CODY 1 Ended Producer Thread :" + Thread.currentThread());
        isShutdown = true;
    } catch (JMSException jmse) {
		jmse.printStackTrace();
		System.out.println(jmse.getMessage());
        System.out.println(jmse.getLinkedException().getMessage());
    }
    return isShutdown;
    
	
}
public boolean sendMessage(MsgEvent se) {
	boolean isSent = false;
    try {
    	String sendJson = gson.toJson(se);

    	producer.send(this.sess.createTextMessage(sendJson));
        
    } catch (JMSException jmse) {
        System.out.println(jmse.getErrorCode());
{'fraction_non_alphanumeric': 0.112776176753122, 'fraction_numerical': 0.00038424591738712776, 'mean_word_length': 4.334016393442623, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '927922', 'n_tokens_mistral': 1661, 'n_tokens_neox': 1589, 'n_words': 310}