// Path: src/matlabcontrol/MatlabProxy.java
// public static interface Identifier {
// 	/**
// 	 * Returns {@code true} if {@code other} is equal to this identifier, {@code false} otherwise.
// 	 * 
// 	 * @param other
// 	 * @return 
// 	 */
// 	@Override
// 	public boolean equals(Object other);
// 
// 	/**
// 	 * Returns a hash code which conforms to the {@code hashCode} contract defined in {@link Object#hashCode()}.
// 	 * 
// 	 * @return 
// 	 */
// 	@Override
// 	public int hashCode();
// }
// 
// Path: src/matlabcontrol/MatlabProxyFactory.java
// public static interface Request {
// 	/**
// 	 * The identifier of the proxy associated with this request. If the proxy is created, then its identifier
// 	 * accessible via {@link MatlabProxy#getIdentifier()} will return {@code true} when tested for equivalence with
// 	 * the identifier returned by this method using {@link Identifier#equals(java.lang.Object)}.
// 	 * 
// 	 * @return proxy's identifier
// 	 */
// 	public Identifier getProxyIdentifer();
// 
// 	/**
// 	 * Attempts to cancel the request. If the request has already been completed or cannot successfully be canceled
// 	 * then {@code false} will be returned, otherwise {@code true} will be returned. If the request has already been
// 	 * successfully canceled then this method will have no effect and {@code true} will be returned.
// 	 * 
// 	 * @return if successfully cancelled
// 	 */
// 	public boolean cancel();
// 
// 	/**
// 	 * If the request has been successfully cancelled.
// 	 * 
// 	 * @return if successfully cancelled
// 	 */
// 	public boolean isCancelled();
// 
// 	/**
// 	 * Returns {@code true} if the proxy has been created.
// 	 * 
// 	 * @return if the proxy has been created
// 	 */
// 	public boolean isCompleted();
// }
// 
// Path: src/matlabcontrol/MatlabProxyFactory.java
// public static interface RequestCallback {
// 	/**
// 	 * Called when the proxy has been created. Because requests have no timeout, there is no guarantee that this
// 	 * method will ever be called.
// 	 * 
// 	 * @param proxy 
// 	 */
// 	public void proxyCreated(MatlabProxy proxy);
// }


import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.Writer;
import java.nio.charset.Charset;
import java.rmi.AlreadyBoundException;
import java.rmi.NoSuchObjectException;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.CopyOnWriteArrayList;
import matlabcontrol.MatlabProxy.Identifier;
import matlabcontrol.MatlabProxyFactory.Request;
import matlabcontrol.MatlabProxyFactory.RequestCallback;
					}
				}
			}, RECEIVER_CHECK_PERIOD, RECEIVER_CHECK_PERIOD);
		}

		void shutdown() {
			_timer.cancel();
		}
	}

	private static class GetProxyRequestCallback implements RequestCallback {
		private final Thread _requestingThread;
		private volatile MatlabProxy _proxy;

		public GetProxyRequestCallback() {
			_requestingThread = Thread.currentThread();
		}

		@Override
		public void proxyCreated(MatlabProxy proxy) {
			_proxy = proxy;

			_requestingThread.interrupt();
		}

		public MatlabProxy getProxy() {
			return _proxy;
		}
	}

// Path: src/matlabcontrol/MatlabProxy.java
// public static interface Identifier {
// 	/**
// 	 * Returns {@code true} if {@code other} is equal to this identifier, {@code false} otherwise.
// 	 * 
// 	 * @param other
// 	 * @return 
// 	 */
// 	@Override
// 	public boolean equals(Object other);
// 
// 	/**
// 	 * Returns a hash code which conforms to the {@code hashCode} contract defined in {@link Object#hashCode()}.
// 	 * 
// 	 * @return 
// 	 */
// 	@Override
// 	public int hashCode();
// }
// 
// Path: src/matlabcontrol/MatlabProxyFactory.java
// public static interface Request {
// 	/**
// 	 * The identifier of the proxy associated with this request. If the proxy is created, then its identifier
// 	 * accessible via {@link MatlabProxy#getIdentifier()} will return {@code true} when tested for equivalence with
// 	 * the identifier returned by this method using {@link Identifier#equals(java.lang.Object)}.
// 	 * 
// 	 * @return proxy's identifier
// 	 */
// 	public Identifier getProxyIdentifer();
// 
// 	/**
// 	 * Attempts to cancel the request. If the request has already been completed or cannot successfully be canceled
// 	 * then {@code false} will be returned, otherwise {@code true} will be returned. If the request has already been
// 	 * successfully canceled then this method will have no effect and {@code true} will be returned.
// 	 * 
// 	 * @return if successfully cancelled
// 	 */
// 	public boolean cancel();
// 
// 	/**
// 	 * If the request has been successfully cancelled.
// 	 * 
// 	 * @return if successfully cancelled
// 	 */
// 	public boolean isCancelled();
// 
// 	/**
// 	 * Returns {@code true} if the proxy has been created.
// 	 * 
// 	 * @return if the proxy has been created
// 	 */
// 	public boolean isCompleted();
// }
// 
// Path: src/matlabcontrol/MatlabProxyFactory.java
// public static interface RequestCallback {
// 	/**
// 	 * Called when the proxy has been created. Because requests have no timeout, there is no guarantee that this
// 	 * method will ever be called.
// 	 * 
// 	 * @param proxy 
// 	 */
// 	public void proxyCreated(MatlabProxy proxy);
// }


// Path: src/matlabcontrol/RemoteMatlabProxyFactory.java
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.Writer;
import java.nio.charset.Charset;
import java.rmi.AlreadyBoundException;
import java.rmi.NoSuchObjectException;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.CopyOnWriteArrayList;
import matlabcontrol.MatlabProxy.Identifier;
import matlabcontrol.MatlabProxyFactory.Request;
import matlabcontrol.MatlabProxyFactory.RequestCallback;

					}
				}
			}, RECEIVER_CHECK_PERIOD, RECEIVER_CHECK_PERIOD);
		}

		void shutdown() {
			_timer.cancel();
		}
	}

	private static class GetProxyRequestCallback implements RequestCallback {
		private final Thread _requestingThread;
		private volatile MatlabProxy _proxy;

		public GetProxyRequestCallback() {
			_requestingThread = Thread.currentThread();
		}

		@Override
		public void proxyCreated(MatlabProxy proxy) {
			_proxy = proxy;

			_requestingThread.interrupt();
		}

		public MatlabProxy getProxy() {
			return _proxy;
		}
	}

	private static final class RemoteIdentifier implements Identifier {