<commit_before>package com.nhn.pinpoint.testweb.controller;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;

import net.spy.memcached.AddrUtil;
import net.spy.memcached.ArcusClient;
import net.spy.memcached.ConnectionFactoryBuilder;
import net.spy.memcached.MemcachedClient;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import perftest.LevelManager;

import com.nhn.pinpoint.testweb.domain.Member;
import com.nhn.pinpoint.testweb.service.DummyService;
import com.nhn.pinpoint.testweb.service.MemberService;
import com.nhn.pinpoint.testweb.util.HttpConnectorOptions;
import com.nhn.pinpoint.testweb.util.HttpInvoker;
import com.nhncorp.lucy.net.invoker.InvocationFuture;
import com.nhncorp.lucy.npc.connector.NpcHessianConnector;

@Controller
public class HelloWorldController implements DisposableBean {

	private final ArcusClient arcus;
	private final MemcachedClient memcached;
	private final LevelManager levelManager;

	public HelloWorldController() throws IOException {
		arcus = ArcusClient.createArcusClient("dev.arcuscloud.nhncorp.com:17288", "dev", new ConnectionFactoryBuilder());
		memcached = new MemcachedClient(AddrUtil.getAddresses("10.25.149.80:11244,10.25.149.80:11211,10.25.149.79:11211"));
		levelManager = new LevelManager();
	}

	@Autowired
	private MemberService service;

	@Autowired
	private DummyService dummyService;

	private void randomSlowMethod() {
		try {
			Thread.sleep((new Random().nextInt(3)) * 1000L);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}

	@RequestMapping(value = "/dummy")
	public String dummy(Model model) {
		dummyService.doSomething();
		return "donothing";
	}

	@RequestMapping(value = "/encoding")
	public String encoding(Model model, @RequestParam("name") String name) {
		System.out.println("name=" + name);
		return "donothing";
	}

	@RequestMapping(value = "/donothing")
	public String donothing(Model model) {
		System.out.println("do nothing.");
		return "donothing";
	}

	@RequestMapping(value = "/arcus")
	public String arcus(Model model) {
		int rand = new Random().nextInt(100);
		String key = "pinpoint:testkey-" + rand;

		// set
		Future<Boolean> setFuture = null;
		try {
			setFuture = arcus.set(key, 10, "Hello, pinpoint." + rand);
			setFuture.get(1000L, TimeUnit.MILLISECONDS);
		} catch (Exception e) {
			if (setFuture != null)
				setFuture.cancel(true);
		}

		// get
		Future<Object> getFuture = null;
		try {
			getFuture = arcus.asyncGet(key);
			getFuture.get(1000L, TimeUnit.MILLISECONDS);
		} catch (Exception e) {
			if (getFuture != null)
				getFuture.cancel(true);
		}

		// del<commit_msg>[강운덕] [LUCYSUS-1744] agent의 문제 상황시 디버그가 쉽도록 ClassFileTransformer의 reference를 저장하도록 수정함.<commit_after>package com.nhn.pinpoint.testweb.controller;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;

import net.spy.memcached.AddrUtil;
import net.spy.memcached.ArcusClient;
import net.spy.memcached.ConnectionFactoryBuilder;
import net.spy.memcached.MemcachedClient;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import perftest.LevelManager;

import com.nhn.pinpoint.testweb.domain.Member;
import com.nhn.pinpoint.testweb.service.DummyService;
import com.nhn.pinpoint.testweb.service.MemberService;
import com.nhn.pinpoint.testweb.util.HttpConnectorOptions;
import com.nhn.pinpoint.testweb.util.HttpInvoker;
import com.nhncorp.lucy.net.invoker.InvocationFuture;
import com.nhncorp.lucy.npc.connector.NpcHessianConnector;

@Controller
public class HelloWorldController implements DisposableBean {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    private final ArcusClient arcus;
	private final MemcachedClient memcached;
	private final LevelManager levelManager;

	public HelloWorldController() throws IOException {
		arcus = ArcusClient.createArcusClient("dev.arcuscloud.nhncorp.com:17288", "dev", new ConnectionFactoryBuilder());
		memcached = new MemcachedClient(AddrUtil.getAddresses("10.25.149.80:11244,10.25.149.80:11211,10.25.149.79:11211"));
		levelManager = new LevelManager();
	}

	@Autowired
	private MemberService service;

	@Autowired
	private DummyService dummyService;

	private void randomSlowMethod() {
		try {
			Thread.sleep((new Random().nextInt(3)) * 1000L);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}

	@RequestMapping(value = "/dummy")
	public String dummy(Model model) {
		dummyService.doSomething();
		return "donothing";
	}

	@RequestMapping(value = "/encoding")
	public String encoding(Model model, @RequestParam("name") String name) {
        logger.debug("name=" + name);
		return "donothing";
	}

	@RequestMapping(value = "/donothing")
	public String donothing(Model model) {
		logger.debug("do nothing.");
		return "donothing";
	}

	@RequestMapping(value = "/arcus")
	public String arcus(Model model) {
		int rand = new Random().nextInt(100);
		String key = "pinpoint:testkey-" + rand;

		// set
		Future<Boolean> setFuture = null;
		try {
			setFuture = arcus.set(key, 10, "Hello, pinpoint." + rand);
			setFuture.get(1000L, TimeUnit.MILLISECONDS);
		} catch (Exception e) {
			if (setFuture != null)
				setFuture.cancel(true);
		}

		// get
		Future<Object> getFuture = null;
		try {
			getFuture = arcus.asyncGet(key);
			getFuture.get(1000L, TimeUnit.MILLISECONDS);
		} catch (Exception e) {
			if (getFuture != null)
				getFuture.cancel(true);
		}

		// del
{'fraction_non_alphanumeric': 0.12003780718336483, 'fraction_numerical': 0.02142407057340895, 'mean_word_length': 5.1640776699029125, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, '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': '4629573', 'n_tokens_mistral': 2259, 'n_tokens_neox': 2070, 'n_words': 396}