<commit_before>package com.boundary.sdk;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

//import java.net.ConnectException;
//import java.nio.channels.ClosedChannelException;

/**
 * Creates a route that checks to see if a port is accessible on a host.
 * 
 * @author davidg
 *
 */
public class SocketPollerRouteBuilder extends UDPRouteBuilder {

	private int repeatInterval;
	
	@SuppressWarnings("unused")
	private static Logger LOG = LoggerFactory.getLogger(SocketPollerRouteBuilder.class);

	public SocketPollerRouteBuilder() {
		// TODO Auto-generated constructor stub
	}
	
	/**
	 * 
	 * @param repeatInterval
	 */
	public void setRepeatInterval(int repeatInterval) {
		this.repeatInterval = repeatInterval;
	}
	
	/**
	 * 
	 * @return
	 */
	public int getRepeatInterval() {
		return repeatInterval;
	}
	

	
	/**
	 * 
	 * @param cron
	 */
	public void setCron(String cron) {
		
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public void configure() throws Exception {
		//String socketUri = String.format("mina:tcp://" + this.host + ":" + this.port + "?disconnect=true&sync=false");
		String socketUri = String.format("netty:tcp://" + this.host + ":" + this.port + "?sync=false");

		from("quartz://socketPoller?cron=0+*+*+*+*+?")
		.routeId(this.routeId)
		.onException(java.net.ConnectException.class,java.nio.channels.ClosedChannelException.class)
		.handled(true)
		.bean(HostConnectionFailure.class)
		.to("log:com.boundary.sdk.SocketPollerRouteBuilder?level=INFO&showHeaders=true&showBody=true&multiline=true")
		.marshal().serialization()
		.to(this.toUri)
		.end()
		.transform(constant(""))
		.to(socketUri)
		.to("log:com.boundary.sdk.SocketPollerRouteBuilder?level=INFO&showHeaders=true&showBody=true&multiline=true")
		;
	}
}<commit_msg>Refactoring eliminate repeatInterval property<commit_after>package com.boundary.sdk;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

//import java.net.ConnectException;
//import java.nio.channels.ClosedChannelException;

/**
 * Creates a route that checks periodically checks a port on a host
 * to see if it available.
 * 
 * @author davidg
 *
 */
public class SocketPollerRouteBuilder extends UDPRouteBuilder {

	
	@SuppressWarnings("unused")
	private static Logger LOG = LoggerFactory.getLogger(SocketPollerRouteBuilder.class);

	private String cron;

	public SocketPollerRouteBuilder() {
		// Default to poll every minute
		this.cron = "0/60+*+*+*+*+?";
	}
	
	/**
	 * 
	 * @param cron
	 */
	public void setCron(String cron) {
		
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public void configure() throws Exception {		
		String socketUri = String.format("netty:tcp://" + this.host + ":" + this.port + "?sync=false");
		String timerUri = String.format("quartz://" + this.routeId + "?cron=" + this.cron);
		LOG.info("Polling host:  " + this.host + " on port: " + this.port + " with this schedule: " + this.cron);

		from(timerUri)
		.routeId(this.routeId)
		// These are the exception classes that indicate the connection failed.
		.onException(java.net.ConnectException.class,java.nio.channels.ClosedChannelException.class)
		.handled(true) // Mark these exceptions as handled
		.bean(HostConnectionFailure.class)
		.to("log:com.boundary.sdk.SocketPollerRouteBuilder?level=INFO&showHeaders=true&showBody=true&multiline=true")
		.marshal().serialization() // Marshal the RawEvent before sending
		.to(this.toUri)
		.end()
		.transform(constant("")) // Netty requires a body to initiate the connection. Set body to an empty string.
		.to(socketUri)
		.to("log:com.boundary.sdk.SocketPollerRouteBuilder?level=INFO&showHeaders=true&showBody=true&multiline=true")
		// Connection succeeds
		;
	}
}
{'fraction_non_alphanumeric': 0.1381936887921654, 'fraction_numerical': 0.002176278563656148, 'mean_word_length': 4.488059701492538, 'pattern_counts': {'":': 3, '<': 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': '2651145', 'n_tokens_mistral': 1292, 'n_tokens_neox': 1169, 'n_words': 236}