<commit_before>package ibis.satin.impl;

import ibis.ipl.IbisIdentifier;
import ibis.ipl.ReadMessage;
import ibis.ipl.ReceivePortIdentifier;
import ibis.ipl.SendPort;
import ibis.ipl.WriteMessage;

import java.io.IOException;

public abstract class Communication extends SpawnSync {

	//used by GlobalResultTable
	static void connect(SendPort s, ReceivePortIdentifier ident) {
		boolean success = false;
		do {
			try {
				s.connect(ident);
				success = true;
			} catch (IOException e) {
				e.printStackTrace();
				System.err.println("connecting to: " + ident);			
				try {
					Thread.sleep(500);
				} catch (InterruptedException e2) {
					// ignore
				}
			}
		} while (!success);
	}

	static boolean connect(SendPort s, ReceivePortIdentifier ident,
			long timeoutMillis) {
		boolean success = false;
		long startTime = System.currentTimeMillis();
		do {
			try {
				s.connect(ident, timeoutMillis);
				success = true;
			} catch (IOException e) {
				e.printStackTrace();
				System.err.println("connecting to: " + ident);
				try {
					Thread.sleep(500);
				} catch (InterruptedException e2) {
					// ignore
				}
			}
		} while (!success
				&& System.currentTimeMillis() - startTime < timeoutMillis);
		return success;
	}

	//used by GlobalResultTable
	ReceivePortIdentifier lookup(String name) throws IOException {
		return ibis.registry().lookup(name);
	}

	SendPort getReplyPortWait(IbisIdentifier ident) {
		SendPort s;
		if (ASSERTS) {
			assertLocked(this);
		}

		do {
			s = victims.getReplyPort(ident);
			if (s == null) {
				if (COMM_DEBUG) {

					out.println("SATIN '" + this.ident.name()
							+ "': could not get reply port to " + ident.name()
							+ ", retrying");
				}
				try {
					wait();
				} catch (Exception e) {
					// Ignore.
				}
			}
		} while (s == null);

		return s;
	}

	SendPort getReplyPortNoWait(IbisIdentifier ident) {
		SendPort s;
		if (ASSERTS) {
			assertLocked(this);
		}
		s = victims.getReplyPort(ident);
		return s;
	}

	boolean satinPoll() {
		if (POLL_FREQ == 0) { // polling is disabled
			if (HANDLE_MESSAGES_IN_LATENCY) {
				System.err
						.println("Polling is disabled while messages are handled in the latency.\n"
								+ "This is a configureation error.");
				System.exit(1);
			}
			return false;
		}

		if (upcalls && !upcallPolling) { // we are using upcalls, but don't want
			// to poll
			if (HANDLE_MESSAGES_IN_LATENCY) {
				System.err
						.println("Polling is disabled while messages are handled in the latency.\n"
								+ "This is a configureation error.");
				System.exit(1);
			}
			return false;
		}
<commit_msg>Fixed typos<commit_after>package ibis.satin.impl;

import ibis.ipl.IbisIdentifier;
import ibis.ipl.ReadMessage;
import ibis.ipl.ReceivePortIdentifier;
import ibis.ipl.SendPort;
import ibis.ipl.WriteMessage;

import java.io.IOException;

public abstract class Communication extends SpawnSync {

	//used by GlobalResultTable
	static void connect(SendPort s, ReceivePortIdentifier ident) {
		boolean success = false;
		do {
			try {
				s.connect(ident);
				success = true;
			} catch (IOException e) {
				e.printStackTrace();
				System.err.println("connecting to: " + ident);			
				try {
					Thread.sleep(500);
				} catch (InterruptedException e2) {
					// ignore
				}
			}
		} while (!success);
	}

	static boolean connect(SendPort s, ReceivePortIdentifier ident,
			long timeoutMillis) {
		boolean success = false;
		long startTime = System.currentTimeMillis();
		do {
			try {
				s.connect(ident, timeoutMillis);
				success = true;
			} catch (IOException e) {
				e.printStackTrace();
				System.err.println("connecting to: " + ident);
				try {
					Thread.sleep(500);
				} catch (InterruptedException e2) {
					// ignore
				}
			}
		} while (!success
				&& System.currentTimeMillis() - startTime < timeoutMillis);
		return success;
	}

	//used by GlobalResultTable
	ReceivePortIdentifier lookup(String name) throws IOException {
		return ibis.registry().lookup(name);
	}

	SendPort getReplyPortWait(IbisIdentifier ident) {
		SendPort s;
		if (ASSERTS) {
			assertLocked(this);
		}

		do {
			s = victims.getReplyPort(ident);
			if (s == null) {
				if (COMM_DEBUG) {

					out.println("SATIN '" + this.ident.name()
							+ "': could not get reply port to " + ident.name()
							+ ", retrying");
				}
				try {
					wait();
				} catch (Exception e) {
					// Ignore.
				}
			}
		} while (s == null);

		return s;
	}

	SendPort getReplyPortNoWait(IbisIdentifier ident) {
		SendPort s;
		if (ASSERTS) {
			assertLocked(this);
		}
		s = victims.getReplyPort(ident);
		return s;
	}

	boolean satinPoll() {
		if (POLL_FREQ == 0) { // polling is disabled
			if (HANDLE_MESSAGES_IN_LATENCY) {
				System.err
						.println("Polling is disabled while messages are handled in the latency.\n"
								+ "This is a configuration error.");
				System.exit(1);
			}
			return false;
		}

		if (upcalls && !upcallPolling) { // we are using upcalls, but don't want
			// to poll
			if (HANDLE_MESSAGES_IN_LATENCY) {
				System.err
						.println("Polling is disabled while messages are handled in the latency.\n"
								+ "This is a configuration error.");
				System.exit(1);
			}
			return false;
		}

{'fraction_non_alphanumeric': 0.11978568694986605, 'fraction_numerical': 0.004209720627631076, 'mean_word_length': 2.8833580980683506, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4497583', 'n_tokens_mistral': 2145, 'n_tokens_neox': 1702, 'n_words': 427}