You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by el...@apache.org on 2009/12/08 13:37:37 UTC

svn commit: r888375 - in /mina/branches/3.0/core/src/main/java/org/apache/mina: ConnectFuture.java IoConnector.java

Author: elecharny
Date: Tue Dec  8 12:37:36 2009
New Revision: 888375

URL: http://svn.apache.org/viewvc?rev=888375&view=rev
Log:
Added a basic IoConnector interface, with a limited set of metjods (IMO, the one which are really necessary)

Added:
    mina/branches/3.0/core/src/main/java/org/apache/mina/ConnectFuture.java
    mina/branches/3.0/core/src/main/java/org/apache/mina/IoConnector.java

Added: mina/branches/3.0/core/src/main/java/org/apache/mina/ConnectFuture.java
URL: http://svn.apache.org/viewvc/mina/branches/3.0/core/src/main/java/org/apache/mina/ConnectFuture.java?rev=888375&view=auto
==============================================================================
--- mina/branches/3.0/core/src/main/java/org/apache/mina/ConnectFuture.java (added)
+++ mina/branches/3.0/core/src/main/java/org/apache/mina/ConnectFuture.java Tue Dec  8 12:37:36 2009
@@ -0,0 +1,39 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ *
+ */
+package org.apache.mina;
+
+
+/**
+ * An {@link IoFuture} for asynchronous connect requests.
+ *
+ * <h3>Example</h3>
+ * <pre>
+ * IoConnector connector = ...;
+ * ConnectFuture future = connector.connect(...);
+ * future.join(); // Wait until the connection attempt is finished.
+ * IoSession session = future.getSession();
+ * session.write(...);
+ * </pre>
+ *
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public interface ConnectFuture extends IoSessionFuture
+{
+}

Added: mina/branches/3.0/core/src/main/java/org/apache/mina/IoConnector.java
URL: http://svn.apache.org/viewvc/mina/branches/3.0/core/src/main/java/org/apache/mina/IoConnector.java?rev=888375&view=auto
==============================================================================
--- mina/branches/3.0/core/src/main/java/org/apache/mina/IoConnector.java (added)
+++ mina/branches/3.0/core/src/main/java/org/apache/mina/IoConnector.java Tue Dec  8 12:37:36 2009
@@ -0,0 +1,63 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ *
+ */
+package org.apache.mina;
+
+
+import java.net.SocketAddress;
+
+
+/**
+ * Connects to endpoint, communicates with the server, and fires events to
+ * {@link IoHandler}s.
+ * 
+ *
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public interface IoConnector extends IoService
+{
+    /**
+     * Returns the connect timeout in milliseconds.  The default value is 1 minute.
+     */
+    long getConnectTimeoutMillis();
+
+
+    /**
+     * Sets the connect timeout in milliseconds.  The default value is 1 minute.
+     */
+    void setConnectTimeoutMillis( long connectTimeoutInMillis );
+
+
+    /**
+     * Connects to the specified remote address.
+     *
+     * @return the {@link ConnectFuture} instance which is completed when the
+     *         connection attempt initiated by this call succeeds or fails.
+     */
+    ConnectFuture connect( SocketAddress remoteAddress );
+
+
+    /**
+     * Connects to the specified remote address binding to the specified local address.
+     *
+     * @return the {@link ConnectFuture} instance which is completed when the
+     *         connection attempt initiated by this call succeeds or fails.
+     */
+    ConnectFuture connect( SocketAddress remoteAddress, SocketAddress localAddress );
+}