This commit is contained in:
Trustin Lee 2009-06-17 10:07:41 +00:00
parent d16639d3ea
commit f40bb1d522
8 changed files with 77 additions and 0 deletions

View File

@ -25,6 +25,8 @@ import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.channel.ChannelSink;
/**
* The default {@link LocalClientChannelFactory} implementation.
*
* @author The Netty Project (netty-dev@lists.jboss.org)
* @author Andy Taylor (andy.taylor@jboss.org)
* @author Trustin Lee (tlee@redhat.com)
@ -34,6 +36,9 @@ public class DefaultLocalClientChannelFactory implements LocalClientChannelFacto
private final ChannelSink sink;
/**
* Creates a new instance.
*/
public DefaultLocalClientChannelFactory() {
sink = new LocalClientChannelSink();
}
@ -42,6 +47,10 @@ public class DefaultLocalClientChannelFactory implements LocalClientChannelFacto
return new DefaultLocalChannel(null, this, pipeline, sink, null);
}
/**
* Does nothing because this implementation does not require any external
* resources.
*/
public void releaseExternalResources() {
// No external resources.
}

View File

@ -25,6 +25,8 @@ import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.channel.ChannelSink;
/**
* The default {@link LocalServerChannelFactory} implementation.
*
* @author The Netty Project (netty-dev@lists.jboss.org)
* @author Andy Taylor (andy.taylor@jboss.org)
* @author Trustin Lee (tlee@redhat.com)
@ -34,6 +36,9 @@ public class DefaultLocalServerChannelFactory implements LocalServerChannelFacto
private final ChannelSink sink = new LocalServerChannelSink();
/**
* Creates a new instance.
*/
public DefaultLocalServerChannelFactory() {
super();
}
@ -42,6 +47,10 @@ public class DefaultLocalServerChannelFactory implements LocalServerChannelFacto
return new DefaultLocalServerChannel(this, pipeline, sink);
}
/**
* Does nothing because this implementation does not require any external
* resources.
*/
public void releaseExternalResources() {
// Unused
}

View File

@ -24,6 +24,16 @@ package org.jboss.netty.channel.local;
import java.net.SocketAddress;
/**
* Represents an endpoint in the local transport. Each endpoint is identified
* by a unique case-insensitive string, except for the pre-defined value called
* {@code "ephemeral"}.
*
* <h3>Ephemeral Address</h3>
*
* An ephemeral address is an anonymous address which is assigned temporarily
* and is released as soon as the connection is closed. All ephemeral addresses
* have the same ID, {@code "ephemeral"}, but they are not equals to each other.
*
* @author The Netty Project (netty-dev@lists.jboss.org)
* @author Andy Taylor (andy.taylor@jboss.org)
* @author Trustin Lee (tlee@redhat.com)
@ -38,10 +48,16 @@ public final class LocalAddress extends SocketAddress implements Comparable<Loca
private final String id;
private final boolean ephemeral;
/**
* Creates a new instance with the specified ID.
*/
public LocalAddress(int id) {
this(String.valueOf(id));
}
/**
* Creates a new instance with the specified ID.
*/
public LocalAddress(String id) {
if (id == null) {
throw new NullPointerException("id");
@ -54,10 +70,16 @@ public final class LocalAddress extends SocketAddress implements Comparable<Loca
ephemeral = id.equals("ephemeral");
}
/**
* Returns the ID of this address.
*/
public String getId() {
return id;
}
/**
* Returns {@code true} if and only if this address is ephemeral.
*/
public boolean isEphemeral() {
return ephemeral;
}
@ -85,6 +107,7 @@ public final class LocalAddress extends SocketAddress implements Comparable<Loca
}
public int compareTo(LocalAddress o) {
// FIXME: Ephemeral port
return getId().compareTo(o.getId());
}

View File

@ -25,6 +25,8 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelConfig;
/**
* A {@link Channel} for the local transport.
*
* @author The Netty Project (netty-dev@lists.jboss.org)
* @author Andy Taylor (andy.taylor@jboss.org)
* @author Trustin Lee (tlee@redhat.com)

View File

@ -25,6 +25,8 @@ import org.jboss.netty.channel.ChannelFactory;
import org.jboss.netty.channel.ChannelPipeline;
/**
* A {@link ChannelFactory} that creates a client-side {@link LocalChannel}.
*
* @author The Netty Project (netty-dev@lists.jboss.org)
* @author Trustin Lee (tlee@redhat.com)
* @version $Rev$, $Date$

View File

@ -25,6 +25,8 @@ import org.jboss.netty.channel.ChannelConfig;
import org.jboss.netty.channel.ServerChannel;
/**
* A {@link ServerChannel} for the local transport.
*
* @author The Netty Project (netty-dev@lists.jboss.org)
* @author Andy Taylor (andy.taylor@jboss.org)
* @author Trustin Lee (tlee@redhat.com)

View File

@ -25,6 +25,8 @@ import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.channel.ServerChannelFactory;
/**
* A {@link ServerChannelFactory} that creates a {@link LocalServerChannel}.
*
* @author The Netty Project (netty-dev@lists.jboss.org)
* @author Trustin Lee (tlee@redhat.com)
* @version $Rev$, $Date$

View File

@ -0,0 +1,28 @@
/*
* JBoss, Home of Professional Open Source
*
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
* by the @author tags. See the COPYRIGHT.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
/**
* A virtual transport that enables the communication between the entities in
* the same virtual machine.
*/
package org.jboss.netty.channel.local;