<commit_before>package com.barchart.netty.part.boot;

import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.EventLoopGroup;

import java.util.concurrent.TimeUnit;

import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Deactivate;
import org.osgi.service.component.annotations.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.barchart.netty.host.api.NettyBoot;
import com.barchart.netty.host.api.NettyGroup;
import com.barchart.netty.host.api.NettyPipe;
import com.barchart.netty.host.api.NettyPipeManager;
import com.barchart.netty.util.point.NetPoint;

public abstract class BootAny implements NettyBoot {

	protected final Logger log = LoggerFactory.getLogger(getClass());

	@Activate
	protected void bootActivate() {
		log.debug("@@@ activate : {}", type());
	}

	@Deactivate
	protected void bootDeactivate() {
		log.debug("@@@ deactivate : {}", type());
	}

	@Override
	public abstract ChannelFuture startup(final NetPoint netPoint)
			throws Exception;

	@Override
	public ChannelFuture shutdown(final NetPoint netPoint, final Channel channel)
			throws Exception {

		return channel.close();

	}

	/**
	 * builder for transient pipeline applicator handler
	 */
	protected final ChannelInitializer<Channel> pipeApply(
			final NetPoint netPoint, final NettyPipe.Mode mode) {

		return new ChannelInitializer<Channel>() {
			@Override
			public void initChannel(final Channel channel) throws Exception {

				/** always link channel with owner end point */
				// channel.attr(NettyDot.ATTR_NET_POINT).set(netPoint);

				final int timeout = netPoint.getInt("pipeline-timeout", 10000);
				final NettyPipe pipe =
						pipeManager().findPipe(netPoint.getPipeline(), timeout,
								TimeUnit.MILLISECONDS);

				if (pipe == null) {
					log.error("missing pipeline", new IllegalArgumentException(
							netPoint.getPipeline()));
				} else {
					pipe.apply(channel, mode);
				}

			}
		};

	}

	private EventLoopGroup group;

	protected EventLoopGroup group() {
		return group;
	}<commit_msg>Added constant property name<commit_after>package com.barchart.netty.part.boot;

import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.EventLoopGroup;

import java.util.concurrent.TimeUnit;

import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Deactivate;
import org.osgi.service.component.annotations.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.barchart.netty.host.api.NettyBoot;
import com.barchart.netty.host.api.NettyGroup;
import com.barchart.netty.host.api.NettyPipe;
import com.barchart.netty.host.api.NettyPipeManager;
import com.barchart.netty.util.point.NetPoint;

public abstract class BootAny implements NettyBoot {

	protected final Logger log = LoggerFactory.getLogger(getClass());
	protected final static String PIPELINE_TIMEOUT = "pipeline-timeout";

	@Activate
	protected void bootActivate() {
		log.debug("@@@ activate : {}", type());
	}

	@Deactivate
	protected void bootDeactivate() {
		log.debug("@@@ deactivate : {}", type());
	}

	@Override
	public abstract ChannelFuture startup(final NetPoint netPoint)
			throws Exception;

	@Override
	public ChannelFuture shutdown(final NetPoint netPoint, final Channel channel)
			throws Exception {

		return channel.close();

	}

	/**
	 * builder for transient pipeline applicator handler
	 */
	protected final ChannelInitializer<Channel> pipeApply(
			final NetPoint netPoint, final NettyPipe.Mode mode) {

		return new ChannelInitializer<Channel>() {
			@Override
			public void initChannel(final Channel channel) throws Exception {

				/** always link channel with owner end point */
				// channel.attr(NettyDot.ATTR_NET_POINT).set(netPoint);

				final int timeout = netPoint.getInt(PIPELINE_TIMEOUT, 10000);
				final NettyPipe pipe =
						pipeManager().findPipe(netPoint.getPipeline(), timeout,
								TimeUnit.MILLISECONDS);

				if (pipe == null) {
					log.error("missing pipeline", new IllegalArgumentException(
							netPoint.getPipeline()));
				} else {
					pipe.apply(channel, mode);
				}

			}
		};

	}

	private EventLoopGroup group;

	protected EventLoopGroup group() {
		return group;
	}
{'fraction_non_alphanumeric': 0.1083654500113353, 'fraction_numerical': 0.0031738834731353436, 'mean_word_length': 4.528822055137844, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '6989767', 'n_tokens_mistral': 1491, 'n_tokens_neox': 1322, 'n_words': 297}