<commit_before>
/*
 * Copyright 2011 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import org.vertx.java.core.Handler;
import org.vertx.java.core.buffer.Buffer;
import org.vertx.java.core.http.HttpServer;
import org.vertx.java.core.json.JsonObject;
import org.vertx.java.core.sockjs.SockJSServer;
import org.vertx.java.core.sockjs.SockJSSocket;
import org.vertx.java.platform.Verticle;

import java.util.HashMap;

public class SockJSExample extends Verticle {

    private HashMap<String, SockJSSocket> m_clients = new HashMap<String, SockJSSocket>();

	public void start() {
		HttpServer server = vertx.createHttpServer();
	
		SockJSServer sockServer = vertx.createSockJSServer(server);

		sockServer.installApp(new JsonObject().putString("prefix", "/echo"), new Handler<SockJSSocket>() {
			public void handle(final SockJSSocket sock) {

                m_clients.put(sock.writeHandlerID(),sock);

				sock.endHandler(new Handler<Void>() {
					public void handle(Void _param) {
						m_clients.remove(sock.writeHandlerID());
					}
				});

				sock.dataHandler(new Handler<Buffer>() {
					public void handle(Buffer data) {
                        for(SockJSSocket client: m_clients.values())
                            client.write(data);
					}
				});
			}
		});

		server.listen(9999);
	}
}<commit_msg>logging and same config as in nodejs version<commit_after>
/*
 * Copyright 2011 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import org.vertx.java.core.Handler;
import org.vertx.java.core.buffer.Buffer;
import org.vertx.java.core.http.HttpServer;
import org.vertx.java.core.json.JsonObject;
import org.vertx.java.core.sockjs.SockJSServer;
import org.vertx.java.core.sockjs.SockJSSocket;
import org.vertx.java.platform.Verticle;

import java.util.HashMap;

public class SockJSExample extends Verticle {

    private HashMap<String, SockJSSocket> m_clients = new HashMap<String, SockJSSocket>();

	public void start() {
		HttpServer server = vertx.createHttpServer();

		SockJSServer sockServer = vertx.createSockJSServer(server);

		JsonObject config = new JsonObject()
				.putString("prefix", "/echo")
				.putNumber("heartbeat_period",5000)
				.putNumber("session_timeout",25000);

		sockServer.installApp(config, new Handler<SockJSSocket>() {
			public void handle(final SockJSSocket sock) {

				System.out.println("connect: "+sock.writeHandlerID());

                m_clients.put(sock.writeHandlerID(),sock);

				sock.endHandler(new Handler<Void>() {
					public void handle(Void _param) {
						System.out.println("disconnect: "+sock.writeHandlerID());
						m_clients.remove(sock.writeHandlerID());
					}
				});

				sock.dataHandler(new Handler<Buffer>() {
					public void handle(Buffer data) {
						System.out.println("msg: "+data);
                        for(SockJSSocket client: m_clients.values())
                            client.write(data);
					}
				});
			}
		});

		server.listen(9999);
	}
}
{'fraction_non_alphanumeric': 0.109375, 'fraction_numerical': 0.00818452380952381, 'mean_word_length': 3.5519187358916477, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7044036', 'n_tokens_mistral': 1342, 'n_tokens_neox': 1171, 'n_words': 323}