read
- * method to get {@see org.activeio.Packet} objects when they arrive from the peer.
- *
- * @version $Revision$
- */
-public interface InputSyncChannel extends Channel {
-
- /**
- * Used to synchronously receive a packet of information going 'up' the channel.
- * This method blocks until a packet is received or the operation experiences timeout.
- *
- * @param timeout
- * @return the packet received or null if the timeout occurred.
- * @throws IOException
- */
- Packet read(long timeout) throws IOException;
-}
diff --git a/activeio/src/java/org/activeio/OutputStreamChannel.java b/activeio/src/java/org/activeio/OutputStreamChannel.java
deleted file mode 100644
index f8e9699a74..0000000000
--- a/activeio/src/java/org/activeio/OutputStreamChannel.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- *
- * Copyright 2004 Hiram Chirino
- *
- * 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.
- */
-
-package org.activeio;
-
-import java.io.IOException;
-
-/**
- * @version $Revision$
- */
-public interface OutputStreamChannel extends Channel {
-
- public void write(byte[] data, int pos, int length) throws IOException;
- public void write(byte[] data) throws IOException;
- public void write(int data) throws IOException;
-
- /**
- * Some channels may buffer data which may be sent down if flush() is called.
- *
- * @throws IOException
- */
- void flush() throws IOException;
-}
diff --git a/activeio/src/java/org/activeio/RequestChannel.java b/activeio/src/java/org/activeio/RequestChannel.java
deleted file mode 100644
index d5985d437e..0000000000
--- a/activeio/src/java/org/activeio/RequestChannel.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- *
- * Copyright 2004 Hiram Chirino
- *
- * 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.
- */
-
-package org.activeio;
-
-import java.io.IOException;
-
-
-/**
- * RequestChannel are used to model the request/reponse exchange that is used
- * by higher level protcols such as HTTP and RMI.
- *
- * @version $Revision$
- */
-public interface RequestChannel extends Channel {
-
- /**
- * Used to send a packet of information going 'down' the channel and wait for
- * it's reponse 'up' packet.
- *
- * This method blocks until the response packet is received or the operation
- * experiences a timeout.
- *
- * @param request
- * @param timeout
- * @return the respnse packet or null if the timeout occured.
- * @throws IOException
- */
- Packet request(Packet request, long timeout) throws IOException;
-
- /**
- * Registers the {@see RequestListener} that the protcol will use to deliver request packets
- * comming 'up' the channel.
- *
- * @param packetListener
- * @throws IOException
- */
- void setRequestListener(RequestListener requestListener) throws IOException;
-
- /**
- * @return the registered RequestListener
- */
- RequestListener getRequestListener();
-
-}
diff --git a/activeio/src/java/org/activeio/RequestListener.java b/activeio/src/java/org/activeio/RequestListener.java
deleted file mode 100644
index bcb3439b19..0000000000
--- a/activeio/src/java/org/activeio/RequestListener.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- *
- * Copyright 2004 Hiram Chirino
- *
- * 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.
- */
-package org.activeio;
-
-import java.io.IOException;
-
-
-/**
- * An RequestListener object is used to receive remote requests from a a {@see org.activeio.RequestChannel}
- *
- * @version $Revision$
- */
-public interface RequestListener {
-
- /**
- * A {@see RequestChannel} will call this method when a new request arrives.
- *
- * @param packet
- */
- Packet onRequest(Packet request);
-
- /**
- * A {@see RequestChannel} will call this method when a async failure occurs when receiving a request.
- *
- * @param error the exception that describes the failure.
- */
- void onRquestError(IOException error);
-}
\ No newline at end of file
diff --git a/activeio/src/java/org/activeio/Service.java b/activeio/src/java/org/activeio/Service.java
index 64d2b8a8d8..ac3a6054c2 100644
--- a/activeio/src/java/org/activeio/Service.java
+++ b/activeio/src/java/org/activeio/Service.java
@@ -43,11 +43,14 @@ public interface Service {
/**
* Stops the channel. Once stopped, the channel is in the stopped state.
*
- * @param timeout The amount of time the channel is allowed to take to gracefully stop. If the timeout
- * is exceeded, the channel should do a forcefull stop.
- *
* @throws IOException
*/
- void stop(long timeout) throws IOException;
+ void stop() throws IOException;
+ /**
+ * Disposes the channel. Once disposed, the channel cannot be used anymore.
+ *
+ * @throws IOException
+ */
+ void dispose();
}
diff --git a/activeio/src/java/org/activeio/StreamChannel.java b/activeio/src/java/org/activeio/StreamChannel.java
deleted file mode 100644
index a676c27f5e..0000000000
--- a/activeio/src/java/org/activeio/StreamChannel.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- *
- * Copyright 2004 Hiram Chirino
- *
- * 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.
- */
-
-package org.activeio;
-
-/**
- * @version $Revision$
- */
-public interface StreamChannel extends OutputStreamChannel, InputStreamChannel {
-}
diff --git a/activeio/src/java/org/activeio/SyncChannel.java b/activeio/src/java/org/activeio/SyncChannel.java
deleted file mode 100644
index e183986076..0000000000
--- a/activeio/src/java/org/activeio/SyncChannel.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- *
- * Copyright 2004 Hiram Chirino
- *
- * 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.
- */
-
-package org.activeio;
-
-/**
- * SyncChannel objets allow threadd to synchronously block on the receiveUpPacket
- * method to get 'up' {@see org.activeio.Packet} objects when they arrive.
- *
- * @version $Revision$
- */
-public interface SyncChannel extends OutputChannel, InputSyncChannel {
-}
diff --git a/activeio/src/java/org/activeio/adapter/AsyncChannelToClientRequestChannel.java b/activeio/src/java/org/activeio/adapter/AsyncChannelToClientRequestChannel.java
deleted file mode 100644
index 401a0f8e88..0000000000
--- a/activeio/src/java/org/activeio/adapter/AsyncChannelToClientRequestChannel.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- *
- * Copyright 2004 Hiram Chirino
- *
- * 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.
- */
-package org.activeio.adapter;
-
-import java.io.IOException;
-
-import org.activeio.Packet;
-import org.activeio.RequestChannel;
-import org.activeio.RequestListener;
-import org.activeio.SyncChannel;
-
-
-/**
- * Creates a {@see org.activeio.RequestChannel} out of a {@see org.activeio.SyncChannel}.
- * Does not support handing requests. It can only be used to send requests.
- *
- * @version $Revision$
- */
-final public class AsyncChannelToClientRequestChannel implements RequestChannel {
-
- private final SyncChannel next;
-
- public AsyncChannelToClientRequestChannel(SyncChannel next) {
- this.next = next;
- }
-
- public Packet request(Packet request, long timeout) throws IOException {
- next.write(request);
- next.flush();
- return next.read(timeout);
- }
-
- public void setRequestListener(RequestListener requestListener) throws IOException {
- throw new IOException("Operation not supported.");
- }
-
- public RequestListener getRequestListener() {
- return null;
- }
-
- public Object getAdapter(Class target) {
- return next.getAdapter(target);
- }
-
- public void dispose() {
- next.dispose();
- }
-
- public void start() throws IOException {
- next.start();
- }
-
- public void stop(long timeout) throws IOException {
- next.stop(timeout);
- }
-}
diff --git a/activeio/src/java/org/activeio/adapter/AsyncChannelToConcurrentRequestChannel.java b/activeio/src/java/org/activeio/adapter/AsyncChannelToConcurrentRequestChannel.java
deleted file mode 100644
index fd07facb76..0000000000
--- a/activeio/src/java/org/activeio/adapter/AsyncChannelToConcurrentRequestChannel.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/**
- *
- * Copyright 2004 Hiram Chirino
- *
- * 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.
- */
-package org.activeio.adapter;
-
-import java.io.IOException;
-import java.io.InterruptedIOException;
-
-import org.activeio.AsyncChannel;
-import org.activeio.ChannelFactory;
-import org.activeio.FilterAsyncChannel;
-import org.activeio.Packet;
-import org.activeio.PacketData;
-import org.activeio.RequestChannel;
-import org.activeio.RequestListener;
-import org.activeio.packet.AppendedPacket;
-import org.activeio.packet.ByteArrayPacket;
-
-import edu.emory.mathcs.backport.java.util.concurrent.ArrayBlockingQueue;
-import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap;
-import edu.emory.mathcs.backport.java.util.concurrent.Executor;
-import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
-
-
-/**
- * Creates a {@see org.activeio.RequestChannel} out of a {@see org.activeio.AsyncChannel}. This
- * {@see org.activeio.RequestChannel} is thread safe and mutiplexes concurrent requests and responses over
- * the underlying {@see org.activeio.AsyncChannel}.
- *
- * @version $Revision$
- */
-final public class AsyncChannelToConcurrentRequestChannel extends FilterAsyncChannel implements RequestChannel {
-
- private static final byte PASSTHROUGH = 0x00;
- private static final byte REQUEST = 0x01;
- private static final byte RESPONSE = 0x02;
- private static final ByteArrayPacket PASSTHROUGH_PACKET = new ByteArrayPacket(new byte[]{PASSTHROUGH});
-
- private final ConcurrentHashMap requestMap = new ConcurrentHashMap();
- private final Executor requestExecutor;
- private short nextRequestId = 0;
- private final Object writeMutex = new Object();
-
- private RequestListener requestListener;
-
- public AsyncChannelToConcurrentRequestChannel(AsyncChannel next) {
- this(next, ChannelFactory.DEFAULT_EXECUTOR);
- }
-
- public AsyncChannelToConcurrentRequestChannel(AsyncChannel next, Executor requestExecutor) {
- super(next);
- this.requestExecutor=requestExecutor;
- }
-
- synchronized short getNextRequestId() {
- return nextRequestId++;
- }
-
- /**
- * @see org.activeio.FilterAsyncChannel#write(org.activeio.Packet)
- */
- public void write(Packet packet) throws IOException {
- Packet passThrough = AppendedPacket.join(PASSTHROUGH_PACKET.duplicate(), packet);
- synchronized(writeMutex) {
- super.write(passThrough);
- }
- }
-
- /**
- * @see org.activeio.FilterAsyncChannel#onPacket(org.activeio.Packet)
- */
- public void onPacket(final Packet packet) {
- switch( packet.read() ) {
- case PASSTHROUGH:
- super.onPacket(packet);
- break;
- case REQUEST:
- requestExecutor.execute(new Runnable(){
- public void run() {
- serviceRequest(packet);
- }
- });
- break;
- case RESPONSE:
- serviceReponse(packet);
- break;
- }
- }
-
- private void serviceRequest(Packet packet) {
- try {
- if( requestListener ==null )
- throw new IOException("The RequestListener has not been set.");
-
- PacketData data = new PacketData(packet);
- short requestId = data.readShort();
- Packet reponse = requestListener.onRequest(packet);
-
- // Send the response...
- Packet header = createHeaderPacket(RESPONSE, requestId);
- Packet rc = AppendedPacket.join(header, packet);
- synchronized(writeMutex) {
- super.write(rc);
- }
- } catch (IOException e) {
- super.onPacketError(e);
- }
-
- }
-
- private void serviceReponse(Packet packet) {
-
- try {
-
- PacketData data = new PacketData(packet);
- short requestId = data.readShort();
-
- ArrayBlockingQueue responseSlot = (ArrayBlockingQueue) requestMap.get(new Short(requestId));
- responseSlot.put(packet);
-
- } catch (IOException e) {
- super.onPacketError(e);
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- }
-
-
- }
-
- public Packet request(Packet request, long timeout) throws IOException {
-
- Short requestId = new Short(getNextRequestId());
- ArrayBlockingQueue responseSlot = new ArrayBlockingQueue(1);
- requestMap.put(requestId, responseSlot);
-
- Packet header = createHeaderPacket(REQUEST, requestId.shortValue());
- Packet packet = AppendedPacket.join(header, request);
-
- synchronized(writeMutex) {
- super.write(packet);
- }
-
- try {
-
- if( timeout == WAIT_FOREVER_TIMEOUT ) {
- return (Packet) responseSlot.take();
- } else if (timeout == NO_WAIT_TIMEOUT ) {
- return (Packet) responseSlot.poll(1, TimeUnit.MILLISECONDS);
- } else {
- return (Packet) responseSlot.poll(timeout, TimeUnit.MILLISECONDS);
- }
-
- } catch (InterruptedException e) {
- throw new InterruptedIOException(e.getMessage());
- } finally {
- requestMap.remove(requestId);
- }
- }
-
- private Packet createHeaderPacket(byte type, short requestId) throws IOException {
- ByteArrayPacket header = new ByteArrayPacket(new byte[]{3});
- PacketData data = new PacketData(header);
- data.writeByte(type);
- data.writeShort(requestId);
- header.flip();
- return header;
- }
-
- public void setRequestListener(RequestListener requestListener) throws IOException {
- this.requestListener = requestListener;
- }
-
- public RequestListener getRequestListener() {
- return requestListener;
- }
-}
diff --git a/activeio/src/java/org/activeio/adapter/AsyncChannelToOutputStream.java b/activeio/src/java/org/activeio/adapter/AsyncChannelToOutputStream.java
index 3ec56ccc71..b3eca50f0c 100644
--- a/activeio/src/java/org/activeio/adapter/AsyncChannelToOutputStream.java
+++ b/activeio/src/java/org/activeio/adapter/AsyncChannelToOutputStream.java
@@ -19,9 +19,9 @@ package org.activeio.adapter;
import java.io.IOException;
import java.io.OutputStream;
-import org.activeio.AsyncChannel;
import org.activeio.packet.ByteArrayPacket;
import org.activeio.packet.BytePacket;
+import org.activeio.packet.async.AsyncChannel;
/**
*/
diff --git a/activeio/src/java/org/activeio/adapter/AsyncChannelToServerRequestChannel.java b/activeio/src/java/org/activeio/adapter/AsyncChannelToServerRequestChannel.java
deleted file mode 100644
index 379abba117..0000000000
--- a/activeio/src/java/org/activeio/adapter/AsyncChannelToServerRequestChannel.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- *
- * Copyright 2004 Hiram Chirino
- *
- * 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.
- */
-package org.activeio.adapter;
-
-import java.io.IOException;
-
-import org.activeio.AsyncChannel;
-import org.activeio.AsyncChannelListener;
-import org.activeio.Packet;
-import org.activeio.RequestChannel;
-import org.activeio.RequestListener;
-import org.activeio.packet.EOSPacket;
-
-
-/**
- * Creates a {@see org.activeio.RequestChannel} out of a {@see org.activeio.AsyncChannel}.
- * Does not support sending requests. It can only be used to handle requests.
- *
- * @version $Revision$
- */
-public class AsyncChannelToServerRequestChannel implements RequestChannel, AsyncChannelListener {
-
- private final AsyncChannel next;
- private RequestListener requestListener;
-
- public AsyncChannelToServerRequestChannel(AsyncChannel next) throws IOException {
- this.next = next;
- next.setAsyncChannelListener(this);
- }
-
- public Packet request(Packet request, long timeout) throws IOException {
- throw new IOException("Operation not supported.");
- }
-
- public void setRequestListener(RequestListener requestListener) throws IOException {
- this.requestListener = requestListener;
- }
-
- public RequestListener getRequestListener() {
- return requestListener;
- }
-
- public Object getAdapter(Class target) {
- return next.getAdapter(target);
- }
-
- public void dispose() {
- next.dispose();
- }
-
- public void start() throws IOException {
- next.start();
- }
-
- public void stop(long timeout) throws IOException {
- next.stop(timeout);
- }
-
- public void onPacket(Packet packet) {
- if( packet == EOSPacket.EOS_PACKET ) {
- return;
- }
- try {
- Packet response = requestListener.onRequest(packet);
- next.write(response);
- next.flush();
- } catch (IOException e) {
- requestListener.onRquestError(e);
- }
- }
-
- public void onPacketError(IOException error) {
- requestListener.onRquestError(error);
- }
-}
diff --git a/activeio/src/java/org/activeio/adapter/AsyncToSyncChannel.java b/activeio/src/java/org/activeio/adapter/AsyncToSyncChannel.java
index 89e09a6095..cd8cebd2b9 100644
--- a/activeio/src/java/org/activeio/adapter/AsyncToSyncChannel.java
+++ b/activeio/src/java/org/activeio/adapter/AsyncToSyncChannel.java
@@ -20,10 +20,10 @@ package org.activeio.adapter;
import java.io.IOException;
import java.io.InterruptedIOException;
-import org.activeio.AsyncChannel;
-import org.activeio.AsyncChannelListener;
-import org.activeio.Packet;
-import org.activeio.SyncChannel;
+import org.activeio.packet.Packet;
+import org.activeio.packet.async.AsyncChannel;
+import org.activeio.packet.async.AsyncChannelListener;
+import org.activeio.packet.sync.SyncChannel;
import edu.emory.mathcs.backport.java.util.concurrent.BlockingQueue;
import edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue;
@@ -79,9 +79,9 @@ final public class AsyncToSyncChannel implements SyncChannel, AsyncChannelListen
}
/**
- * @see org.activeio.Channel#write(org.activeio.Packet)
+ * @see org.activeio.Channel#write(org.activeio.packet.Packet)
*/
- public void write(org.activeio.Packet packet) throws IOException {
+ public void write(org.activeio.packet.Packet packet) throws IOException {
asyncChannel.write(packet);
}
@@ -93,7 +93,7 @@ final public class AsyncToSyncChannel implements SyncChannel, AsyncChannelListen
}
/**
- * @see org.activeio.SyncChannel#read(long)
+ * @see org.activeio.packet.sync.SyncChannel#read(long)
*/
public Packet read(long timeout) throws IOException {
try {
@@ -136,14 +136,14 @@ final public class AsyncToSyncChannel implements SyncChannel, AsyncChannelListen
}
/**
- * @see org.activeio.Service#stop(long)
+ * @see org.activeio.Service#stop()
*/
- public void stop(long timeout) throws IOException {
- asyncChannel.stop(timeout);
+ public void stop() throws IOException {
+ asyncChannel.stop();
}
/**
- * @see org.activeio.AsyncChannelListener#onPacket(org.activeio.Packet)
+ * @see org.activeio.packet.async.AsyncChannelListener#onPacket(org.activeio.packet.Packet)
*/
public void onPacket(Packet packet) {
try {
@@ -154,7 +154,7 @@ final public class AsyncToSyncChannel implements SyncChannel, AsyncChannelListen
}
/**
- * @see org.activeio.AsyncChannelListener#onPacketError(org.activeio.ChannelException)
+ * @see org.activeio.packet.async.AsyncChannelListener#onPacketError(org.activeio.ChannelException)
*/
public void onPacketError(IOException error) {
try {
diff --git a/activeio/src/java/org/activeio/adapter/AsyncToSyncChannelFactory.java b/activeio/src/java/org/activeio/adapter/AsyncToSyncChannelFactory.java
index ef4f898d09..ec91053116 100644
--- a/activeio/src/java/org/activeio/adapter/AsyncToSyncChannelFactory.java
+++ b/activeio/src/java/org/activeio/adapter/AsyncToSyncChannelFactory.java
@@ -20,10 +20,10 @@ package org.activeio.adapter;
import java.io.IOException;
import java.net.URI;
-import org.activeio.AsyncChannelFactory;
-import org.activeio.SyncChannel;
-import org.activeio.SyncChannelFactory;
-import org.activeio.SyncChannelServer;
+import org.activeio.packet.async.AsyncChannelFactory;
+import org.activeio.packet.sync.SyncChannel;
+import org.activeio.packet.sync.SyncChannelFactory;
+import org.activeio.packet.sync.SyncChannelServer;
/**
* @version $Revision$
diff --git a/activeio/src/java/org/activeio/adapter/AsyncToSyncChannelServer.java b/activeio/src/java/org/activeio/adapter/AsyncToSyncChannelServer.java
index 8fe8d1fa54..e5db8088cd 100644
--- a/activeio/src/java/org/activeio/adapter/AsyncToSyncChannelServer.java
+++ b/activeio/src/java/org/activeio/adapter/AsyncToSyncChannelServer.java
@@ -22,10 +22,10 @@ import java.io.InterruptedIOException;
import java.net.URI;
import org.activeio.AcceptListener;
-import org.activeio.AsyncChannelServer;
import org.activeio.Channel;
import org.activeio.ChannelServer;
-import org.activeio.SyncChannelServer;
+import org.activeio.packet.async.AsyncChannelServer;
+import org.activeio.packet.sync.SyncChannelServer;
import edu.emory.mathcs.backport.java.util.concurrent.BlockingQueue;
import edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue;
@@ -82,7 +82,7 @@ final public class AsyncToSyncChannelServer implements SyncChannelServer, Accept
}
/**
- * @see org.activeio.SyncChannelServer#accept(long)
+ * @see org.activeio.packet.sync.SyncChannelServer#accept(long)
*/
public org.activeio.Channel accept(long timeout) throws IOException {
try {
@@ -124,10 +124,10 @@ final public class AsyncToSyncChannelServer implements SyncChannelServer, Accept
}
/**
- * @see org.activeio.Service#stop(long)
+ * @see org.activeio.Service#stop()
*/
- public void stop(long timeout) throws IOException {
- asyncChannelServer.stop(timeout);
+ public void stop() throws IOException {
+ asyncChannelServer.stop();
}
public URI getBindURI() {
diff --git a/activeio/src/java/org/activeio/adapter/InputStreamChannelToInputStream.java b/activeio/src/java/org/activeio/adapter/InputStreamChannelToInputStream.java
deleted file mode 100644
index 0b88d6572b..0000000000
--- a/activeio/src/java/org/activeio/adapter/InputStreamChannelToInputStream.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
-*
-* Copyright 2004 Hiram Chirino
-*
-* 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.
-*/
-package org.activeio.adapter;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.activeio.InputStreamChannel;
-
-/**
- * Provides an InputStream for a given InputStreamChannel.
- *
- * @version $Revision$
- */
-public class InputStreamChannelToInputStream extends InputStream {
-
- private final InputStreamChannel channel;
-
- /**
- * @param channel
- */
- public InputStreamChannelToInputStream(final InputStreamChannel channel) {
- this.channel = channel;
- }
-
- public int available() throws IOException {
- return channel.available();
- }
-
- public synchronized void mark(int arg0) {
- channel.mark(arg0);
- }
-
- public boolean markSupported() {
- return channel.markSupported();
- }
-
- public int read(byte[] arg0) throws IOException {
- return channel.read(arg0);
- }
-
- public synchronized void reset() throws IOException {
- channel.reset();
- }
-
- public long skip(long arg0) throws IOException {
- return channel.skip(arg0);
- }
-
- /**
- * @see java.io.InputStream#read()
- */
- public int read() throws IOException {
- return channel.read();
- }
-
- /**
- * @see java.io.InputStream#read(byte[], int, int)
- */
- public int read(byte[] b, int off, int len) throws IOException {
- return channel.read(b,off,len);
- }
-
- /**
- * @see java.io.InputStream#close()
- */
- public void close() throws IOException {
- channel.dispose();
- super.close();
- }
-}
diff --git a/activeio/src/java/org/activeio/adapter/OutputStreamChannelToOutputStream.java b/activeio/src/java/org/activeio/adapter/OutputStreamChannelToOutputStream.java
deleted file mode 100644
index f7453e53e1..0000000000
--- a/activeio/src/java/org/activeio/adapter/OutputStreamChannelToOutputStream.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- *
- * Copyright 2004 Hiram Chirino
- *
- * 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.
- */
-package org.activeio.adapter;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-import org.activeio.OutputStreamChannel;
-
-/**
- */
-public class OutputStreamChannelToOutputStream extends OutputStream {
-
- private final OutputStreamChannel channel;
-
- /**
- * @param channel
- */
- public OutputStreamChannelToOutputStream(OutputStreamChannel channel) {
- this.channel = channel;
- }
-
- /**
- * @see java.io.OutputStream#write(int)
- */
- public void write(int b) throws IOException {
- channel.write(b);
- }
-
- /**
- * @see java.io.OutputStream#write(byte[], int, int)
- */
- public void write(byte[] b, int off, int len) throws IOException {
- channel.write(b, off, len);
- }
-
- /**
- * @see java.io.OutputStream#flush()
- */
- public void flush() throws IOException {
- channel.flush();
- }
-
- public void write(byte[] b) throws IOException {
- channel.write(b);
- }
-
- /**
- * @see java.io.InputStream#close()
- */
- public void close() throws IOException {
- channel.dispose();
- super.close();
- }
-
-}
diff --git a/activeio/src/java/org/activeio/adapter/PacketByteArrayOutputStream.java b/activeio/src/java/org/activeio/adapter/PacketByteArrayOutputStream.java
index e3d0370a53..ff2e952ac7 100644
--- a/activeio/src/java/org/activeio/adapter/PacketByteArrayOutputStream.java
+++ b/activeio/src/java/org/activeio/adapter/PacketByteArrayOutputStream.java
@@ -20,9 +20,9 @@ package org.activeio.adapter;
import java.io.IOException;
import java.io.OutputStream;
-import org.activeio.Packet;
import org.activeio.packet.AppendedPacket;
import org.activeio.packet.ByteArrayPacket;
+import org.activeio.packet.Packet;
/**
*
diff --git a/activeio/src/java/org/activeio/adapter/PacketInputStream.java b/activeio/src/java/org/activeio/adapter/PacketInputStream.java
index e1371e6a47..04f5c454fb 100644
--- a/activeio/src/java/org/activeio/adapter/PacketInputStream.java
+++ b/activeio/src/java/org/activeio/adapter/PacketInputStream.java
@@ -16,7 +16,7 @@
*/
package org.activeio.adapter;
-import org.activeio.Packet;
+import org.activeio.packet.Packet;
/**
* @deprecated Use PacketToInputStream instead. This class will be removed very soon.
diff --git a/activeio/src/java/org/activeio/adapter/PacketOutputStream.java b/activeio/src/java/org/activeio/adapter/PacketOutputStream.java
index f960c48b44..5f90e50631 100644
--- a/activeio/src/java/org/activeio/adapter/PacketOutputStream.java
+++ b/activeio/src/java/org/activeio/adapter/PacketOutputStream.java
@@ -19,7 +19,7 @@ package org.activeio.adapter;
import java.io.IOException;
import java.io.OutputStream;
-import org.activeio.Packet;
+import org.activeio.packet.Packet;
/**
* Provides an OutputStream for a given Packet.
diff --git a/activeio/src/java/org/activeio/adapter/PacketToInputStream.java b/activeio/src/java/org/activeio/adapter/PacketToInputStream.java
index 3594e290d6..01cb461bd1 100644
--- a/activeio/src/java/org/activeio/adapter/PacketToInputStream.java
+++ b/activeio/src/java/org/activeio/adapter/PacketToInputStream.java
@@ -19,7 +19,7 @@ package org.activeio.adapter;
import java.io.IOException;
import java.io.InputStream;
-import org.activeio.Packet;
+import org.activeio.packet.Packet;
/**
* Provides an InputStream for a given Packet.
diff --git a/activeio/src/java/org/activeio/adapter/SyncChannelServerToServerSocket.java b/activeio/src/java/org/activeio/adapter/SyncChannelServerToServerSocket.java
index 0fba55f3b2..a034efd484 100644
--- a/activeio/src/java/org/activeio/adapter/SyncChannelServerToServerSocket.java
+++ b/activeio/src/java/org/activeio/adapter/SyncChannelServerToServerSocket.java
@@ -28,8 +28,8 @@ import java.net.URI;
import java.nio.channels.ServerSocketChannel;
import org.activeio.Channel;
-import org.activeio.SyncChannel;
-import org.activeio.SyncChannelServer;
+import org.activeio.packet.sync.SyncChannel;
+import org.activeio.packet.sync.SyncChannelServer;
/**
*/
@@ -91,12 +91,6 @@ public class SyncChannelServerToServerSocket extends ServerSocket {
throw new SocketException("Already bound");
}
- public void close() throws IOException {
- if (!isClosed()) {
- channelServer.dispose();
- }
- }
-
public ServerSocketChannel getChannel() {
return null;
}
diff --git a/activeio/src/java/org/activeio/adapter/SyncChannelToInputStream.java b/activeio/src/java/org/activeio/adapter/SyncChannelToInputStream.java
index 09230545c4..ac575fd8c9 100644
--- a/activeio/src/java/org/activeio/adapter/SyncChannelToInputStream.java
+++ b/activeio/src/java/org/activeio/adapter/SyncChannelToInputStream.java
@@ -20,9 +20,9 @@ import java.io.IOException;
import java.io.InputStream;
import org.activeio.Channel;
-import org.activeio.Packet;
-import org.activeio.SyncChannel;
import org.activeio.packet.EOSPacket;
+import org.activeio.packet.Packet;
+import org.activeio.packet.sync.SyncChannel;
/**
* Provides an InputStream for a given SynchChannel.
diff --git a/activeio/src/java/org/activeio/adapter/SyncChannelToOutputStream.java b/activeio/src/java/org/activeio/adapter/SyncChannelToOutputStream.java
index d7297274f9..54bd344963 100644
--- a/activeio/src/java/org/activeio/adapter/SyncChannelToOutputStream.java
+++ b/activeio/src/java/org/activeio/adapter/SyncChannelToOutputStream.java
@@ -19,9 +19,9 @@ package org.activeio.adapter;
import java.io.IOException;
import java.io.OutputStream;
-import org.activeio.SyncChannel;
import org.activeio.packet.ByteArrayPacket;
import org.activeio.packet.BytePacket;
+import org.activeio.packet.sync.SyncChannel;
/**
*/
diff --git a/activeio/src/java/org/activeio/adapter/SyncChannelToSocket.java b/activeio/src/java/org/activeio/adapter/SyncChannelToSocket.java
index ce8b21b2a1..8b1ebd92fd 100644
--- a/activeio/src/java/org/activeio/adapter/SyncChannelToSocket.java
+++ b/activeio/src/java/org/activeio/adapter/SyncChannelToSocket.java
@@ -25,10 +25,10 @@ import java.net.SocketAddress;
import java.net.SocketException;
import java.nio.channels.SocketChannel;
-import org.activeio.Packet;
-import org.activeio.SyncChannel;
-import org.activeio.net.SocketMetadata;
import org.activeio.packet.ByteArrayPacket;
+import org.activeio.packet.Packet;
+import org.activeio.packet.sync.SyncChannel;
+import org.activeio.stream.sync.socket.SocketMetadata;
/**
* Provides a {@see java.net.Socket} interface to a {@see org.activeio.SynchChannel}.
@@ -80,7 +80,7 @@ public class SyncChannelToSocket extends Socket {
closed = true;
inputStream.close();
outputStream.close();
- channel.dispose();
+ channel.stop();
}
public void connect(SocketAddress endpoint) throws IOException {
diff --git a/activeio/src/java/org/activeio/adapter/SyncToAsyncChannel.java b/activeio/src/java/org/activeio/adapter/SyncToAsyncChannel.java
index e7d06d89c7..933c9cfaff 100644
--- a/activeio/src/java/org/activeio/adapter/SyncToAsyncChannel.java
+++ b/activeio/src/java/org/activeio/adapter/SyncToAsyncChannel.java
@@ -22,14 +22,13 @@ import edu.emory.mathcs.backport.java.util.concurrent.Executor;
import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean;
-import org.activeio.AsyncChannel;
-import org.activeio.AsyncChannelListener;
import org.activeio.Channel;
import org.activeio.ChannelFactory;
-import org.activeio.Packet;
-import org.activeio.Service;
-import org.activeio.SyncChannel;
import org.activeio.packet.EOSPacket;
+import org.activeio.packet.Packet;
+import org.activeio.packet.async.AsyncChannel;
+import org.activeio.packet.async.AsyncChannelListener;
+import org.activeio.packet.sync.SyncChannel;
import java.io.IOException;
@@ -100,34 +99,13 @@ public class SyncToAsyncChannel implements AsyncChannel, Runnable {
}
}
- synchronized public void stop(long timeout) throws IOException {
+ synchronized public void stop() throws IOException {
if (running.compareAndSet(true, false)) {
try {
- if( timeout == NO_WAIT_TIMEOUT ) {
- syncChannel.stop(NO_WAIT_TIMEOUT);
- } else if( timeout == WAIT_FOREVER_TIMEOUT ) {
- doneCountDownLatch.await();
- syncChannel.stop(WAIT_FOREVER_TIMEOUT);
- } else {
-
- long start = System.currentTimeMillis();
- if( doneCountDownLatch.await(timeout, TimeUnit.MILLISECONDS) ) {
- timeout -= (System.currentTimeMillis() - start);
- } else {
- timeout=0;
- }
-
- if( timeout <= 0 ) {
- syncChannel.stop(NO_WAIT_TIMEOUT);
- } else {
- syncChannel.stop(timeout);
- }
- }
- } catch (IOException e) {
- throw e;
+ doneCountDownLatch.await(5, TimeUnit.SECONDS);
} catch (Throwable e) {
- throw (IOException)new IOException("stop failed: " + e.getMessage()).initCause(e);
}
+ syncChannel.stop();
}
}
@@ -169,7 +147,7 @@ public class SyncToAsyncChannel implements AsyncChannel, Runnable {
}
/**
- * @see org.activeio.AsyncChannel#setAsyncChannelListener(org.activeio.UpPacketListener)
+ * @see org.activeio.packet.async.AsyncChannel#setAsyncChannelListener(org.activeio.UpPacketListener)
*/
public void setAsyncChannelListener(AsyncChannelListener channelListener) {
if (running.get())
@@ -178,9 +156,9 @@ public class SyncToAsyncChannel implements AsyncChannel, Runnable {
}
/**
- * @see org.activeio.Channel#write(org.activeio.Packet)
+ * @see org.activeio.Channel#write(org.activeio.packet.Packet)
*/
- public void write(org.activeio.Packet packet) throws IOException {
+ public void write(org.activeio.packet.Packet packet) throws IOException {
syncChannel.write(packet);
}
@@ -196,7 +174,7 @@ public class SyncToAsyncChannel implements AsyncChannel, Runnable {
*/
public void dispose() {
try {
- stop(Service.NO_WAIT_TIMEOUT);
+ stop();
} catch ( IOException ignore) {
}
syncChannel.dispose();
diff --git a/activeio/src/java/org/activeio/adapter/SyncToAsyncChannelFactory.java b/activeio/src/java/org/activeio/adapter/SyncToAsyncChannelFactory.java
index 9a824fc327..8cc0499d00 100644
--- a/activeio/src/java/org/activeio/adapter/SyncToAsyncChannelFactory.java
+++ b/activeio/src/java/org/activeio/adapter/SyncToAsyncChannelFactory.java
@@ -20,11 +20,11 @@ package org.activeio.adapter;
import java.io.IOException;
import java.net.URI;
-import org.activeio.AsyncChannel;
-import org.activeio.AsyncChannelFactory;
-import org.activeio.AsyncChannelServer;
import org.activeio.ChannelFactory;
-import org.activeio.SyncChannelFactory;
+import org.activeio.packet.async.AsyncChannel;
+import org.activeio.packet.async.AsyncChannelFactory;
+import org.activeio.packet.async.AsyncChannelServer;
+import org.activeio.packet.sync.SyncChannelFactory;
import edu.emory.mathcs.backport.java.util.concurrent.Executor;
diff --git a/activeio/src/java/org/activeio/adapter/SyncToAsyncChannelServer.java b/activeio/src/java/org/activeio/adapter/SyncToAsyncChannelServer.java
index 509fea890f..c8249743b7 100644
--- a/activeio/src/java/org/activeio/adapter/SyncToAsyncChannelServer.java
+++ b/activeio/src/java/org/activeio/adapter/SyncToAsyncChannelServer.java
@@ -18,23 +18,21 @@
package org.activeio.adapter;
+import java.io.IOException;
+import java.net.URI;
+
+import org.activeio.AcceptListener;
+import org.activeio.Channel;
+import org.activeio.ChannelFactory;
+import org.activeio.ChannelServer;
+import org.activeio.packet.async.AsyncChannelServer;
+import org.activeio.packet.sync.SyncChannelServer;
+
import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch;
import edu.emory.mathcs.backport.java.util.concurrent.Executor;
import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean;
-import org.activeio.AcceptListener;
-import org.activeio.AsyncChannelServer;
-import org.activeio.Channel;
-import org.activeio.ChannelFactory;
-import org.activeio.ChannelServer;
-import org.activeio.Disposable;
-import org.activeio.Service;
-import org.activeio.SyncChannelServer;
-
-import java.io.IOException;
-import java.net.URI;
-
/**
* Adapts a {@see org.activeio,SynchChannelServer} so that it provides an
* {@see org.activeio.AsyncChannelServer} interface. When this channel
@@ -93,36 +91,13 @@ final public class SyncToAsyncChannelServer implements AsyncChannelServer, Runna
}
}
- synchronized public void stop(long timeout) throws IOException {
+ synchronized public void stop() throws IOException {
if (running.compareAndSet(true, false)) {
try {
-
- if( timeout == NO_WAIT_TIMEOUT ) {
- syncChannelServer.stop(NO_WAIT_TIMEOUT);
- } else if( timeout == WAIT_FOREVER_TIMEOUT ) {
- doneCountDownLatch.await();
- syncChannelServer.stop(WAIT_FOREVER_TIMEOUT);
- } else {
-
- long start = System.currentTimeMillis();
- if( doneCountDownLatch.await(timeout, TimeUnit.MILLISECONDS) ) {
- timeout -= (System.currentTimeMillis() - start);
- } else {
- timeout=0;
- }
-
- if( timeout <= 0 ) {
- syncChannelServer.stop(NO_WAIT_TIMEOUT);
- } else {
- syncChannelServer.stop(timeout);
- }
- }
-
- } catch (IOException e) {
- throw e;
+ doneCountDownLatch.await(5, TimeUnit.SECONDS);
} catch (Throwable e) {
- throw (IOException)new IOException("stop failed: " + e.getMessage()).initCause(e);
}
+ syncChannelServer.stop();
}
}
@@ -153,7 +128,7 @@ final public class SyncToAsyncChannelServer implements AsyncChannelServer, Runna
}
/**
- * @see org.activeio.AsyncChannelServer#setAcceptListener(org.activeio.AcceptListener)
+ * @see org.activeio.packet.async.AsyncChannelServer#setAcceptListener(org.activeio.AcceptListener)
*/
public void setAcceptListener(AcceptListener acceptListener) {
if(running.get())
@@ -166,12 +141,10 @@ final public class SyncToAsyncChannelServer implements AsyncChannelServer, Runna
*/
public void dispose() {
try {
- stop(Service.NO_WAIT_TIMEOUT);
+ stop();
} catch ( IOException ignore) {
}
- if( syncChannelServer instanceof Disposable ) {
- ((Disposable)syncChannelServer).dispose();
- }
+ syncChannelServer.dispose();
}
public URI getBindURI() {
diff --git a/activeio/src/java/org/activeio/adapter/SynchToAsynchChannelAdapter.java b/activeio/src/java/org/activeio/adapter/SynchToAsynchChannelAdapter.java
index 5afb2b1f25..c3cce5b977 100644
--- a/activeio/src/java/org/activeio/adapter/SynchToAsynchChannelAdapter.java
+++ b/activeio/src/java/org/activeio/adapter/SynchToAsynchChannelAdapter.java
@@ -16,9 +16,10 @@
*/
package org.activeio.adapter;
-import org.activeio.SyncChannel;
-import org.activeio.AsyncChannel;
import org.activeio.Channel;
+import org.activeio.packet.async.AsyncChannel;
+import org.activeio.packet.sync.SyncChannel;
+
import edu.emory.mathcs.backport.java.util.concurrent.Executor;
/**
diff --git a/activeio/src/java/org/activeio/command/AsyncChannelToAsyncCommandChannel.java b/activeio/src/java/org/activeio/command/AsyncChannelToAsyncCommandChannel.java
index 7101d1af58..1e5e84cf95 100644
--- a/activeio/src/java/org/activeio/command/AsyncChannelToAsyncCommandChannel.java
+++ b/activeio/src/java/org/activeio/command/AsyncChannelToAsyncCommandChannel.java
@@ -17,10 +17,10 @@
**/
package org.activeio.command;
-import org.activeio.AsyncChannel;
-import org.activeio.AsyncChannelListener;
-import org.activeio.Packet;
import org.activeio.packet.EOSPacket;
+import org.activeio.packet.Packet;
+import org.activeio.packet.async.AsyncChannel;
+import org.activeio.packet.async.AsyncChannelListener;
import java.io.EOFException;
import java.io.IOException;
@@ -54,8 +54,8 @@ public class AsyncChannelToAsyncCommandChannel implements AsyncCommandChannel {
channel.start();
}
- public void stop(long timeout) throws IOException {
- channel.stop(timeout);
+ public void stop() throws IOException {
+ channel.stop();
}
public void setCommandListener(final CommandListener listener) {
diff --git a/activeio/src/java/org/activeio/command/DefaultWireFormat.java b/activeio/src/java/org/activeio/command/DefaultWireFormat.java
index c6d93b2319..61f48a2874 100644
--- a/activeio/src/java/org/activeio/command/DefaultWireFormat.java
+++ b/activeio/src/java/org/activeio/command/DefaultWireFormat.java
@@ -22,10 +22,10 @@ import java.io.DataOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
-import org.activeio.ByteArrayOutputStream;
-import org.activeio.Packet;
import org.activeio.adapter.PacketToInputStream;
import org.activeio.packet.ByteArrayPacket;
+import org.activeio.packet.Packet;
+import org.activeio.util.ByteArrayOutputStream;
/**
* A default implementation which uses serialization
diff --git a/activeio/src/java/org/activeio/command/WireFormat.java b/activeio/src/java/org/activeio/command/WireFormat.java
index eb5f694491..fe4f92863c 100644
--- a/activeio/src/java/org/activeio/command/WireFormat.java
+++ b/activeio/src/java/org/activeio/command/WireFormat.java
@@ -21,7 +21,7 @@ import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
-import org.activeio.Packet;
+import org.activeio.packet.Packet;
/**
* Provides a mechanism to marshal commands into and out of packets
diff --git a/activeio/src/java/org/activeio/filter/package.html b/activeio/src/java/org/activeio/filter/package.html
deleted file mode 100644
index bee0281f7a..0000000000
--- a/activeio/src/java/org/activeio/filter/package.html
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
--Some simple filters that may be added to your channels. -
- - - diff --git a/activeio/src/java/org/activeio/journal/Journal.java b/activeio/src/java/org/activeio/journal/Journal.java index 9f65910eb5..0baa90ba47 100644 --- a/activeio/src/java/org/activeio/journal/Journal.java +++ b/activeio/src/java/org/activeio/journal/Journal.java @@ -19,7 +19,7 @@ package org.activeio.journal; import java.io.IOException; -import org.activeio.Packet; +import org.activeio.packet.Packet; /** * A Journal is a record logging Interface that can be used to implement diff --git a/activeio/src/java/org/activeio/journal/active/BatchedWrite.java b/activeio/src/java/org/activeio/journal/active/BatchedWrite.java index 9f7920116d..8f75ed35e0 100644 --- a/activeio/src/java/org/activeio/journal/active/BatchedWrite.java +++ b/activeio/src/java/org/activeio/journal/active/BatchedWrite.java @@ -17,7 +17,7 @@ **/ package org.activeio.journal.active; -import org.activeio.Packet; +import org.activeio.packet.Packet; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; diff --git a/activeio/src/java/org/activeio/journal/active/ControlFile.java b/activeio/src/java/org/activeio/journal/active/ControlFile.java index 73b89a09a2..527e108cc2 100644 --- a/activeio/src/java/org/activeio/journal/active/ControlFile.java +++ b/activeio/src/java/org/activeio/journal/active/ControlFile.java @@ -27,9 +27,8 @@ import java.util.HashSet; import java.util.Properties; import java.util.Set; -import org.activeio.Disposable; -import org.activeio.Packet; import org.activeio.packet.ByteBufferPacket; +import org.activeio.packet.Packet; /** * Control file holds the last known good state of the journal. It stores the state in @@ -39,7 +38,7 @@ import org.activeio.packet.ByteBufferPacket; * * @version $Revision: 1.1 $ */ -final public class ControlFile implements Disposable { +final public class ControlFile { /** The File that holds the control data. */ private final RandomAccessFile file; diff --git a/activeio/src/java/org/activeio/journal/active/JournalImpl.java b/activeio/src/java/org/activeio/journal/active/JournalImpl.java index 23372abe53..c6b7cd9f05 100644 --- a/activeio/src/java/org/activeio/journal/active/JournalImpl.java +++ b/activeio/src/java/org/activeio/journal/active/JournalImpl.java @@ -21,14 +21,13 @@ import java.io.File; import java.io.IOException; import java.io.InterruptedIOException; -import org.activeio.Disposable; -import org.activeio.Packet; import org.activeio.journal.InvalidRecordLocationException; import org.activeio.journal.Journal; import org.activeio.journal.JournalEventListener; import org.activeio.journal.RecordLocation; import org.activeio.packet.ByteArrayPacket; import org.activeio.packet.ByteBufferPacketPool; +import org.activeio.packet.Packet; import edu.emory.mathcs.backport.java.util.concurrent.Callable; import edu.emory.mathcs.backport.java.util.concurrent.ExecutionException; @@ -60,7 +59,7 @@ import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; * * @version $Revision: 1.1 $ */ -final public class JournalImpl implements Journal, Disposable { +final public class JournalImpl implements Journal { public static final int DEFAULT_POOL_SIZE = Integer.parseInt(System.getProperty("org.activeio.journal.active.DefaultPoolSize", ""+(5))); public static final int DEFAULT_PACKET_SIZE = Integer.parseInt(System.getProperty("org.activeio.journal.active.DefaultPacketSize", ""+(1024*1024*4))); diff --git a/activeio/src/java/org/activeio/journal/active/Location.java b/activeio/src/java/org/activeio/journal/active/Location.java index 6b44930a4f..a5cbdffe53 100644 --- a/activeio/src/java/org/activeio/journal/active/Location.java +++ b/activeio/src/java/org/activeio/journal/active/Location.java @@ -21,9 +21,9 @@ import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; -import org.activeio.Packet; -import org.activeio.PacketData; import org.activeio.journal.RecordLocation; +import org.activeio.packet.Packet; +import org.activeio.packet.PacketData; /** * Defines a where a record can be located in the Journal. diff --git a/activeio/src/java/org/activeio/journal/active/LogFile.java b/activeio/src/java/org/activeio/journal/active/LogFile.java index 94eb7a9a8e..4b2fac8c89 100644 --- a/activeio/src/java/org/activeio/journal/active/LogFile.java +++ b/activeio/src/java/org/activeio/journal/active/LogFile.java @@ -24,14 +24,12 @@ import java.io.RandomAccessFile; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; -import org.activeio.Disposable; - /** * Allows read/append access to a LogFile. * * @version $Revision: 1.1 $ */ -final public class LogFile implements Disposable { +final public class LogFile { private final RandomAccessFile file; private final FileChannel channel; diff --git a/activeio/src/java/org/activeio/journal/active/LogFileManager.java b/activeio/src/java/org/activeio/journal/active/LogFileManager.java index 31154b62e1..0343a0e311 100644 --- a/activeio/src/java/org/activeio/journal/active/LogFileManager.java +++ b/activeio/src/java/org/activeio/journal/active/LogFileManager.java @@ -27,12 +27,12 @@ import java.nio.ByteBuffer; import java.text.NumberFormat; import java.util.HashMap; -import org.activeio.Packet; import org.activeio.adapter.PacketOutputStream; import org.activeio.adapter.PacketToInputStream; import org.activeio.journal.InvalidRecordLocationException; import org.activeio.packet.ByteArrayPacket; import org.activeio.packet.ByteBufferPacket; +import org.activeio.packet.Packet; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; diff --git a/activeio/src/java/org/activeio/journal/active/Record.java b/activeio/src/java/org/activeio/journal/active/Record.java index 21d654b658..8f46c54377 100644 --- a/activeio/src/java/org/activeio/journal/active/Record.java +++ b/activeio/src/java/org/activeio/journal/active/Record.java @@ -24,11 +24,10 @@ import java.io.DataOutputStream; import java.io.IOException; import java.util.zip.CRC32; -import org.activeio.Disposable; -import org.activeio.Packet; -import org.activeio.adapter.PacketToInputStream; import org.activeio.adapter.PacketOutputStream; +import org.activeio.adapter.PacketToInputStream; import org.activeio.packet.ByteArrayPacket; +import org.activeio.packet.Packet; /** @@ -36,7 +35,7 @@ import org.activeio.packet.ByteArrayPacket; * * @version $Revision: 1.1 $ */ -final public class Record implements Disposable { +final public class Record { static final public int RECORD_HEADER_SIZE=8+Location.SERIALIZED_SIZE; static final public int RECORD_FOOTER_SIZE=12+Location.SERIALIZED_SIZE; diff --git a/activeio/src/java/org/activeio/journal/howl/HowlJournal.java b/activeio/src/java/org/activeio/journal/howl/HowlJournal.java index 3174f62625..5bd68e5cce 100644 --- a/activeio/src/java/org/activeio/journal/howl/HowlJournal.java +++ b/activeio/src/java/org/activeio/journal/howl/HowlJournal.java @@ -20,12 +20,12 @@ package org.activeio.journal.howl; import java.io.IOException; import java.io.InterruptedIOException; -import org.activeio.Packet; import org.activeio.journal.InvalidRecordLocationException; import org.activeio.journal.Journal; import org.activeio.journal.JournalEventListener; import org.activeio.journal.RecordLocation; import org.activeio.packet.ByteArrayPacket; +import org.activeio.packet.Packet; import org.objectweb.howl.log.Configuration; import org.objectweb.howl.log.InvalidFileSetException; import org.objectweb.howl.log.InvalidLogBufferException; diff --git a/activeio/src/java/org/activeio/net/SocketSyncChannel.java b/activeio/src/java/org/activeio/net/SocketSyncChannel.java deleted file mode 100644 index 2b25093e4e..0000000000 --- a/activeio/src/java/org/activeio/net/SocketSyncChannel.java +++ /dev/null @@ -1,226 +0,0 @@ -/** - * - * Copyright 2004 Hiram Chirino - * - * 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. - * - **/ - -package org.activeio.net; - -import java.io.IOException; -import java.net.InetAddress; -import java.net.Socket; -import java.net.SocketAddress; -import java.net.SocketException; -import java.net.SocketTimeoutException; - -import org.activeio.ByteSequence; -import org.activeio.Packet; -import org.activeio.SyncChannel; -import org.activeio.SyncChannelServer; -import org.activeio.adapter.OutputStreamChannelToOutputStream; -import org.activeio.packet.ByteArrayPacket; -import org.activeio.packet.EOSPacket; -import org.activeio.packet.EmptyPacket; - -/** - * A {@see org.activeio.SynchChannel} implementation that uses a {@see java.net.Socket} - * to talk to the network. - * - * @version $Revision$ - */ -public class SocketSyncChannel implements SyncChannel, SocketMetadata { - - protected static final int DEFAULT_BUFFER_SIZE = 64 * 1024; - private final SocketStreamChannel channel; - private Packet inputPacket; - private final OutputStreamChannelToOutputStream outputStream; - - protected SocketSyncChannel(Socket socket) throws IOException { - this(new SocketStreamChannel(socket)); - } - - public SocketSyncChannel(SocketStreamChannel channel) throws IOException { - this.channel = channel; - outputStream = new OutputStreamChannelToOutputStream(channel); - setReceiveBufferSize(DEFAULT_BUFFER_SIZE); - setSendBufferSize(DEFAULT_BUFFER_SIZE); - } - - /** - * @see org.activeio.SynchChannel#read(long) - */ - synchronized public org.activeio.Packet read(long timeout) throws IOException { - try { - - if( timeout==SyncChannelServer.WAIT_FOREVER_TIMEOUT ) - setSoTimeout( 0 ); - else if( timeout==SyncChannelServer.NO_WAIT_TIMEOUT ) - setSoTimeout( 1 ); - else - setSoTimeout( (int)timeout ); - - if( inputPacket==null || !inputPacket.hasRemaining() ) { - inputPacket = allocatePacket(); - } - - ByteSequence sequence = inputPacket.asByteSequence(); - int size = channel.read(sequence.getData(), sequence.getOffset(), sequence.getLength()); - if( size == -1 ) - return EOSPacket.EOS_PACKET; - if( size == 0 ) - return EmptyPacket.EMPTY_PACKET; - inputPacket.position(size); - - Packet remaining = inputPacket.slice(); - - inputPacket.flip(); - Packet data = inputPacket.slice(); - - // Keep the remaining buffer around to fill with data. - inputPacket = remaining; - return data; - - } catch (SocketTimeoutException e) { - return null; - } - } - - private Packet allocatePacket() { - byte[] data = new byte[DEFAULT_BUFFER_SIZE]; - return new ByteArrayPacket(data); - } - - protected void setSoTimeout(int i) throws SocketException { - channel.setSoTimeout(i); - } - - /** - * @see org.activeio.Channel#write(org.activeio.Packet) - */ - public void write(Packet packet) throws IOException { - packet.writeTo(outputStream); - } - - /** - * @see org.activeio.Channel#flush() - */ - public void flush() throws IOException { - channel.flush(); - } - - /** - * @see org.activeio.Disposable#dispose() - */ - public void dispose() { - channel.dispose(); - } - - public void start() throws IOException { - channel.start(); - } - public void stop(long timeout) throws IOException { - channel.stop(timeout); - } - - public InetAddress getInetAddress() { - return channel.getInetAddress(); - } - public boolean getKeepAlive() throws SocketException { - return channel.getKeepAlive(); - } - public InetAddress getLocalAddress() { - return channel.getLocalAddress(); - } - public int getLocalPort() { - return channel.getLocalPort(); - } - public SocketAddress getLocalSocketAddress() { - return channel.getLocalSocketAddress(); - } - public boolean getOOBInline() throws SocketException { - return channel.getOOBInline(); - } - public int getPort() { - return channel.getPort(); - } - public int getReceiveBufferSize() throws SocketException { - return channel.getReceiveBufferSize(); - } - public SocketAddress getRemoteSocketAddress() { - return channel.getRemoteSocketAddress(); - } - public boolean getReuseAddress() throws SocketException { - return channel.getReuseAddress(); - } - public int getSendBufferSize() throws SocketException { - return channel.getSendBufferSize(); - } - public int getSoLinger() throws SocketException { - return channel.getSoLinger(); - } - public int getSoTimeout() throws SocketException { - return channel.getSoTimeout(); - } - public boolean getTcpNoDelay() throws SocketException { - return channel.getTcpNoDelay(); - } - public int getTrafficClass() throws SocketException { - return channel.getTrafficClass(); - } - public boolean isBound() { - return channel.isBound(); - } - public boolean isClosed() { - return channel.isClosed(); - } - public boolean isConnected() { - return channel.isConnected(); - } - public void setKeepAlive(boolean on) throws SocketException { - channel.setKeepAlive(on); - } - public void setOOBInline(boolean on) throws SocketException { - channel.setOOBInline(on); - } - public void setReceiveBufferSize(int size) throws SocketException { - channel.setReceiveBufferSize(size); - } - public void setReuseAddress(boolean on) throws SocketException { - channel.setReuseAddress(on); - } - public void setSendBufferSize(int size) throws SocketException { - channel.setSendBufferSize(size); - } - public void setSoLinger(boolean on, int linger) throws SocketException { - channel.setSoLinger(on, linger); - } - public void setTcpNoDelay(boolean on) throws SocketException { - channel.setTcpNoDelay(on); - } - public void setTrafficClass(int tc) throws SocketException { - channel.setTrafficClass(tc); - } - - public Object getAdapter(Class target) { - if( target.isAssignableFrom(getClass()) ) { - return this; - } - return channel.getAdapter(target); - } - - public String toString() { - return channel.toString(); - } -} \ No newline at end of file diff --git a/activeio/src/java/org/activeio/net/package.html b/activeio/src/java/org/activeio/net/package.html deleted file mode 100644 index 967fe9d5d3..0000000000 --- a/activeio/src/java/org/activeio/net/package.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - --A set of Channel implementations that are implemented using the Socket and DatagramSocket classes. -
- - - diff --git a/activeio/src/java/org/activeio/oneport/HttpRecognizer.java b/activeio/src/java/org/activeio/oneport/HttpRecognizer.java index 6f776e61fa..b7fb7fe491 100644 --- a/activeio/src/java/org/activeio/oneport/HttpRecognizer.java +++ b/activeio/src/java/org/activeio/oneport/HttpRecognizer.java @@ -19,7 +19,7 @@ package org.activeio.oneport; import java.util.HashSet; -import org.activeio.Packet; +import org.activeio.packet.Packet; public class HttpRecognizer implements ProtocolRecognizer { diff --git a/activeio/src/java/org/activeio/oneport/IIOPRecognizer.java b/activeio/src/java/org/activeio/oneport/IIOPRecognizer.java index 841a4bd7f4..c3643ff33b 100644 --- a/activeio/src/java/org/activeio/oneport/IIOPRecognizer.java +++ b/activeio/src/java/org/activeio/oneport/IIOPRecognizer.java @@ -17,7 +17,7 @@ **/ package org.activeio.oneport; -import org.activeio.Packet; +import org.activeio.packet.Packet; public class IIOPRecognizer implements ProtocolRecognizer { diff --git a/activeio/src/java/org/activeio/oneport/OnePortAsyncChannelServer.java b/activeio/src/java/org/activeio/oneport/OnePortAsyncChannelServer.java index 88e0ad0011..94d6e91501 100644 --- a/activeio/src/java/org/activeio/oneport/OnePortAsyncChannelServer.java +++ b/activeio/src/java/org/activeio/oneport/OnePortAsyncChannelServer.java @@ -22,18 +22,18 @@ import java.net.URI; import java.util.Iterator; import org.activeio.AcceptListener; -import org.activeio.AsyncChannel; -import org.activeio.AsyncChannelListener; -import org.activeio.AsyncChannelServer; import org.activeio.Channel; -import org.activeio.FilterAsyncChannel; -import org.activeio.FilterAsyncChannelServer; -import org.activeio.Packet; -import org.activeio.SyncChannel; import org.activeio.adapter.AsyncToSyncChannel; import org.activeio.adapter.SyncToAsyncChannel; -import org.activeio.filter.PushbackSyncChannel; import org.activeio.packet.AppendedPacket; +import org.activeio.packet.Packet; +import org.activeio.packet.async.AsyncChannel; +import org.activeio.packet.async.AsyncChannelListener; +import org.activeio.packet.async.AsyncChannelServer; +import org.activeio.packet.async.FilterAsyncChannel; +import org.activeio.packet.async.FilterAsyncChannelServer; +import org.activeio.packet.sync.SyncChannel; +import org.activeio.packet.sync.filter.PushbackSyncChannel; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap; @@ -121,7 +121,7 @@ final public class OnePortAsyncChannelServer extends FilterAsyncChannelServer { // packets wiil get // delivered. try { - stop(NO_WAIT_TIMEOUT); + stop(); setAsyncChannelListener(null); } catch (IOException e) { getAsyncChannelListener().onPacketError(e); @@ -176,7 +176,7 @@ final public class OnePortAsyncChannelServer extends FilterAsyncChannelServer { public void start() throws IOException { started = true; } - public void stop(long timeout) throws IOException { + public void stop() throws IOException { started = false; } diff --git a/activeio/src/java/org/activeio/oneport/ProtocolRecognizer.java b/activeio/src/java/org/activeio/oneport/ProtocolRecognizer.java index 5bb21c29e2..eb43010352 100644 --- a/activeio/src/java/org/activeio/oneport/ProtocolRecognizer.java +++ b/activeio/src/java/org/activeio/oneport/ProtocolRecognizer.java @@ -17,7 +17,7 @@ **/ package org.activeio.oneport; -import org.activeio.Packet; +import org.activeio.packet.Packet; /** * diff --git a/activeio/src/java/org/activeio/oneport/UnknownRecognizer.java b/activeio/src/java/org/activeio/oneport/UnknownRecognizer.java index afaf91cc53..4263a4eaa3 100644 --- a/activeio/src/java/org/activeio/oneport/UnknownRecognizer.java +++ b/activeio/src/java/org/activeio/oneport/UnknownRecognizer.java @@ -17,7 +17,7 @@ **/ package org.activeio.oneport; -import org.activeio.Packet; +import org.activeio.packet.Packet; class UnknownRecognizer implements ProtocolRecognizer { diff --git a/activeio/src/java/org/activeio/oneport/JettyOnePortSocketListener.java b/activeio/src/java/org/activeio/oneport/jetty/JettyOnePortSocketListener.java similarity index 87% rename from activeio/src/java/org/activeio/oneport/JettyOnePortSocketListener.java rename to activeio/src/java/org/activeio/oneport/jetty/JettyOnePortSocketListener.java index fc1a267a3e..4cbf8993ba 100644 --- a/activeio/src/java/org/activeio/oneport/JettyOnePortSocketListener.java +++ b/activeio/src/java/org/activeio/oneport/jetty/JettyOnePortSocketListener.java @@ -15,14 +15,16 @@ * limitations under the License. * **/ -package org.activeio.oneport; +package org.activeio.oneport.jetty; import java.io.IOException; import java.net.ServerSocket; -import org.activeio.SyncChannelServer; import org.activeio.adapter.AsyncToSyncChannelServer; import org.activeio.adapter.SyncChannelServerToServerSocket; +import org.activeio.oneport.HttpRecognizer; +import org.activeio.oneport.OnePortAsyncChannelServer; +import org.activeio.packet.sync.SyncChannelServer; import org.mortbay.http.SocketListener; import org.mortbay.util.InetAddrPort; diff --git a/activeio/src/java/org/activeio/oneport/OpenORBOpenPortFeatureInitializer.java b/activeio/src/java/org/activeio/oneport/openorb/OpenORBOpenPortFeatureInitializer.java similarity index 94% rename from activeio/src/java/org/activeio/oneport/OpenORBOpenPortFeatureInitializer.java rename to activeio/src/java/org/activeio/oneport/openorb/OpenORBOpenPortFeatureInitializer.java index b8603577c9..72d3335872 100644 --- a/activeio/src/java/org/activeio/oneport/OpenORBOpenPortFeatureInitializer.java +++ b/activeio/src/java/org/activeio/oneport/openorb/OpenORBOpenPortFeatureInitializer.java @@ -15,7 +15,7 @@ * limitations under the License. * **/ -package org.activeio.oneport; +package org.activeio.oneport.openorb; import org.omg.PortableInterceptor.ORBInitInfo; import org.openorb.orb.pi.FeatureInitInfo; diff --git a/activeio/src/java/org/activeio/oneport/OpenORBOpenPortSocketFactory.java b/activeio/src/java/org/activeio/oneport/openorb/OpenORBOpenPortSocketFactory.java similarity index 87% rename from activeio/src/java/org/activeio/oneport/OpenORBOpenPortSocketFactory.java rename to activeio/src/java/org/activeio/oneport/openorb/OpenORBOpenPortSocketFactory.java index d4cb2d148c..f1a27fe2a5 100644 --- a/activeio/src/java/org/activeio/oneport/OpenORBOpenPortSocketFactory.java +++ b/activeio/src/java/org/activeio/oneport/openorb/OpenORBOpenPortSocketFactory.java @@ -15,16 +15,18 @@ * limitations under the License. * **/ -package org.activeio.oneport; +package org.activeio.oneport.openorb; import java.io.IOException; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; -import org.activeio.SyncChannelServer; import org.activeio.adapter.AsyncToSyncChannelServer; import org.activeio.adapter.SyncChannelServerToServerSocket; +import org.activeio.oneport.IIOPRecognizer; +import org.activeio.oneport.OnePortAsyncChannelServer; +import org.activeio.packet.sync.SyncChannelServer; import org.openorb.orb.net.SocketFactory; /** diff --git a/activeio/src/java/org/activeio/packet/AppendedPacket.java b/activeio/src/java/org/activeio/packet/AppendedPacket.java index 4dd7fdabd8..40c0b80335 100644 --- a/activeio/src/java/org/activeio/packet/AppendedPacket.java +++ b/activeio/src/java/org/activeio/packet/AppendedPacket.java @@ -21,8 +21,6 @@ import java.io.IOException; import java.io.OutputStream; import java.lang.reflect.Constructor; -import org.activeio.ByteSequence; -import org.activeio.Packet; /** * Appends two packets together. @@ -154,7 +152,7 @@ final public class AppendedPacket implements Packet { /** - * @see org.activeio.Packet#read() + * @see org.activeio.packet.Packet#read() */ public int read() { if( first.hasRemaining() ) { @@ -167,7 +165,7 @@ final public class AppendedPacket implements Packet { } /** - * @see org.activeio.Packet#read(byte[], int, int) + * @see org.activeio.packet.Packet#read(byte[], int, int) */ public int read(byte[] data, int offset, int length) { @@ -183,7 +181,7 @@ final public class AppendedPacket implements Packet { } /** - * @see org.activeio.Packet#write(int) + * @see org.activeio.packet.Packet#write(int) */ public boolean write(int data) { if( first.hasRemaining() ) { @@ -196,7 +194,7 @@ final public class AppendedPacket implements Packet { } /** - * @see org.activeio.Packet#write(byte[], int, int) + * @see org.activeio.packet.Packet#write(byte[], int, int) */ public int write(byte[] data, int offset, int length) { int rc1 = first.write(data, offset, length); diff --git a/activeio/src/java/org/activeio/packet/ByteArrayPacket.java b/activeio/src/java/org/activeio/packet/ByteArrayPacket.java index c3803ec44d..6b375645c1 100644 --- a/activeio/src/java/org/activeio/packet/ByteArrayPacket.java +++ b/activeio/src/java/org/activeio/packet/ByteArrayPacket.java @@ -21,8 +21,6 @@ import java.io.IOException; import java.io.OutputStream; import java.lang.reflect.Constructor; -import org.activeio.ByteSequence; -import org.activeio.Packet; /** * Provides a Packet implementation that is directly backed by abyte[]
.
@@ -135,7 +133,7 @@ final public class ByteArrayPacket implements Packet {
}
/**
- * @see org.activeio.Packet#read()
+ * @see org.activeio.packet.Packet#read()
*/
public int read() {
if( !(remaining > 0) )
@@ -147,7 +145,7 @@ final public class ByteArrayPacket implements Packet {
}
/**
- * @see org.activeio.Packet#read(byte[], int, int)
+ * @see org.activeio.packet.Packet#read(byte[], int, int)
*/
public int read(byte[] data, int offset, int length) {
if( !(remaining > 0) )
@@ -161,7 +159,7 @@ final public class ByteArrayPacket implements Packet {
}
/**
- * @see org.activeio.Packet#write(int)
+ * @see org.activeio.packet.Packet#write(int)
*/
public boolean write(int data) {
if( !(remaining > 0) )
@@ -173,7 +171,7 @@ final public class ByteArrayPacket implements Packet {
}
/**
- * @see org.activeio.Packet#write(byte[], int, int)
+ * @see org.activeio.packet.Packet#write(byte[], int, int)
*/
public int write(byte[] data, int offset, int length) {
if( !(remaining > 0) )
@@ -191,7 +189,7 @@ final public class ByteArrayPacket implements Packet {
}
/**
- * @see org.activeio.Packet#sliceAsBytes()
+ * @see org.activeio.packet.Packet#sliceAsBytes()
*/
public byte[] sliceAsBytes() {
if( buffer.length == remaining ) {
diff --git a/activeio/src/java/org/activeio/packet/ByteBufferPacket.java b/activeio/src/java/org/activeio/packet/ByteBufferPacket.java
index ff7db0d9f4..d8a1ca4569 100644
--- a/activeio/src/java/org/activeio/packet/ByteBufferPacket.java
+++ b/activeio/src/java/org/activeio/packet/ByteBufferPacket.java
@@ -22,8 +22,6 @@ import java.io.OutputStream;
import java.lang.reflect.Constructor;
import java.nio.ByteBuffer;
-import org.activeio.ByteSequence;
-import org.activeio.Packet;
/**
* Provides a Packet implementation that is backed by a {@see java.nio.ByteBuffer}
@@ -174,7 +172,7 @@ final public class ByteBufferPacket implements Packet {
/**
- * @see org.activeio.Packet#read()
+ * @see org.activeio.packet.Packet#read()
*/
public int read() {
if( !buffer.hasRemaining() )
@@ -183,7 +181,7 @@ final public class ByteBufferPacket implements Packet {
}
/**
- * @see org.activeio.Packet#read(byte[], int, int)
+ * @see org.activeio.packet.Packet#read(byte[], int, int)
*/
public int read(byte[] data, int offset, int length) {
if( !hasRemaining() )
@@ -195,7 +193,7 @@ final public class ByteBufferPacket implements Packet {
}
/**
- * @see org.activeio.Packet#write(int)
+ * @see org.activeio.packet.Packet#write(int)
*/
public boolean write(int data) {
if( !buffer.hasRemaining() )
@@ -205,7 +203,7 @@ final public class ByteBufferPacket implements Packet {
}
/**
- * @see org.activeio.Packet#write(byte[], int, int)
+ * @see org.activeio.packet.Packet#write(byte[], int, int)
*/
public int write(byte[] data, int offset, int length) {
if( !hasRemaining() )
@@ -217,7 +215,7 @@ final public class ByteBufferPacket implements Packet {
}
/**
- * @see org.activeio.Packet#asByteSequence()
+ * @see org.activeio.packet.Packet#asByteSequence()
*/
public ByteSequence asByteSequence() {
if( buffer.hasArray() ) {
@@ -229,7 +227,7 @@ final public class ByteBufferPacket implements Packet {
}
/**
- * @see org.activeio.Packet#sliceAsBytes()
+ * @see org.activeio.packet.Packet#sliceAsBytes()
*/
public byte[] sliceAsBytes() {
// TODO Auto-generated method stub
diff --git a/activeio/src/java/org/activeio/packet/ByteBufferPacketPool.java b/activeio/src/java/org/activeio/packet/ByteBufferPacketPool.java
index 05539eda4f..961cf1d493 100644
--- a/activeio/src/java/org/activeio/packet/ByteBufferPacketPool.java
+++ b/activeio/src/java/org/activeio/packet/ByteBufferPacketPool.java
@@ -17,7 +17,6 @@
**/
package org.activeio.packet;
-import org.activeio.Packet;
import java.nio.ByteBuffer;
diff --git a/activeio/src/java/org/activeio/packet/BytePacket.java b/activeio/src/java/org/activeio/packet/BytePacket.java
index ed03e7eb9b..2daf0ef595 100644
--- a/activeio/src/java/org/activeio/packet/BytePacket.java
+++ b/activeio/src/java/org/activeio/packet/BytePacket.java
@@ -21,8 +21,6 @@ import java.io.IOException;
import java.io.OutputStream;
import java.lang.reflect.Constructor;
-import org.activeio.ByteSequence;
-import org.activeio.Packet;
/**
* Provides a Packet implementation that is directly backed by a byte
.
@@ -120,7 +118,7 @@ final public class BytePacket implements Packet {
}
/**
- * @see org.activeio.Packet#read()
+ * @see org.activeio.packet.Packet#read()
*/
public int read() {
if( !hasRemaining() )
@@ -130,7 +128,7 @@ final public class BytePacket implements Packet {
}
/**
- * @see org.activeio.Packet#read(byte[], int, int)
+ * @see org.activeio.packet.Packet#read(byte[], int, int)
*/
public int read(byte[] data, int offset, int length) {
if( !hasRemaining() )
@@ -145,7 +143,7 @@ final public class BytePacket implements Packet {
}
/**
- * @see org.activeio.Packet#write(int)
+ * @see org.activeio.packet.Packet#write(int)
*/
public boolean write(int data) {
if( !hasRemaining() )
@@ -157,7 +155,7 @@ final public class BytePacket implements Packet {
}
/**
- * @see org.activeio.Packet#write(byte[], int, int)
+ * @see org.activeio.packet.Packet#write(byte[], int, int)
*/
public int write(byte[] data, int offset, int length) {
if( !hasRemaining() )
@@ -176,7 +174,7 @@ final public class BytePacket implements Packet {
}
/**
- * @see org.activeio.Packet#sliceAsBytes()
+ * @see org.activeio.packet.Packet#sliceAsBytes()
*/
public byte[] sliceAsBytes() {
return null;
diff --git a/activeio/src/java/org/activeio/ByteSequence.java b/activeio/src/java/org/activeio/packet/ByteSequence.java
similarity index 97%
rename from activeio/src/java/org/activeio/ByteSequence.java
rename to activeio/src/java/org/activeio/packet/ByteSequence.java
index 656917e540..b2ecd46465 100644
--- a/activeio/src/java/org/activeio/ByteSequence.java
+++ b/activeio/src/java/org/activeio/packet/ByteSequence.java
@@ -17,7 +17,7 @@
*
**/
-package org.activeio;
+package org.activeio.packet;
public class ByteSequence {
final byte[] data;
diff --git a/activeio/src/java/org/activeio/packet/EOSPacket.java b/activeio/src/java/org/activeio/packet/EOSPacket.java
index 6d84626996..6dd008c933 100644
--- a/activeio/src/java/org/activeio/packet/EOSPacket.java
+++ b/activeio/src/java/org/activeio/packet/EOSPacket.java
@@ -20,8 +20,6 @@ import java.io.DataOutput;
import java.io.IOException;
import java.io.OutputStream;
-import org.activeio.ByteSequence;
-import org.activeio.Packet;
/**
* Provides a Packet implementation that is used to represent the end of a stream.
@@ -93,28 +91,28 @@ final public class EOSPacket implements Packet {
}
/**
- * @see org.activeio.Packet#read()
+ * @see org.activeio.packet.Packet#read()
*/
public int read() {
return -1;
}
/**
- * @see org.activeio.Packet#read(byte[], int, int)
+ * @see org.activeio.packet.Packet#read(byte[], int, int)
*/
public int read(byte[] data, int offset, int length) {
return -1;
}
/**
- * @see org.activeio.Packet#write(int)
+ * @see org.activeio.packet.Packet#write(int)
*/
public boolean write(int data) {
return false;
}
/**
- * @see org.activeio.Packet#write(byte[], int, int)
+ * @see org.activeio.packet.Packet#write(byte[], int, int)
*/
public int write(byte[] data, int offset, int length) {
return -1;
diff --git a/activeio/src/java/org/activeio/packet/EmptyPacket.java b/activeio/src/java/org/activeio/packet/EmptyPacket.java
index aaedd4458f..e3cc0a596a 100644
--- a/activeio/src/java/org/activeio/packet/EmptyPacket.java
+++ b/activeio/src/java/org/activeio/packet/EmptyPacket.java
@@ -20,8 +20,6 @@ import java.io.DataOutput;
import java.io.IOException;
import java.io.OutputStream;
-import org.activeio.ByteSequence;
-import org.activeio.Packet;
/**
* Provides a Packet implementation that is directly backed by a byte[0]
.
@@ -95,28 +93,28 @@ final public class EmptyPacket implements Packet {
}
/**
- * @see org.activeio.Packet#read()
+ * @see org.activeio.packet.Packet#read()
*/
public int read() {
return -1;
}
/**
- * @see org.activeio.Packet#read(byte[], int, int)
+ * @see org.activeio.packet.Packet#read(byte[], int, int)
*/
public int read(byte[] data, int offset, int length) {
return -1;
}
/**
- * @see org.activeio.Packet#write(int)
+ * @see org.activeio.packet.Packet#write(int)
*/
public boolean write(int data) {
return false;
}
/**
- * @see org.activeio.Packet#write(byte[], int, int)
+ * @see org.activeio.packet.Packet#write(byte[], int, int)
*/
public int write(byte[] data, int offset, int length) {
return -1;
diff --git a/activeio/src/java/org/activeio/packet/FilterPacket.java b/activeio/src/java/org/activeio/packet/FilterPacket.java
index d1dd9bc866..cd2e421530 100644
--- a/activeio/src/java/org/activeio/packet/FilterPacket.java
+++ b/activeio/src/java/org/activeio/packet/FilterPacket.java
@@ -20,8 +20,6 @@ import java.io.DataOutput;
import java.io.IOException;
import java.io.OutputStream;
-import org.activeio.ByteSequence;
-import org.activeio.Packet;
/**
* Provides a Packet implementation that filters operations to another packet.
diff --git a/activeio/src/java/org/activeio/Packet.java b/activeio/src/java/org/activeio/packet/Packet.java
similarity index 90%
rename from activeio/src/java/org/activeio/Packet.java
rename to activeio/src/java/org/activeio/packet/Packet.java
index 95be00a536..d839427074 100644
--- a/activeio/src/java/org/activeio/Packet.java
+++ b/activeio/src/java/org/activeio/packet/Packet.java
@@ -14,18 +14,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio;
+package org.activeio.packet;
import java.io.DataOutput;
import java.io.IOException;
import java.io.OutputStream;
+import org.activeio.Adaptable;
+
/**
* Provides a ByteBuffer like interface to work with IO channel packets of data.
*
* @version $Revision$
*/
-public interface Packet extends Disposable, Adaptable {
+public interface Packet extends Adaptable {
public int position();
public void position(int position);
@@ -40,6 +42,7 @@ public interface Packet extends Disposable, Adaptable {
public Packet duplicate();
public Object duplicate(ClassLoader cl) throws IOException;
public int capacity();
+ public void dispose();
public ByteSequence asByteSequence();
public byte[] sliceAsBytes();
diff --git a/activeio/src/java/org/activeio/PacketData.java b/activeio/src/java/org/activeio/packet/PacketData.java
similarity index 96%
rename from activeio/src/java/org/activeio/PacketData.java
rename to activeio/src/java/org/activeio/packet/PacketData.java
index 1fd04c87df..bb928f97fa 100644
--- a/activeio/src/java/org/activeio/PacketData.java
+++ b/activeio/src/java/org/activeio/packet/PacketData.java
@@ -15,7 +15,7 @@
* limitations under the License.
*
**/
-package org.activeio;
+package org.activeio.packet;
import java.io.EOFException;
import java.io.IOException;
diff --git a/activeio/src/java/org/activeio/packet/PacketPool.java b/activeio/src/java/org/activeio/packet/PacketPool.java
index 606b83a25f..2b63e87a7a 100644
--- a/activeio/src/java/org/activeio/packet/PacketPool.java
+++ b/activeio/src/java/org/activeio/packet/PacketPool.java
@@ -19,9 +19,6 @@ package org.activeio.packet;
import java.util.ArrayList;
-import org.activeio.Disposable;
-import org.activeio.Packet;
-
import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger;
/**
@@ -30,7 +27,7 @@ import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger;
*
* @version $Revision: 1.1 $
*/
-abstract public class PacketPool implements Disposable {
+abstract public class PacketPool {
public static final int DEFAULT_POOL_SIZE = Integer.parseInt(System.getProperty("org.activeio.journal.active.DefaultPoolSize", ""+(5)));
public static final int DEFAULT_PACKET_SIZE = Integer.parseInt(System.getProperty("org.activeio.journal.active.DefaultPacketSize", ""+(1024*1024*4)));
diff --git a/activeio/src/java/org/activeio/OutputChannel.java b/activeio/src/java/org/activeio/packet/async/AsyncChannel.java
similarity index 58%
rename from activeio/src/java/org/activeio/OutputChannel.java
rename to activeio/src/java/org/activeio/packet/async/AsyncChannel.java
index 6cbedd6c75..14c858b579 100644
--- a/activeio/src/java/org/activeio/OutputChannel.java
+++ b/activeio/src/java/org/activeio/packet/async/AsyncChannel.java
@@ -15,14 +15,34 @@
* limitations under the License.
*/
-package org.activeio;
+package org.activeio.packet.async;
import java.io.IOException;
+import org.activeio.Channel;
+import org.activeio.packet.Packet;
+
+
/**
+ * AsyncChannel objects asynchronously push 'up' {@see org.activeio.Packet} objects
+ * to a registered {@see org.activeio.ChannelConsumer}.
+ *
* @version $Revision$
*/
-public interface OutputChannel extends Channel {
+public interface AsyncChannel extends Channel {
+
+ /**
+ * Registers the {@see ChannelConsumer} that the protcol will use to deliver packets
+ * coming 'up' the channel.
+ *
+ * @param packetListener
+ */
+ void setAsyncChannelListener(AsyncChannelListener channelListener);
+
+ /**
+ * @return the registered Packet consumer
+ */
+ AsyncChannelListener getAsyncChannelListener();
/**
* Sends a packet down the channel towards the media.
@@ -38,4 +58,5 @@ public interface OutputChannel extends Channel {
* @throws IOException
*/
void flush() throws IOException;
+
}
diff --git a/activeio/src/java/org/activeio/AsyncChannelFactory.java b/activeio/src/java/org/activeio/packet/async/AsyncChannelFactory.java
similarity index 93%
rename from activeio/src/java/org/activeio/AsyncChannelFactory.java
rename to activeio/src/java/org/activeio/packet/async/AsyncChannelFactory.java
index ef579d35e0..152239cf82 100644
--- a/activeio/src/java/org/activeio/AsyncChannelFactory.java
+++ b/activeio/src/java/org/activeio/packet/async/AsyncChannelFactory.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio;
+package org.activeio.packet.async;
import java.io.IOException;
import java.net.URI;
diff --git a/activeio/src/java/org/activeio/AsyncChannelListener.java b/activeio/src/java/org/activeio/packet/async/AsyncChannelListener.java
similarity index 92%
rename from activeio/src/java/org/activeio/AsyncChannelListener.java
rename to activeio/src/java/org/activeio/packet/async/AsyncChannelListener.java
index b980c721cd..d04ab540c0 100644
--- a/activeio/src/java/org/activeio/AsyncChannelListener.java
+++ b/activeio/src/java/org/activeio/packet/async/AsyncChannelListener.java
@@ -14,10 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio;
+package org.activeio.packet.async;
import java.io.IOException;
+import org.activeio.packet.Packet;
+
/**
* A ChannelConsumer object is used to receive 'up' {@see org.activeio.Packet} objects.
diff --git a/activeio/src/java/org/activeio/AsyncChannelServer.java b/activeio/src/java/org/activeio/packet/async/AsyncChannelServer.java
similarity index 87%
rename from activeio/src/java/org/activeio/AsyncChannelServer.java
rename to activeio/src/java/org/activeio/packet/async/AsyncChannelServer.java
index a663743e43..a06ce4543a 100644
--- a/activeio/src/java/org/activeio/AsyncChannelServer.java
+++ b/activeio/src/java/org/activeio/packet/async/AsyncChannelServer.java
@@ -14,7 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio;
+package org.activeio.packet.async;
+
+import org.activeio.AcceptListener;
+import org.activeio.ChannelServer;
/**
diff --git a/activeio/src/java/org/activeio/FilterAsyncChannel.java b/activeio/src/java/org/activeio/packet/async/FilterAsyncChannel.java
similarity index 85%
rename from activeio/src/java/org/activeio/FilterAsyncChannel.java
rename to activeio/src/java/org/activeio/packet/async/FilterAsyncChannel.java
index 2fb30f48a5..6e8e705bcd 100644
--- a/activeio/src/java/org/activeio/FilterAsyncChannel.java
+++ b/activeio/src/java/org/activeio/packet/async/FilterAsyncChannel.java
@@ -14,10 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio;
+package org.activeio.packet.async;
import java.io.IOException;
+import org.activeio.packet.Packet;
+
/**
* A AsyncChannelFilter can be used as a filter between a {@see org.activeio.AsyncChannel}
@@ -74,21 +76,21 @@ public class FilterAsyncChannel implements AsyncChannel, AsyncChannelListener {
}
/**
- * @see org.activeio.Service#stop(long)
+ * @see org.activeio.Service#stop()
*/
- public void stop(long timeout) throws IOException {
- next.stop(timeout);
+ public void stop() throws IOException {
+ next.stop();
}
/**
- * @see org.activeio.AsyncChannelListener#onPacket(org.activeio.Packet)
+ * @see org.activeio.packet.async.AsyncChannelListener#onPacket(org.activeio.packet.Packet)
*/
public void onPacket(Packet packet) {
channelListener.onPacket(packet);
}
/**
- * @see org.activeio.AsyncChannelListener#onPacketError(org.activeio.ChannelException)
+ * @see org.activeio.packet.async.AsyncChannelListener#onPacketError(org.activeio.ChannelException)
*/
public void onPacketError(IOException error) {
channelListener.onPacketError(error);
diff --git a/activeio/src/java/org/activeio/FilterAsyncChannelServer.java b/activeio/src/java/org/activeio/packet/async/FilterAsyncChannelServer.java
similarity index 89%
rename from activeio/src/java/org/activeio/FilterAsyncChannelServer.java
rename to activeio/src/java/org/activeio/packet/async/FilterAsyncChannelServer.java
index 98a229670c..867b8d953a 100644
--- a/activeio/src/java/org/activeio/FilterAsyncChannelServer.java
+++ b/activeio/src/java/org/activeio/packet/async/FilterAsyncChannelServer.java
@@ -14,11 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio;
+package org.activeio.packet.async;
import java.io.IOException;
import java.net.URI;
+import org.activeio.AcceptListener;
+import org.activeio.Channel;
+
/**
* A AsyncChannelFilter can be used as a filter between a {@see org.activeio.AsyncChannel}
@@ -66,10 +69,10 @@ public class FilterAsyncChannelServer implements AsyncChannelServer, AcceptListe
}
/**
- * @see org.activeio.Service#stop(long)
+ * @see org.activeio.Service#stop()
*/
- public void stop(long timeout) throws IOException {
- next.stop(timeout);
+ public void stop() throws IOException {
+ next.stop();
}
public void onAccept(Channel channel) {
diff --git a/activeio/src/java/org/activeio/net/AIOAsyncChannel.java b/activeio/src/java/org/activeio/packet/async/aio/AIOAsyncChannel.java
similarity index 90%
rename from activeio/src/java/org/activeio/net/AIOAsyncChannel.java
rename to activeio/src/java/org/activeio/packet/async/aio/AIOAsyncChannel.java
index ae98594c2a..294b9a7820 100644
--- a/activeio/src/java/org/activeio/net/AIOAsyncChannel.java
+++ b/activeio/src/java/org/activeio/packet/async/aio/AIOAsyncChannel.java
@@ -16,7 +16,7 @@
*
**/
-package org.activeio.net;
+package org.activeio.packet.async.aio;
import java.io.IOException;
import java.io.InterruptedIOException;
@@ -26,11 +26,12 @@ import java.net.SocketAddress;
import java.net.SocketException;
import java.nio.ByteBuffer;
-import org.activeio.AsyncChannel;
-import org.activeio.AsyncChannelListener;
-import org.activeio.Packet;
import org.activeio.packet.ByteBufferPacket;
import org.activeio.packet.EOSPacket;
+import org.activeio.packet.Packet;
+import org.activeio.packet.async.AsyncChannel;
+import org.activeio.packet.async.AsyncChannelListener;
+import org.activeio.stream.sync.socket.SocketMetadata;
import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch;
import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
@@ -89,7 +90,7 @@ final public class AIOAsyncChannel implements AsyncChannel, ICompletionListener,
channelListener.onPacketError(new SocketException("Socket closed."));
}
try {
- stop(NO_WAIT_TIMEOUT);
+ stop();
} catch (IOException e) {
}
try {
@@ -105,16 +106,10 @@ final public class AIOAsyncChannel implements AsyncChannel, ICompletionListener,
}
}
- public void stop(long timeout) throws IOException {
+ public void stop() throws IOException {
if( running.compareAndSet(true, false) ) {
try {
- if( timeout == NO_WAIT_TIMEOUT ) {
- doneCountDownLatch.await(0, TimeUnit.MILLISECONDS);
- } else if( timeout == WAIT_FOREVER_TIMEOUT ) {
- doneCountDownLatch.await();
- } else {
- doneCountDownLatch.await(timeout, TimeUnit.MILLISECONDS);
- }
+ doneCountDownLatch.await(5, TimeUnit.SECONDS);
} catch (InterruptedException e) {
throw new InterruptedIOException();
}
@@ -259,7 +254,11 @@ final public class AIOAsyncChannel implements AsyncChannel, ICompletionListener,
public void setTrafficClass(int tc) throws SocketException {
socket.setTrafficClass(tc);
}
+ public void setSoTimeout(int i) throws SocketException {
+ socket.setSoTimeout(i);
+ }
public String toString() {
return "AIO Connection: "+getLocalSocketAddress()+" -> "+getRemoteSocketAddress();
}
+
}
\ No newline at end of file
diff --git a/activeio/src/java/org/activeio/net/AIOAsyncChannelFactory.java b/activeio/src/java/org/activeio/packet/async/aio/AIOAsyncChannelFactory.java
similarity index 90%
rename from activeio/src/java/org/activeio/net/AIOAsyncChannelFactory.java
rename to activeio/src/java/org/activeio/packet/async/aio/AIOAsyncChannelFactory.java
index ff546e160e..d02cbc0050 100644
--- a/activeio/src/java/org/activeio/net/AIOAsyncChannelFactory.java
+++ b/activeio/src/java/org/activeio/packet/async/aio/AIOAsyncChannelFactory.java
@@ -15,7 +15,7 @@
* limitations under the License.
*
**/
-package org.activeio.net;
+package org.activeio.packet.async.aio;
import java.io.IOException;
import java.net.InetAddress;
@@ -23,12 +23,13 @@ import java.net.InetSocketAddress;
import java.net.URI;
import java.net.URISyntaxException;
-import org.activeio.AsyncChannel;
-import org.activeio.AsyncChannelFactory;
-import org.activeio.AsyncChannelServer;
import org.activeio.adapter.SyncToAsyncChannelServer;
-import org.activeio.filter.WriteBufferedAsyncChannel;
import org.activeio.packet.ByteBufferPacket;
+import org.activeio.packet.async.AsyncChannel;
+import org.activeio.packet.async.AsyncChannelFactory;
+import org.activeio.packet.async.AsyncChannelServer;
+import org.activeio.packet.async.filter.WriteBufferedAsyncChannel;
+import org.activeio.util.URISupport;
import com.ibm.io.async.AsyncServerSocketChannel;
import com.ibm.io.async.AsyncSocketChannel;
diff --git a/activeio/src/java/org/activeio/net/AIOSyncChannelServer.java b/activeio/src/java/org/activeio/packet/async/aio/AIOSyncChannelServer.java
similarity index 89%
rename from activeio/src/java/org/activeio/net/AIOSyncChannelServer.java
rename to activeio/src/java/org/activeio/packet/async/aio/AIOSyncChannelServer.java
index d905eeaa7d..d58adc5404 100644
--- a/activeio/src/java/org/activeio/net/AIOSyncChannelServer.java
+++ b/activeio/src/java/org/activeio/packet/async/aio/AIOSyncChannelServer.java
@@ -16,18 +16,18 @@
*
**/
-package org.activeio.net;
+package org.activeio.packet.async.aio;
import java.io.IOException;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.net.URI;
-import org.activeio.AsyncChannel;
import org.activeio.Channel;
-import org.activeio.SyncChannelServer;
-import org.activeio.filter.WriteBufferedAsyncChannel;
import org.activeio.packet.ByteBufferPacket;
+import org.activeio.packet.async.AsyncChannel;
+import org.activeio.packet.async.filter.WriteBufferedAsyncChannel;
+import org.activeio.packet.sync.SyncChannelServer;
import com.ibm.io.async.AsyncServerSocketChannel;
@@ -66,7 +66,7 @@ public class AIOSyncChannelServer implements SyncChannelServer {
synchronized public void start() throws IOException {
}
- synchronized public void stop(long timeout) {
+ synchronized public void stop() {
}
public Channel accept(long timeout) throws IOException {
diff --git a/activeio/src/java/org/activeio/filter/AsyncWriteAsyncChannel.java b/activeio/src/java/org/activeio/packet/async/filter/AsyncWriteAsyncChannel.java
similarity index 95%
rename from activeio/src/java/org/activeio/filter/AsyncWriteAsyncChannel.java
rename to activeio/src/java/org/activeio/packet/async/filter/AsyncWriteAsyncChannel.java
index c858ff4f62..81499d4844 100644
--- a/activeio/src/java/org/activeio/filter/AsyncWriteAsyncChannel.java
+++ b/activeio/src/java/org/activeio/packet/async/filter/AsyncWriteAsyncChannel.java
@@ -1,4 +1,4 @@
-package org.activeio.filter;
+package org.activeio.packet.async.filter;
import edu.emory.mathcs.backport.java.util.concurrent.BlockingQueue;
import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch;
@@ -8,10 +8,10 @@ import edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor;
import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger;
-import org.activeio.AsyncChannel;
import org.activeio.ChannelFactory;
-import org.activeio.FilterAsyncChannel;
-import org.activeio.Packet;
+import org.activeio.packet.Packet;
+import org.activeio.packet.async.AsyncChannel;
+import org.activeio.packet.async.FilterAsyncChannel;
import java.io.IOException;
import java.io.InterruptedIOException;
@@ -133,7 +133,7 @@ public class AsyncWriteAsyncChannel extends FilterAsyncChannel {
flush(NO_WAIT_TIMEOUT);
}
- public void stop(long timeout) throws IOException {
+ public void stop() throws IOException {
flush(WAIT_FOREVER_TIMEOUT);
}
diff --git a/activeio/src/java/org/activeio/filter/CounterAsyncChannel.java b/activeio/src/java/org/activeio/packet/async/filter/CounterAsyncChannel.java
similarity index 80%
rename from activeio/src/java/org/activeio/filter/CounterAsyncChannel.java
rename to activeio/src/java/org/activeio/packet/async/filter/CounterAsyncChannel.java
index 6c23add409..71772d5117 100644
--- a/activeio/src/java/org/activeio/filter/CounterAsyncChannel.java
+++ b/activeio/src/java/org/activeio/packet/async/filter/CounterAsyncChannel.java
@@ -14,13 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio.filter;
+package org.activeio.packet.async.filter;
import java.io.IOException;
-import org.activeio.AsyncChannel;
-import org.activeio.FilterAsyncChannel;
-import org.activeio.Packet;
+import org.activeio.packet.Packet;
+import org.activeio.packet.async.AsyncChannel;
+import org.activeio.packet.async.FilterAsyncChannel;
/**
@@ -48,7 +48,7 @@ final public class CounterAsyncChannel extends FilterAsyncChannel {
}
/**
- * @see org.activeio.FilterAsyncChannel#onPacket(org.activeio.Packet)
+ * @see org.activeio.packet.async.FilterAsyncChannel#onPacket(org.activeio.packet.Packet)
*/
public void onPacket(Packet packet) {
inBoundCounter += packet.remaining();
@@ -56,7 +56,7 @@ final public class CounterAsyncChannel extends FilterAsyncChannel {
}
/**
- * @see org.activeio.FilterAsyncChannel#write(org.activeio.Packet)
+ * @see org.activeio.packet.async.FilterAsyncChannel#write(org.activeio.packet.Packet)
*/
public void write(Packet packet) throws IOException {
outBoundCounter += packet.position();
diff --git a/activeio/src/java/org/activeio/filter/PacketAggregatingAsyncChannel.java b/activeio/src/java/org/activeio/packet/async/filter/PacketAggregatingAsyncChannel.java
similarity index 86%
rename from activeio/src/java/org/activeio/filter/PacketAggregatingAsyncChannel.java
rename to activeio/src/java/org/activeio/packet/async/filter/PacketAggregatingAsyncChannel.java
index 12a96bd0e4..1687bdc694 100644
--- a/activeio/src/java/org/activeio/filter/PacketAggregatingAsyncChannel.java
+++ b/activeio/src/java/org/activeio/packet/async/filter/PacketAggregatingAsyncChannel.java
@@ -14,13 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio.filter;
+package org.activeio.packet.async.filter;
import java.io.IOException;
-import org.activeio.AsyncChannel;
-import org.activeio.FilterAsyncChannel;
-import org.activeio.Packet;
+import org.activeio.packet.Packet;
+import org.activeio.packet.async.AsyncChannel;
+import org.activeio.packet.async.FilterAsyncChannel;
+import org.activeio.util.PacketAggregator;
/**
* This PacketAggregatingAsyncChannel can be used when the client is sending a
diff --git a/activeio/src/java/org/activeio/filter/SynchornizedAsyncChannel.java b/activeio/src/java/org/activeio/packet/async/filter/SynchornizedAsyncChannel.java
similarity index 85%
rename from activeio/src/java/org/activeio/filter/SynchornizedAsyncChannel.java
rename to activeio/src/java/org/activeio/packet/async/filter/SynchornizedAsyncChannel.java
index ea9a53e328..27fdca720b 100644
--- a/activeio/src/java/org/activeio/filter/SynchornizedAsyncChannel.java
+++ b/activeio/src/java/org/activeio/packet/async/filter/SynchornizedAsyncChannel.java
@@ -14,14 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio.filter;
+package org.activeio.packet.async.filter;
import edu.emory.mathcs.backport.java.util.concurrent.locks.Lock;
import edu.emory.mathcs.backport.java.util.concurrent.locks.ReentrantLock;
-import org.activeio.AsyncChannel;
-import org.activeio.FilterAsyncChannel;
-import org.activeio.Packet;
+import org.activeio.packet.Packet;
+import org.activeio.packet.async.AsyncChannel;
+import org.activeio.packet.async.FilterAsyncChannel;
import java.io.IOException;
@@ -66,10 +66,6 @@ public class SynchornizedAsyncChannel extends FilterAsyncChannel {
}
}
- synchronized public void dispose() {
- super.dispose();
- }
-
synchronized public Object getAdapter(Class target) {
return super.getAdapter(target);
}
@@ -78,8 +74,8 @@ public class SynchornizedAsyncChannel extends FilterAsyncChannel {
super.start();
}
- synchronized public void stop(long timeout) throws IOException {
- super.stop(timeout);
+ synchronized public void stop() throws IOException {
+ super.stop();
}
public Lock getWriteLock() {
diff --git a/activeio/src/java/org/activeio/filter/WriteBufferedAsyncChannel.java b/activeio/src/java/org/activeio/packet/async/filter/WriteBufferedAsyncChannel.java
similarity index 89%
rename from activeio/src/java/org/activeio/filter/WriteBufferedAsyncChannel.java
rename to activeio/src/java/org/activeio/packet/async/filter/WriteBufferedAsyncChannel.java
index 5e8ea1b577..b8f630d65a 100644
--- a/activeio/src/java/org/activeio/filter/WriteBufferedAsyncChannel.java
+++ b/activeio/src/java/org/activeio/packet/async/filter/WriteBufferedAsyncChannel.java
@@ -14,14 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio.filter;
+package org.activeio.packet.async.filter;
import java.io.IOException;
-import org.activeio.AsyncChannel;
-import org.activeio.FilterAsyncChannel;
-import org.activeio.Packet;
import org.activeio.packet.ByteArrayPacket;
+import org.activeio.packet.Packet;
+import org.activeio.packet.async.AsyncChannel;
+import org.activeio.packet.async.FilterAsyncChannel;
/**
*/
diff --git a/activeio/src/java/org/activeio/net/NIOAsyncChannel.java b/activeio/src/java/org/activeio/packet/async/nio/NIOAsyncChannel.java
similarity index 89%
rename from activeio/src/java/org/activeio/net/NIOAsyncChannel.java
rename to activeio/src/java/org/activeio/packet/async/nio/NIOAsyncChannel.java
index 30c4f825cb..fb1ab12ab2 100644
--- a/activeio/src/java/org/activeio/net/NIOAsyncChannel.java
+++ b/activeio/src/java/org/activeio/packet/async/nio/NIOAsyncChannel.java
@@ -16,7 +16,7 @@
*
**/
-package org.activeio.net;
+package org.activeio.packet.async.nio;
import java.io.IOException;
import java.io.InterruptedIOException;
@@ -25,14 +25,15 @@ import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.SocketChannel;
-import org.activeio.AsyncChannel;
-import org.activeio.AsyncChannelListener;
-import org.activeio.ByteSequence;
-import org.activeio.Packet;
-import org.activeio.net.NIOAsyncChannelSelectorManager.SelectorManagerListener;
-import org.activeio.net.NIOAsyncChannelSelectorManager.SocketChannelAsyncChannelSelection;
import org.activeio.packet.ByteBufferPacket;
+import org.activeio.packet.ByteSequence;
import org.activeio.packet.EOSPacket;
+import org.activeio.packet.Packet;
+import org.activeio.packet.async.AsyncChannel;
+import org.activeio.packet.async.AsyncChannelListener;
+import org.activeio.packet.async.nio.NIOAsyncChannelSelectorManager.SelectorManagerListener;
+import org.activeio.packet.async.nio.NIOAsyncChannelSelectorManager.SocketChannelAsyncChannelSelection;
+import org.activeio.packet.sync.nio.NIOBaseChannel;
/**
* @version $Revision$
@@ -173,7 +174,7 @@ final public class NIOAsyncChannel extends NIOBaseChannel implements AsyncChanne
selection.setInterestOps(SelectionKey.OP_READ);
}
- public void stop(long timeout) throws IOException {
+ public void stop() throws IOException {
if( !running )
return;
running=false;
diff --git a/activeio/src/java/org/activeio/net/NIOAsyncChannelFactory.java b/activeio/src/java/org/activeio/packet/async/nio/NIOAsyncChannelFactory.java
similarity index 91%
rename from activeio/src/java/org/activeio/net/NIOAsyncChannelFactory.java
rename to activeio/src/java/org/activeio/packet/async/nio/NIOAsyncChannelFactory.java
index e227c1dd08..42ff00c1a0 100644
--- a/activeio/src/java/org/activeio/net/NIOAsyncChannelFactory.java
+++ b/activeio/src/java/org/activeio/packet/async/nio/NIOAsyncChannelFactory.java
@@ -15,7 +15,7 @@
* limitations under the License.
*
**/
-package org.activeio.net;
+package org.activeio.packet.async.nio;
import java.io.IOException;
import java.net.InetAddress;
@@ -25,12 +25,13 @@ import java.net.URISyntaxException;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
-import org.activeio.AsyncChannel;
-import org.activeio.AsyncChannelFactory;
-import org.activeio.AsyncChannelServer;
import org.activeio.adapter.SyncToAsyncChannelServer;
-import org.activeio.filter.WriteBufferedAsyncChannel;
import org.activeio.packet.ByteBufferPacket;
+import org.activeio.packet.async.AsyncChannel;
+import org.activeio.packet.async.AsyncChannelFactory;
+import org.activeio.packet.async.AsyncChannelServer;
+import org.activeio.packet.async.filter.WriteBufferedAsyncChannel;
+import org.activeio.util.URISupport;
/**
* A TcpAsyncChannelFactory creates {@see org.activeio.net.TcpAsyncChannel}
diff --git a/activeio/src/java/org/activeio/net/NIOAsyncChannelSelectorManager.java b/activeio/src/java/org/activeio/packet/async/nio/NIOAsyncChannelSelectorManager.java
similarity index 96%
rename from activeio/src/java/org/activeio/net/NIOAsyncChannelSelectorManager.java
rename to activeio/src/java/org/activeio/packet/async/nio/NIOAsyncChannelSelectorManager.java
index 7d3edc5644..9efb5677ba 100644
--- a/activeio/src/java/org/activeio/net/NIOAsyncChannelSelectorManager.java
+++ b/activeio/src/java/org/activeio/packet/async/nio/NIOAsyncChannelSelectorManager.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.activeio.net;
+package org.activeio.packet.async.nio;
import edu.emory.mathcs.backport.java.util.concurrent.Executor;
import edu.emory.mathcs.backport.java.util.concurrent.ScheduledThreadPoolExecutor;
diff --git a/activeio/src/java/org/activeio/net/NIOAsyncChannelServer.java b/activeio/src/java/org/activeio/packet/async/nio/NIOAsyncChannelServer.java
similarity index 84%
rename from activeio/src/java/org/activeio/net/NIOAsyncChannelServer.java
rename to activeio/src/java/org/activeio/packet/async/nio/NIOAsyncChannelServer.java
index 868ae3e67d..09f746ec17 100644
--- a/activeio/src/java/org/activeio/net/NIOAsyncChannelServer.java
+++ b/activeio/src/java/org/activeio/packet/async/nio/NIOAsyncChannelServer.java
@@ -16,16 +16,18 @@
*
**/
-package org.activeio.net;
+package org.activeio.packet.async.nio;
import java.io.IOException;
import java.net.URI;
import java.nio.channels.ServerSocketChannel;
-import org.activeio.AsyncChannel;
import org.activeio.Channel;
-import org.activeio.filter.WriteBufferedAsyncChannel;
import org.activeio.packet.ByteBufferPacket;
+import org.activeio.packet.async.AsyncChannel;
+import org.activeio.packet.async.filter.WriteBufferedAsyncChannel;
+import org.activeio.packet.sync.socket.SocketSyncChannelServer;
+import org.activeio.stream.sync.socket.SocketStreamChannel;
/**
* A SynchChannelServer that creates
diff --git a/activeio/src/java/org/activeio/net/VMPipeAsyncChannelFactory.java b/activeio/src/java/org/activeio/packet/async/vmpipe/VMPipeAsyncChannelFactory.java
similarity index 92%
rename from activeio/src/java/org/activeio/net/VMPipeAsyncChannelFactory.java
rename to activeio/src/java/org/activeio/packet/async/vmpipe/VMPipeAsyncChannelFactory.java
index ece27011ce..edc3a33cbe 100644
--- a/activeio/src/java/org/activeio/net/VMPipeAsyncChannelFactory.java
+++ b/activeio/src/java/org/activeio/packet/async/vmpipe/VMPipeAsyncChannelFactory.java
@@ -15,7 +15,7 @@
* limitations under the License.
*
**/
-package org.activeio.net;
+package org.activeio.packet.async.vmpipe;
import java.io.IOException;
import java.lang.reflect.InvocationHandler;
@@ -27,11 +27,11 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-import org.activeio.AsyncChannel;
-import org.activeio.AsyncChannelFactory;
-import org.activeio.AsyncChannelListener;
-import org.activeio.AsyncChannelServer;
-import org.activeio.Packet;
+import org.activeio.packet.Packet;
+import org.activeio.packet.async.AsyncChannel;
+import org.activeio.packet.async.AsyncChannelFactory;
+import org.activeio.packet.async.AsyncChannelListener;
+import org.activeio.packet.async.AsyncChannelServer;
/**
*
@@ -107,7 +107,7 @@ final public class VMPipeAsyncChannelFactory implements AsyncChannelFactory {
packetClazz = cl.loadClass(Packet.class.getName());
writeMethod = clazz.getMethod("write", new Class[] { packetClazz });
startMethod = clazz.getMethod("start", new Class[] { });
- stopMethod = clazz.getMethod("stop", new Class[] { long.class });
+ stopMethod = clazz.getMethod("stop", new Class[] {});
disposeMethod = clazz.getMethod("dispose", new Class[] { });
setListenerMethod = clazz.getMethod("setAsyncChannelListener", new Class[] { listenerClazz });
@@ -138,8 +138,8 @@ final public class VMPipeAsyncChannelFactory implements AsyncChannelFactory {
callIOExceptionMethod(startMethod, new Object[] {});
}
- public void stop(long timeout) throws IOException {
- callIOExceptionMethod(stopMethod, new Object[] {new Long(timeout)});
+ public void stop() throws IOException {
+ callIOExceptionMethod(stopMethod, new Object[] {});
}
private void callMethod(Method method, Object[] args) {
diff --git a/activeio/src/java/org/activeio/net/VMPipeAsyncChannelPipe.java b/activeio/src/java/org/activeio/packet/async/vmpipe/VMPipeAsyncChannelPipe.java
similarity index 86%
rename from activeio/src/java/org/activeio/net/VMPipeAsyncChannelPipe.java
rename to activeio/src/java/org/activeio/packet/async/vmpipe/VMPipeAsyncChannelPipe.java
index 51093418c0..79ae50625b 100644
--- a/activeio/src/java/org/activeio/net/VMPipeAsyncChannelPipe.java
+++ b/activeio/src/java/org/activeio/packet/async/vmpipe/VMPipeAsyncChannelPipe.java
@@ -15,15 +15,15 @@
* limitations under the License.
*
**/
-package org.activeio.net;
+package org.activeio.packet.async.vmpipe;
import java.io.IOException;
import java.io.InterruptedIOException;
-import org.activeio.AsyncChannel;
-import org.activeio.AsyncChannelListener;
-import org.activeio.Packet;
import org.activeio.packet.EOSPacket;
+import org.activeio.packet.Packet;
+import org.activeio.packet.async.AsyncChannel;
+import org.activeio.packet.async.AsyncChannelListener;
import edu.emory.mathcs.backport.java.util.concurrent.Semaphore;
import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
@@ -97,19 +97,11 @@ final public class VMPipeAsyncChannelPipe {
runMutext.release();
}
- public void stop(long timeout) throws IOException {
+ public void stop() throws IOException {
if(!running)
return;
try {
- if( timeout == NO_WAIT_TIMEOUT ) {
- if( !runMutext.tryAcquire(0, TimeUnit.MILLISECONDS) )
- return;
- } else if( timeout == WAIT_FOREVER_TIMEOUT ) {
- runMutext.acquire();
- } else {
- if( !runMutext.tryAcquire(timeout, TimeUnit.MILLISECONDS) )
- return;
- }
+ runMutext.tryAcquire(5, TimeUnit.SECONDS);
running=false;
} catch (InterruptedException e) {
throw new InterruptedIOException();
diff --git a/activeio/src/java/org/activeio/net/VMPipeAsyncChannelServer.java b/activeio/src/java/org/activeio/packet/async/vmpipe/VMPipeAsyncChannelServer.java
similarity index 89%
rename from activeio/src/java/org/activeio/net/VMPipeAsyncChannelServer.java
rename to activeio/src/java/org/activeio/packet/async/vmpipe/VMPipeAsyncChannelServer.java
index e4bbe78ac9..e68746fc5f 100644
--- a/activeio/src/java/org/activeio/net/VMPipeAsyncChannelServer.java
+++ b/activeio/src/java/org/activeio/packet/async/vmpipe/VMPipeAsyncChannelServer.java
@@ -16,14 +16,14 @@
*
**/
-package org.activeio.net;
+package org.activeio.packet.async.vmpipe;
import java.io.IOException;
import java.net.URI;
import org.activeio.AcceptListener;
-import org.activeio.AsyncChannel;
-import org.activeio.AsyncChannelServer;
+import org.activeio.packet.async.AsyncChannel;
+import org.activeio.packet.async.AsyncChannelServer;
/**
* @version $Revision$
@@ -60,7 +60,7 @@ final public class VMPipeAsyncChannelServer implements AsyncChannelServer {
throw new IOException("acceptListener has not been set.");
}
- public void stop(long timeout) {
+ public void stop() {
}
public Object getAdapter(Class target) {
diff --git a/activeio/src/java/org/activeio/FilterSyncChannel.java b/activeio/src/java/org/activeio/packet/sync/FilterSyncChannel.java
similarity index 84%
rename from activeio/src/java/org/activeio/FilterSyncChannel.java
rename to activeio/src/java/org/activeio/packet/sync/FilterSyncChannel.java
index dd78520f58..9c5a3d7839 100644
--- a/activeio/src/java/org/activeio/FilterSyncChannel.java
+++ b/activeio/src/java/org/activeio/packet/sync/FilterSyncChannel.java
@@ -14,10 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio;
+package org.activeio.packet.sync;
import java.io.IOException;
+import org.activeio.packet.Packet;
+
/**
* A SynchChannelFilter can be used as a filter another {@see org.activeio.SynchChannel}
@@ -35,7 +37,7 @@ public class FilterSyncChannel implements SyncChannel {
}
/**
- * @see org.activeio.Channel#write(org.activeio.Packet)
+ * @see org.activeio.Channel#write(org.activeio.packet.Packet)
*/
public void write(Packet packet) throws IOException {
next.write(packet);
@@ -63,10 +65,10 @@ public class FilterSyncChannel implements SyncChannel {
}
/**
- * @see org.activeio.Service#stop(long)
+ * @see org.activeio.Service#stop()
*/
- public void stop(long timeout) throws IOException {
- next.stop(timeout);
+ public void stop() throws IOException {
+ next.stop();
}
/**
@@ -77,7 +79,7 @@ public class FilterSyncChannel implements SyncChannel {
}
/**
- * @see org.activeio.SyncChannel#read(long)
+ * @see org.activeio.packet.sync.SyncChannel#read(long)
*/
public Packet read(long timeout) throws IOException {
return next.read(timeout);
diff --git a/activeio/src/java/org/activeio/FilterSyncChannelServer.java b/activeio/src/java/org/activeio/packet/sync/FilterSyncChannelServer.java
similarity index 86%
rename from activeio/src/java/org/activeio/FilterSyncChannelServer.java
rename to activeio/src/java/org/activeio/packet/sync/FilterSyncChannelServer.java
index 58c12f36e9..6bd29758bc 100644
--- a/activeio/src/java/org/activeio/FilterSyncChannelServer.java
+++ b/activeio/src/java/org/activeio/packet/sync/FilterSyncChannelServer.java
@@ -14,11 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio;
+package org.activeio.packet.sync;
import java.io.IOException;
import java.net.URI;
+import org.activeio.Channel;
+
/**
* A SynchChannelFilter can be used as a filter another {@see org.activeio.SynchChannel}
@@ -50,10 +52,10 @@ public class FilterSyncChannelServer implements SyncChannelServer {
}
/**
- * @see org.activeio.Service#stop(long)
+ * @see org.activeio.Service#stop()
*/
- public void stop(long timeout) throws IOException {
- next.stop(timeout);
+ public void stop() throws IOException {
+ next.stop();
}
/**
@@ -64,7 +66,7 @@ public class FilterSyncChannelServer implements SyncChannelServer {
}
/**
- * @see org.activeio.SyncChannelServer#accept(long)
+ * @see org.activeio.packet.sync.SyncChannelServer#accept(long)
*/
public Channel accept(long timeout) throws IOException {
return next.accept(timeout);
diff --git a/activeio/src/java/org/activeio/packet/sync/SyncChannel.java b/activeio/src/java/org/activeio/packet/sync/SyncChannel.java
new file mode 100644
index 0000000000..12c3dd58c8
--- /dev/null
+++ b/activeio/src/java/org/activeio/packet/sync/SyncChannel.java
@@ -0,0 +1,59 @@
+/**
+ *
+ * Copyright 2004 Hiram Chirino
+ *
+ * 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.
+ */
+
+package org.activeio.packet.sync;
+
+import java.io.IOException;
+
+import org.activeio.Channel;
+import org.activeio.packet.Packet;
+
+
+/**
+ * SyncChannel objects allow threaded to synchronously block on the receiveUpPacket
+ * method to get 'up' {@see org.activeio.Packet} objects when they arrive.
+ *
+ * @version $Revision$
+ */
+public interface SyncChannel extends Channel {
+
+ /**
+ * Used to synchronously receive a packet of information going 'up' the channel.
+ * This method blocks until a packet is received or the operation experiences timeout.
+ *
+ * @param timeout
+ * @return the packet received or null if the timeout occurred.
+ * @throws IOException
+ */
+ Packet read(long timeout) throws IOException;
+
+ /**
+ * Sends a packet down the channel towards the media.
+ *
+ * @param packet
+ * @throws IOException
+ */
+ void write(Packet packet) throws IOException;
+
+ /**
+ * Some channels may buffer data which may be sent down if flush() is called.
+ *
+ * @throws IOException
+ */
+ void flush() throws IOException;
+
+}
diff --git a/activeio/src/java/org/activeio/SyncChannelFactory.java b/activeio/src/java/org/activeio/packet/sync/SyncChannelFactory.java
similarity index 93%
rename from activeio/src/java/org/activeio/SyncChannelFactory.java
rename to activeio/src/java/org/activeio/packet/sync/SyncChannelFactory.java
index fc60411c63..7da1e22e16 100644
--- a/activeio/src/java/org/activeio/SyncChannelFactory.java
+++ b/activeio/src/java/org/activeio/packet/sync/SyncChannelFactory.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio;
+package org.activeio.packet.sync;
import java.io.IOException;
import java.net.URI;
diff --git a/activeio/src/java/org/activeio/SyncChannelServer.java b/activeio/src/java/org/activeio/packet/sync/SyncChannelServer.java
similarity index 88%
rename from activeio/src/java/org/activeio/SyncChannelServer.java
rename to activeio/src/java/org/activeio/packet/sync/SyncChannelServer.java
index ac7a9f58d8..b708811fb3 100644
--- a/activeio/src/java/org/activeio/SyncChannelServer.java
+++ b/activeio/src/java/org/activeio/packet/sync/SyncChannelServer.java
@@ -14,10 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio;
+package org.activeio.packet.sync;
import java.io.IOException;
+import org.activeio.Channel;
+import org.activeio.ChannelServer;
+
/**
diff --git a/activeio/src/java/org/activeio/net/DatagramContext.java b/activeio/src/java/org/activeio/packet/sync/datagram/DatagramContext.java
similarity index 91%
rename from activeio/src/java/org/activeio/net/DatagramContext.java
rename to activeio/src/java/org/activeio/packet/sync/datagram/DatagramContext.java
index db47902f48..bcae0a5524 100644
--- a/activeio/src/java/org/activeio/net/DatagramContext.java
+++ b/activeio/src/java/org/activeio/packet/sync/datagram/DatagramContext.java
@@ -4,7 +4,7 @@
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
-package org.activeio.net;
+package org.activeio.packet.sync.datagram;
import java.net.DatagramPacket;
import java.net.InetAddress;
diff --git a/activeio/src/java/org/activeio/net/DatagramSocketSyncChannel.java b/activeio/src/java/org/activeio/packet/sync/datagram/DatagramSocketSyncChannel.java
similarity index 86%
rename from activeio/src/java/org/activeio/net/DatagramSocketSyncChannel.java
rename to activeio/src/java/org/activeio/packet/sync/datagram/DatagramSocketSyncChannel.java
index bc31ccc3d4..446d9b7599 100644
--- a/activeio/src/java/org/activeio/net/DatagramSocketSyncChannel.java
+++ b/activeio/src/java/org/activeio/packet/sync/datagram/DatagramSocketSyncChannel.java
@@ -16,7 +16,7 @@
*
**/
-package org.activeio.net;
+package org.activeio.packet.sync.datagram;
import java.io.IOException;
import java.net.DatagramPacket;
@@ -24,12 +24,12 @@ import java.net.DatagramSocket;
import java.net.SocketException;
import java.net.SocketTimeoutException;
-import org.activeio.ByteSequence;
-import org.activeio.Packet;
-import org.activeio.SyncChannel;
-import org.activeio.SyncChannelServer;
import org.activeio.packet.ByteArrayPacket;
+import org.activeio.packet.ByteSequence;
import org.activeio.packet.FilterPacket;
+import org.activeio.packet.Packet;
+import org.activeio.packet.sync.SyncChannel;
+import org.activeio.packet.sync.SyncChannelServer;
/**
* A {@see org.activeio.SynchChannel}implementation that uses
@@ -84,9 +84,9 @@ public class DatagramSocketSyncChannel implements SyncChannel {
}
/**
- * @see org.activeio.SyncChannel#read(long)
+ * @see org.activeio.packet.sync.SyncChannel#read(long)
*/
- public org.activeio.Packet read(long timeout) throws IOException {
+ public org.activeio.packet.Packet read(long timeout) throws IOException {
try {
if (timeout == SyncChannelServer.WAIT_FOREVER_TIMEOUT)
@@ -117,9 +117,9 @@ public class DatagramSocketSyncChannel implements SyncChannel {
}
/**
- * @see org.activeio.Channel#write(org.activeio.Packet)
+ * @see org.activeio.Channel#write(org.activeio.packet.Packet)
*/
- public void write(org.activeio.Packet packet) throws IOException {
+ public void write(org.activeio.packet.Packet packet) throws IOException {
ByteSequence sequence = packet.asByteSequence();
DatagramContext context = (DatagramContext) packet.getAdapter(DatagramContext.class);
@@ -149,7 +149,7 @@ public class DatagramSocketSyncChannel implements SyncChannel {
public void start() throws IOException {
}
- public void stop(long timeout) throws IOException {
+ public void stop() throws IOException {
}
diff --git a/activeio/src/java/org/activeio/net/DatagramSocketSyncChannelFactory.java b/activeio/src/java/org/activeio/packet/sync/datagram/DatagramSocketSyncChannelFactory.java
similarity index 90%
rename from activeio/src/java/org/activeio/net/DatagramSocketSyncChannelFactory.java
rename to activeio/src/java/org/activeio/packet/sync/datagram/DatagramSocketSyncChannelFactory.java
index c424aa5e28..4c60c34d45 100644
--- a/activeio/src/java/org/activeio/net/DatagramSocketSyncChannelFactory.java
+++ b/activeio/src/java/org/activeio/packet/sync/datagram/DatagramSocketSyncChannelFactory.java
@@ -15,16 +15,16 @@
* limitations under the License.
*
**/
-package org.activeio.net;
+package org.activeio.packet.sync.datagram;
import java.io.IOException;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.URI;
-import org.activeio.SyncChannel;
-import org.activeio.SyncChannelFactory;
-import org.activeio.SyncChannelServer;
+import org.activeio.packet.sync.SyncChannel;
+import org.activeio.packet.sync.SyncChannelFactory;
+import org.activeio.packet.sync.SyncChannelServer;
/**
* A TcpSynchChannelFactory creates {@see org.activeio.net.TcpSynchChannel}
diff --git a/activeio/src/java/org/activeio/filter/PacketAggregatingSyncChannel.java b/activeio/src/java/org/activeio/packet/sync/filter/PacketAggregatingSyncChannel.java
similarity index 90%
rename from activeio/src/java/org/activeio/filter/PacketAggregatingSyncChannel.java
rename to activeio/src/java/org/activeio/packet/sync/filter/PacketAggregatingSyncChannel.java
index d2d42d5c92..6314af6ca5 100644
--- a/activeio/src/java/org/activeio/filter/PacketAggregatingSyncChannel.java
+++ b/activeio/src/java/org/activeio/packet/sync/filter/PacketAggregatingSyncChannel.java
@@ -14,14 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio.filter;
+package org.activeio.packet.sync.filter;
import java.io.IOException;
import java.util.LinkedList;
-import org.activeio.FilterSyncChannel;
-import org.activeio.Packet;
-import org.activeio.SyncChannel;
+import org.activeio.packet.Packet;
+import org.activeio.packet.sync.FilterSyncChannel;
+import org.activeio.packet.sync.SyncChannel;
+import org.activeio.util.PacketAggregator;
/**
* This PacketAggregatingSynchChannel can be used when the client is sending a
diff --git a/activeio/src/java/org/activeio/filter/PushbackSyncChannel.java b/activeio/src/java/org/activeio/packet/sync/filter/PushbackSyncChannel.java
similarity index 84%
rename from activeio/src/java/org/activeio/filter/PushbackSyncChannel.java
rename to activeio/src/java/org/activeio/packet/sync/filter/PushbackSyncChannel.java
index 8b3ec813b0..b2d37a1a36 100644
--- a/activeio/src/java/org/activeio/filter/PushbackSyncChannel.java
+++ b/activeio/src/java/org/activeio/packet/sync/filter/PushbackSyncChannel.java
@@ -15,13 +15,13 @@
* limitations under the License.
*
**/
-package org.activeio.filter;
+package org.activeio.packet.sync.filter;
import java.io.IOException;
-import org.activeio.FilterSyncChannel;
-import org.activeio.Packet;
-import org.activeio.SyncChannel;
+import org.activeio.packet.Packet;
+import org.activeio.packet.sync.FilterSyncChannel;
+import org.activeio.packet.sync.SyncChannel;
/**
*
diff --git a/activeio/src/java/org/activeio/filter/SynchornizedSyncChannel.java b/activeio/src/java/org/activeio/packet/sync/filter/SynchornizedSyncChannel.java
similarity index 87%
rename from activeio/src/java/org/activeio/filter/SynchornizedSyncChannel.java
rename to activeio/src/java/org/activeio/packet/sync/filter/SynchornizedSyncChannel.java
index 15cabda83c..dcfa1e3cd6 100644
--- a/activeio/src/java/org/activeio/filter/SynchornizedSyncChannel.java
+++ b/activeio/src/java/org/activeio/packet/sync/filter/SynchornizedSyncChannel.java
@@ -14,20 +14,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio.filter;
+package org.activeio.packet.sync.filter;
+
+import java.io.IOException;
+import java.io.InterruptedIOException;
+
+import org.activeio.packet.Packet;
+import org.activeio.packet.sync.FilterSyncChannel;
+import org.activeio.packet.sync.SyncChannel;
+import org.activeio.packet.sync.SyncChannelServer;
import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
import edu.emory.mathcs.backport.java.util.concurrent.locks.Lock;
import edu.emory.mathcs.backport.java.util.concurrent.locks.ReentrantLock;
-import org.activeio.FilterSyncChannel;
-import org.activeio.Packet;
-import org.activeio.SyncChannel;
-import org.activeio.SyncChannelServer;
-
-import java.io.IOException;
-import java.io.InterruptedIOException;
-
/**
* Used to synchronize concurrent access to a SynchChannel.
*
@@ -96,10 +96,6 @@ public class SynchornizedSyncChannel extends FilterSyncChannel {
}
}
- synchronized public void dispose() {
- super.dispose();
- }
-
synchronized public Object getAdapter(Class target) {
return super.getAdapter(target);
}
@@ -108,8 +104,8 @@ public class SynchornizedSyncChannel extends FilterSyncChannel {
super.start();
}
- synchronized public void stop(long timeout) throws IOException {
- super.stop(timeout);
+ synchronized public void stop() throws IOException {
+ super.stop();
}
public Lock getReadLock() {
diff --git a/activeio/src/java/org/activeio/filter/WriteBufferedSyncChannel.java b/activeio/src/java/org/activeio/packet/sync/filter/WriteBufferedSyncChannel.java
similarity index 89%
rename from activeio/src/java/org/activeio/filter/WriteBufferedSyncChannel.java
rename to activeio/src/java/org/activeio/packet/sync/filter/WriteBufferedSyncChannel.java
index 70d13b6360..ca57cf7289 100644
--- a/activeio/src/java/org/activeio/filter/WriteBufferedSyncChannel.java
+++ b/activeio/src/java/org/activeio/packet/sync/filter/WriteBufferedSyncChannel.java
@@ -14,14 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio.filter;
+package org.activeio.packet.sync.filter;
import java.io.IOException;
-import org.activeio.FilterSyncChannel;
-import org.activeio.Packet;
-import org.activeio.SyncChannel;
import org.activeio.packet.ByteArrayPacket;
+import org.activeio.packet.Packet;
+import org.activeio.packet.sync.FilterSyncChannel;
+import org.activeio.packet.sync.SyncChannel;
/**
*/
diff --git a/activeio/src/java/org/activeio/net/JxtaSocketSyncChannelFactory.java b/activeio/src/java/org/activeio/packet/sync/jxta/JxtaSocketSyncChannelFactory.java
similarity index 94%
rename from activeio/src/java/org/activeio/net/JxtaSocketSyncChannelFactory.java
rename to activeio/src/java/org/activeio/packet/sync/jxta/JxtaSocketSyncChannelFactory.java
index 735141b710..a1a20d91b2 100644
--- a/activeio/src/java/org/activeio/net/JxtaSocketSyncChannelFactory.java
+++ b/activeio/src/java/org/activeio/packet/sync/jxta/JxtaSocketSyncChannelFactory.java
@@ -15,7 +15,7 @@
* limitations under the License.
*
**/
-package org.activeio.net;
+package org.activeio.packet.sync.jxta;
import java.io.IOException;
import java.net.InetAddress;
@@ -26,6 +26,7 @@ import java.net.UnknownHostException;
import javax.net.ServerSocketFactory;
import javax.net.SocketFactory;
+import org.activeio.packet.sync.socket.SocketSyncChannelFactory;
import org.p2psockets.P2PServerSocket;
import org.p2psockets.P2PSocket;
diff --git a/activeio/src/java/org/activeio/net/MulticastSocketSyncChannel.java b/activeio/src/java/org/activeio/packet/sync/multicast/MulticastSocketSyncChannel.java
similarity index 87%
rename from activeio/src/java/org/activeio/net/MulticastSocketSyncChannel.java
rename to activeio/src/java/org/activeio/packet/sync/multicast/MulticastSocketSyncChannel.java
index 63ef600683..cbb80323e1 100644
--- a/activeio/src/java/org/activeio/net/MulticastSocketSyncChannel.java
+++ b/activeio/src/java/org/activeio/packet/sync/multicast/MulticastSocketSyncChannel.java
@@ -14,12 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio.net;
+package org.activeio.packet.sync.multicast;
import java.io.IOException;
import java.net.InetAddress;
import java.net.MulticastSocket;
+import org.activeio.packet.sync.datagram.DatagramSocketSyncChannel;
+
/**
* @version $Revision$
@@ -38,7 +40,7 @@ final public class MulticastSocketSyncChannel extends DatagramSocketSyncChannel
((MulticastSocket) getSocket()).joinGroup(groupAddress);
}
- public void stop(long timeout) throws IOException {
+ public void stop() throws IOException {
((MulticastSocket) getSocket()).leaveGroup(groupAddress);
}
diff --git a/activeio/src/java/org/activeio/net/MulticastSocketSyncChannelFactory.java b/activeio/src/java/org/activeio/packet/sync/multicast/MulticastSocketSyncChannelFactory.java
similarity index 91%
rename from activeio/src/java/org/activeio/net/MulticastSocketSyncChannelFactory.java
rename to activeio/src/java/org/activeio/packet/sync/multicast/MulticastSocketSyncChannelFactory.java
index 400ea4a3a3..e46f81f654 100644
--- a/activeio/src/java/org/activeio/net/MulticastSocketSyncChannelFactory.java
+++ b/activeio/src/java/org/activeio/packet/sync/multicast/MulticastSocketSyncChannelFactory.java
@@ -14,15 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio.net;
+package org.activeio.packet.sync.multicast;
import java.io.IOException;
import java.net.InetAddress;
import java.net.MulticastSocket;
import java.net.URI;
-import org.activeio.SyncChannel;
-import org.activeio.SyncChannelServer;
+import org.activeio.packet.sync.SyncChannel;
+import org.activeio.packet.sync.SyncChannelServer;
/**
diff --git a/activeio/src/java/org/activeio/net/NIOBaseChannel.java b/activeio/src/java/org/activeio/packet/sync/nio/NIOBaseChannel.java
similarity index 93%
rename from activeio/src/java/org/activeio/net/NIOBaseChannel.java
rename to activeio/src/java/org/activeio/packet/sync/nio/NIOBaseChannel.java
index ee537042ce..911ae92249 100644
--- a/activeio/src/java/org/activeio/net/NIOBaseChannel.java
+++ b/activeio/src/java/org/activeio/packet/sync/nio/NIOBaseChannel.java
@@ -16,7 +16,7 @@
*
**/
-package org.activeio.net;
+package org.activeio.packet.sync.nio;
import java.io.IOException;
import java.net.InetAddress;
@@ -26,15 +26,15 @@ import java.net.SocketException;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;
-import org.activeio.Disposable;
import org.activeio.packet.ByteBufferPacket;
+import org.activeio.stream.sync.socket.SocketMetadata;
/**
* Base class for the Async and Sync implementations of NIO channels.
*
* @version $Revision$
*/
-public class NIOBaseChannel implements SocketMetadata, Disposable {
+public class NIOBaseChannel implements SocketMetadata {
protected final SocketChannel socketChannel;
protected final Socket socket;
@@ -67,7 +67,7 @@ public class NIOBaseChannel implements SocketMetadata, Disposable {
}
}
- protected void setSoTimeout(int i) throws SocketException {
+ public void setSoTimeout(int i) throws SocketException {
if( curentSoTimeout != i ) {
socket.setSoTimeout(i);
curentSoTimeout = i;
diff --git a/activeio/src/java/org/activeio/net/NIOSyncChannel.java b/activeio/src/java/org/activeio/packet/sync/nio/NIOSyncChannel.java
similarity index 90%
rename from activeio/src/java/org/activeio/net/NIOSyncChannel.java
rename to activeio/src/java/org/activeio/packet/sync/nio/NIOSyncChannel.java
index 4a15fe63ac..096bd9d7cc 100644
--- a/activeio/src/java/org/activeio/net/NIOSyncChannel.java
+++ b/activeio/src/java/org/activeio/packet/sync/nio/NIOSyncChannel.java
@@ -16,20 +16,20 @@
*
**/
-package org.activeio.net;
+package org.activeio.packet.sync.nio;
import java.io.IOException;
import java.net.SocketTimeoutException;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;
-import org.activeio.ByteSequence;
-import org.activeio.Packet;
-import org.activeio.SyncChannel;
-import org.activeio.SyncChannelServer;
import org.activeio.packet.ByteBufferPacket;
+import org.activeio.packet.ByteSequence;
import org.activeio.packet.EOSPacket;
import org.activeio.packet.EmptyPacket;
+import org.activeio.packet.Packet;
+import org.activeio.packet.sync.SyncChannel;
+import org.activeio.packet.sync.SyncChannelServer;
/**
* A {@see org.activeio.SynchChannel} implementation that uses a {@see java.nio.channels.SocketChannel}
@@ -99,7 +99,7 @@ final public class NIOSyncChannel extends NIOBaseChannel implements SyncChannel
public void start() throws IOException {
}
- public void stop(long timeout) throws IOException {
+ public void stop() throws IOException {
}
}
\ No newline at end of file
diff --git a/activeio/src/java/org/activeio/net/NIOSyncChannelFactory.java b/activeio/src/java/org/activeio/packet/sync/nio/NIOSyncChannelFactory.java
similarity index 91%
rename from activeio/src/java/org/activeio/net/NIOSyncChannelFactory.java
rename to activeio/src/java/org/activeio/packet/sync/nio/NIOSyncChannelFactory.java
index da75a8ba09..7616109ecc 100644
--- a/activeio/src/java/org/activeio/net/NIOSyncChannelFactory.java
+++ b/activeio/src/java/org/activeio/packet/sync/nio/NIOSyncChannelFactory.java
@@ -15,7 +15,7 @@
* limitations under the License.
*
**/
-package org.activeio.net;
+package org.activeio.packet.sync.nio;
import java.io.IOException;
import java.net.InetAddress;
@@ -25,11 +25,12 @@ import java.net.URISyntaxException;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
-import org.activeio.SyncChannel;
-import org.activeio.SyncChannelFactory;
-import org.activeio.SyncChannelServer;
-import org.activeio.filter.WriteBufferedSyncChannel;
import org.activeio.packet.ByteBufferPacket;
+import org.activeio.packet.sync.SyncChannel;
+import org.activeio.packet.sync.SyncChannelFactory;
+import org.activeio.packet.sync.SyncChannelServer;
+import org.activeio.packet.sync.filter.WriteBufferedSyncChannel;
+import org.activeio.util.URISupport;
/**
* A TcpSynchChannelFactory creates {@see org.activeio.net.TcpSynchChannel}
diff --git a/activeio/src/java/org/activeio/net/NIOSyncChannelServer.java b/activeio/src/java/org/activeio/packet/sync/nio/NIOSyncChannelServer.java
similarity index 84%
rename from activeio/src/java/org/activeio/net/NIOSyncChannelServer.java
rename to activeio/src/java/org/activeio/packet/sync/nio/NIOSyncChannelServer.java
index 9d9238cb30..f4d21eddc3 100644
--- a/activeio/src/java/org/activeio/net/NIOSyncChannelServer.java
+++ b/activeio/src/java/org/activeio/packet/sync/nio/NIOSyncChannelServer.java
@@ -16,16 +16,18 @@
*
**/
-package org.activeio.net;
+package org.activeio.packet.sync.nio;
import java.io.IOException;
import java.net.URI;
import java.nio.channels.ServerSocketChannel;
import org.activeio.Channel;
-import org.activeio.SyncChannel;
-import org.activeio.filter.WriteBufferedSyncChannel;
import org.activeio.packet.ByteBufferPacket;
+import org.activeio.packet.sync.SyncChannel;
+import org.activeio.packet.sync.filter.WriteBufferedSyncChannel;
+import org.activeio.packet.sync.socket.SocketSyncChannelServer;
+import org.activeio.stream.sync.socket.SocketStreamChannel;
/**
* A SynchChannelServer that creates
diff --git a/activeio/src/java/org/activeio/packet/sync/socket/SocketSyncChannel.java b/activeio/src/java/org/activeio/packet/sync/socket/SocketSyncChannel.java
new file mode 100644
index 0000000000..33109bccab
--- /dev/null
+++ b/activeio/src/java/org/activeio/packet/sync/socket/SocketSyncChannel.java
@@ -0,0 +1,145 @@
+/**
+ *
+ * Copyright 2004 Hiram Chirino
+ *
+ * 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.
+ *
+ **/
+
+package org.activeio.packet.sync.socket;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.Socket;
+import java.net.SocketTimeoutException;
+
+import org.activeio.packet.ByteArrayPacket;
+import org.activeio.packet.ByteSequence;
+import org.activeio.packet.EOSPacket;
+import org.activeio.packet.EmptyPacket;
+import org.activeio.packet.Packet;
+import org.activeio.packet.sync.SyncChannel;
+import org.activeio.packet.sync.SyncChannelServer;
+import org.activeio.stream.sync.socket.SocketStreamChannel;
+
+/**
+ * A {@see org.activeio.SynchChannel} implementation that uses a {@see java.net.Socket}
+ * to talk to the network.
+ *
+ * @version $Revision$
+ */
+public class SocketSyncChannel implements SyncChannel {
+
+ protected static final int DEFAULT_BUFFER_SIZE = 64 * 1024;
+ private final SocketStreamChannel channel;
+ private Packet inputPacket;
+ private final OutputStream os;
+ private final InputStream is;
+
+ protected SocketSyncChannel(Socket socket) throws IOException {
+ this(new SocketStreamChannel(socket));
+ }
+
+ public SocketSyncChannel(SocketStreamChannel channel) throws IOException {
+ this.channel = channel;
+ os = channel.getOutputStream();
+ is = channel.getInputStream();
+ channel.setReceiveBufferSize(DEFAULT_BUFFER_SIZE);
+ channel.setSendBufferSize(DEFAULT_BUFFER_SIZE);
+ }
+
+ /**
+ * @see org.activeio.SynchChannel#read(long)
+ */
+ synchronized public org.activeio.packet.Packet read(long timeout) throws IOException {
+ try {
+
+ if( timeout==SyncChannelServer.WAIT_FOREVER_TIMEOUT )
+ channel.setSoTimeout( 0 );
+ else if( timeout==SyncChannelServer.NO_WAIT_TIMEOUT )
+ channel.setSoTimeout( 1 );
+ else
+ channel.setSoTimeout( (int)timeout );
+
+ if( inputPacket==null || !inputPacket.hasRemaining() ) {
+ inputPacket = allocatePacket();
+ }
+
+ ByteSequence sequence = inputPacket.asByteSequence();
+ int size = is.read(sequence.getData(), sequence.getOffset(), sequence.getLength());
+ if( size == -1 )
+ return EOSPacket.EOS_PACKET;
+ if( size == 0 )
+ return EmptyPacket.EMPTY_PACKET;
+ inputPacket.position(size);
+
+ Packet remaining = inputPacket.slice();
+
+ inputPacket.flip();
+ Packet data = inputPacket.slice();
+
+ // Keep the remaining buffer around to fill with data.
+ inputPacket = remaining;
+ return data;
+
+ } catch (SocketTimeoutException e) {
+ return null;
+ }
+ }
+
+ private Packet allocatePacket() {
+ byte[] data = new byte[DEFAULT_BUFFER_SIZE];
+ return new ByteArrayPacket(data);
+ }
+
+
+ /**
+ * @see org.activeio.Channel#write(org.activeio.packet.Packet)
+ */
+ public void write(Packet packet) throws IOException {
+ packet.writeTo(os);
+ }
+
+ /**
+ * @see org.activeio.Channel#flush()
+ */
+ public void flush() throws IOException {
+ os.flush();
+ }
+
+ /**
+ * @see org.activeio.Disposable#dispose()
+ */
+ public void dispose() {
+ channel.dispose();
+ }
+
+ public void start() throws IOException {
+ channel.start();
+ }
+ public void stop() throws IOException {
+ channel.stop();
+ }
+
+ public Object getAdapter(Class target) {
+ if( target.isAssignableFrom(getClass()) ) {
+ return this;
+ }
+ return channel.getAdapter(target);
+ }
+
+ public String toString() {
+ return channel.toString();
+ }
+}
\ No newline at end of file
diff --git a/activeio/src/java/org/activeio/net/SocketSyncChannelFactory.java b/activeio/src/java/org/activeio/packet/sync/socket/SocketSyncChannelFactory.java
similarity index 83%
rename from activeio/src/java/org/activeio/net/SocketSyncChannelFactory.java
rename to activeio/src/java/org/activeio/packet/sync/socket/SocketSyncChannelFactory.java
index 28402d667e..2014c7d038 100644
--- a/activeio/src/java/org/activeio/net/SocketSyncChannelFactory.java
+++ b/activeio/src/java/org/activeio/packet/sync/socket/SocketSyncChannelFactory.java
@@ -15,7 +15,7 @@
* limitations under the License.
*
**/
-package org.activeio.net;
+package org.activeio.packet.sync.socket;
import java.io.IOException;
import java.net.URI;
@@ -23,10 +23,13 @@ import java.net.URI;
import javax.net.ServerSocketFactory;
import javax.net.SocketFactory;
-import org.activeio.StreamChannelServer;
-import org.activeio.SyncChannel;
-import org.activeio.SyncChannelFactory;
-import org.activeio.SyncChannelServer;
+import org.activeio.packet.sync.SyncChannel;
+import org.activeio.packet.sync.SyncChannelFactory;
+import org.activeio.packet.sync.SyncChannelServer;
+import org.activeio.stream.sync.StreamChannelServer;
+import org.activeio.stream.sync.socket.SocketStreamChannel;
+import org.activeio.stream.sync.socket.SocketStreamChannelFactory;
+import org.activeio.stream.sync.socket.SocketStreamChannelServer;
/**
* A TcpSynchChannelFactory creates {@see org.activeio.net.TcpSynchChannel}
diff --git a/activeio/src/java/org/activeio/net/SocketSyncChannelServer.java b/activeio/src/java/org/activeio/packet/sync/socket/SocketSyncChannelServer.java
similarity index 86%
rename from activeio/src/java/org/activeio/net/SocketSyncChannelServer.java
rename to activeio/src/java/org/activeio/packet/sync/socket/SocketSyncChannelServer.java
index 0ba0df4355..3db7c959ba 100644
--- a/activeio/src/java/org/activeio/net/SocketSyncChannelServer.java
+++ b/activeio/src/java/org/activeio/packet/sync/socket/SocketSyncChannelServer.java
@@ -16,14 +16,16 @@
*
**/
-package org.activeio.net;
+package org.activeio.packet.sync.socket;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.URI;
import org.activeio.Channel;
-import org.activeio.SyncChannelServer;
+import org.activeio.packet.sync.SyncChannelServer;
+import org.activeio.stream.sync.socket.SocketStreamChannel;
+import org.activeio.stream.sync.socket.SocketStreamChannelServer;
/**
* A SynchChannelServer that creates
@@ -81,8 +83,8 @@ public class SocketSyncChannelServer implements SyncChannelServer {
server.start();
}
- public void stop(long timeout) throws IOException {
- server.stop(timeout);
+ public void stop() throws IOException {
+ server.stop();
}
public Object getAdapter(Class target) {
diff --git a/activeio/src/java/org/activeio/net/SslSocketSyncChannelFactory.java b/activeio/src/java/org/activeio/packet/sync/ssl/SslSocketSyncChannelFactory.java
similarity index 88%
rename from activeio/src/java/org/activeio/net/SslSocketSyncChannelFactory.java
rename to activeio/src/java/org/activeio/packet/sync/ssl/SslSocketSyncChannelFactory.java
index bf74b73616..e8a3c706bc 100644
--- a/activeio/src/java/org/activeio/net/SslSocketSyncChannelFactory.java
+++ b/activeio/src/java/org/activeio/packet/sync/ssl/SslSocketSyncChannelFactory.java
@@ -15,11 +15,13 @@
* limitations under the License.
*
**/
-package org.activeio.net;
+package org.activeio.packet.sync.ssl;
import javax.net.ssl.SSLServerSocketFactory;
import javax.net.ssl.SSLSocketFactory;
+import org.activeio.packet.sync.socket.SocketSyncChannelFactory;
+
/**
* A SslSynchChannelFactory creates {@see org.activeio.net.TcpSynchChannel}
* and {@see org.activeio.net.TcpSynchChannelServer} objects that use SSL.
diff --git a/activeio/src/java/org/activeio/AsyncChannel.java b/activeio/src/java/org/activeio/stream/sync/StreamChannel.java
similarity index 65%
rename from activeio/src/java/org/activeio/AsyncChannel.java
rename to activeio/src/java/org/activeio/stream/sync/StreamChannel.java
index d025c82fe9..3a1715cd2c 100644
--- a/activeio/src/java/org/activeio/AsyncChannel.java
+++ b/activeio/src/java/org/activeio/stream/sync/StreamChannel.java
@@ -15,16 +15,19 @@
* limitations under the License.
*/
-package org.activeio;
+package org.activeio.stream.sync;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.activeio.Channel;
/**
- * AsyncChannel objects asynchronously push 'up' {@see org.activeio.Packet} objects
- * to a registered {@see org.activeio.ChannelConsumer}.
- *
* @version $Revision$
*/
-public interface AsyncChannel extends InputAsyncChannel, OutputChannel {
-
+public interface StreamChannel extends Channel {
+ InputStream getInputStream() throws IOException;
+ OutputStream getOutputStream() throws IOException;
}
diff --git a/activeio/src/java/org/activeio/StreamChannelFactory.java b/activeio/src/java/org/activeio/stream/sync/StreamChannelFactory.java
similarity index 93%
rename from activeio/src/java/org/activeio/StreamChannelFactory.java
rename to activeio/src/java/org/activeio/stream/sync/StreamChannelFactory.java
index d0c050783c..a0717cd548 100644
--- a/activeio/src/java/org/activeio/StreamChannelFactory.java
+++ b/activeio/src/java/org/activeio/stream/sync/StreamChannelFactory.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio;
+package org.activeio.stream.sync;
import java.io.IOException;
import java.net.URI;
diff --git a/activeio/src/java/org/activeio/StreamChannelServer.java b/activeio/src/java/org/activeio/stream/sync/StreamChannelServer.java
similarity index 88%
rename from activeio/src/java/org/activeio/StreamChannelServer.java
rename to activeio/src/java/org/activeio/stream/sync/StreamChannelServer.java
index 5777bda534..a32187a6a0 100644
--- a/activeio/src/java/org/activeio/StreamChannelServer.java
+++ b/activeio/src/java/org/activeio/stream/sync/StreamChannelServer.java
@@ -14,10 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio;
+package org.activeio.stream.sync;
import java.io.IOException;
+import org.activeio.Channel;
+import org.activeio.ChannelServer;
+
/**
diff --git a/activeio/src/java/org/activeio/net/SocketMetadata.java b/activeio/src/java/org/activeio/stream/sync/socket/SocketMetadata.java
similarity index 92%
rename from activeio/src/java/org/activeio/net/SocketMetadata.java
rename to activeio/src/java/org/activeio/stream/sync/socket/SocketMetadata.java
index d54cfe6949..ccee8025da 100644
--- a/activeio/src/java/org/activeio/net/SocketMetadata.java
+++ b/activeio/src/java/org/activeio/stream/sync/socket/SocketMetadata.java
@@ -15,7 +15,7 @@
* limitations under the License.
*
**/
-package org.activeio.net;
+package org.activeio.stream.sync.socket;
import java.net.InetAddress;
import java.net.SocketAddress;
@@ -34,8 +34,6 @@ public interface SocketMetadata {
public SocketAddress getLocalSocketAddress();
- public boolean getOOBInline() throws SocketException;
-
public int getPort();
public int getReceiveBufferSize() throws SocketException;
@@ -46,6 +44,8 @@ public interface SocketMetadata {
public int getSendBufferSize() throws SocketException;
+ public boolean getOOBInline() throws SocketException;
+
public int getSoLinger() throws SocketException;
public int getSoTimeout() throws SocketException;
@@ -71,6 +71,8 @@ public interface SocketMetadata {
public void setSendBufferSize(int size) throws SocketException;
public void setSoLinger(boolean on, int linger) throws SocketException;
+
+ public void setSoTimeout(int i) throws SocketException;
public void setTcpNoDelay(boolean on) throws SocketException;
diff --git a/activeio/src/java/org/activeio/net/SocketStreamChannel.java b/activeio/src/java/org/activeio/stream/sync/socket/SocketStreamChannel.java
similarity index 74%
rename from activeio/src/java/org/activeio/net/SocketStreamChannel.java
rename to activeio/src/java/org/activeio/stream/sync/socket/SocketStreamChannel.java
index 3cf28bdef9..91c33fbfc4 100644
--- a/activeio/src/java/org/activeio/net/SocketStreamChannel.java
+++ b/activeio/src/java/org/activeio/stream/sync/socket/SocketStreamChannel.java
@@ -16,7 +16,7 @@
*
**/
-package org.activeio.net;
+package org.activeio.stream.sync.socket;
import java.io.IOException;
import java.io.InputStream;
@@ -26,7 +26,7 @@ import java.net.Socket;
import java.net.SocketAddress;
import java.net.SocketException;
-import org.activeio.StreamChannel;
+import org.activeio.stream.sync.StreamChannel;
/**
* A {@see org.activeio.StreamChannel} implementation that uses a {@see java.net.Socket}
@@ -42,26 +42,19 @@ public class SocketStreamChannel implements StreamChannel, SocketMetadata {
private boolean disposed;
private int curentSoTimeout;
- protected SocketStreamChannel(Socket socket) throws IOException {
+ public SocketStreamChannel(Socket socket) throws IOException {
this.socket = socket;
in = socket.getInputStream();
out = socket.getOutputStream();
}
- protected void setSoTimeout(int i) throws SocketException {
+ public void setSoTimeout(int i) throws SocketException {
if( curentSoTimeout != i ) {
socket.setSoTimeout(i);
curentSoTimeout = i;
}
}
- /**
- * @see org.activeio.Channel#flush()
- */
- public void flush() throws IOException {
- out.flush();
- }
-
/**
* @see org.activeio.Disposable#dispose()
*/
@@ -86,7 +79,7 @@ public class SocketStreamChannel implements StreamChannel, SocketMetadata {
public void start() throws IOException {
}
- public void stop(long timeout) throws IOException {
+ public void stop() throws IOException {
}
public InetAddress getInetAddress() {
@@ -179,56 +172,16 @@ public class SocketStreamChannel implements StreamChannel, SocketMetadata {
return "Socket Connection: "+getLocalSocketAddress()+" -> "+getRemoteSocketAddress();
}
- public void write(byte[] data, int pos, int length) throws IOException {
- out.write(data,pos,length);
+ public InputStream getInputStream() throws IOException {
+ return in;
}
- public void write(byte[] data) throws IOException {
- out.write(data);
- }
-
- public void write(int data) throws IOException {
- out.write(data);
- }
-
- public int available() throws IOException {
- return in.available();
- }
-
- public void mark(int pos) {
- in.mark(pos);
- }
-
- public boolean markSupported() {
- return in.markSupported();
- }
-
- public int read(byte[] data, int offset, int length) throws IOException {
- try {
- return in.read(data, offset, length);
- } catch (ArrayIndexOutOfBoundsException e) {
- e.printStackTrace();
- return 0;
- }
- }
-
- public int read(byte[] data) throws IOException {
- return in.read(data);
- }
-
- public void reset() throws IOException {
- in.reset();
- }
-
- public long skip(long count) throws IOException {
- return in.skip(count);
- }
-
- public int read() throws IOException {
- return in.read();
+ public OutputStream getOutputStream() throws IOException {
+ return out;
}
public Socket getSocket() {
return socket;
}
+
}
\ No newline at end of file
diff --git a/activeio/src/java/org/activeio/net/SocketStreamChannelFactory.java b/activeio/src/java/org/activeio/stream/sync/socket/SocketStreamChannelFactory.java
similarity index 91%
rename from activeio/src/java/org/activeio/net/SocketStreamChannelFactory.java
rename to activeio/src/java/org/activeio/stream/sync/socket/SocketStreamChannelFactory.java
index 5d29224890..7b90aa7590 100644
--- a/activeio/src/java/org/activeio/net/SocketStreamChannelFactory.java
+++ b/activeio/src/java/org/activeio/stream/sync/socket/SocketStreamChannelFactory.java
@@ -15,7 +15,7 @@
* limitations under the License.
*
**/
-package org.activeio.net;
+package org.activeio.stream.sync.socket;
import java.io.IOException;
import java.net.InetAddress;
@@ -27,9 +27,10 @@ import java.net.URISyntaxException;
import javax.net.ServerSocketFactory;
import javax.net.SocketFactory;
-import org.activeio.StreamChannel;
-import org.activeio.StreamChannelFactory;
-import org.activeio.StreamChannelServer;
+import org.activeio.stream.sync.StreamChannel;
+import org.activeio.stream.sync.StreamChannelFactory;
+import org.activeio.stream.sync.StreamChannelServer;
+import org.activeio.util.URISupport;
/**
* A TcpStreamChannelFactory creates {@see org.activeio.net.TcpStreamChannel}
diff --git a/activeio/src/java/org/activeio/net/SocketStreamChannelServer.java b/activeio/src/java/org/activeio/stream/sync/socket/SocketStreamChannelServer.java
similarity index 92%
rename from activeio/src/java/org/activeio/net/SocketStreamChannelServer.java
rename to activeio/src/java/org/activeio/stream/sync/socket/SocketStreamChannelServer.java
index 7dcc01ab3d..3f5db3d797 100644
--- a/activeio/src/java/org/activeio/net/SocketStreamChannelServer.java
+++ b/activeio/src/java/org/activeio/stream/sync/socket/SocketStreamChannelServer.java
@@ -16,7 +16,7 @@
*
**/
-package org.activeio.net;
+package org.activeio.stream.sync.socket;
import java.io.IOException;
import java.net.ServerSocket;
@@ -26,7 +26,7 @@ import java.net.SocketTimeoutException;
import java.net.URI;
import org.activeio.Channel;
-import org.activeio.StreamChannelServer;
+import org.activeio.stream.sync.StreamChannelServer;
/**
* A StreamChannelServer that creates
@@ -112,7 +112,7 @@ public class SocketStreamChannelServer implements StreamChannelServer {
public void start() throws IOException {
}
- public void stop(long timeout) throws IOException {
+ public void stop() throws IOException {
}
public Object getAdapter(Class target) {
diff --git a/activeio/src/java/org/activeio/ByteArrayInputStream.java b/activeio/src/java/org/activeio/util/ByteArrayInputStream.java
similarity index 96%
rename from activeio/src/java/org/activeio/ByteArrayInputStream.java
rename to activeio/src/java/org/activeio/util/ByteArrayInputStream.java
index b2fa7be658..f3cee96a75 100644
--- a/activeio/src/java/org/activeio/ByteArrayInputStream.java
+++ b/activeio/src/java/org/activeio/util/ByteArrayInputStream.java
@@ -1,8 +1,10 @@
-package org.activeio;
+package org.activeio.util;
import java.io.IOException;
import java.io.InputStream;
+import org.activeio.packet.ByteSequence;
+
/**
* Very similar to the java.io.ByteArrayInputStream but this version
* is not thread safe.
diff --git a/activeio/src/java/org/activeio/ByteArrayOutputStream.java b/activeio/src/java/org/activeio/util/ByteArrayOutputStream.java
similarity index 95%
rename from activeio/src/java/org/activeio/ByteArrayOutputStream.java
rename to activeio/src/java/org/activeio/util/ByteArrayOutputStream.java
index 0aff4e055f..9281a98558 100644
--- a/activeio/src/java/org/activeio/ByteArrayOutputStream.java
+++ b/activeio/src/java/org/activeio/util/ByteArrayOutputStream.java
@@ -1,7 +1,9 @@
-package org.activeio;
+package org.activeio.util;
import java.io.OutputStream;
+import org.activeio.packet.ByteSequence;
+
/**
* Very similar to the java.io.ByteArrayOutputStream but this version
* is not thread safe and the resulting data is returned in a ByteSequence
diff --git a/activeio/src/java/org/activeio/FactoryFinder.java b/activeio/src/java/org/activeio/util/FactoryFinder.java
similarity index 96%
rename from activeio/src/java/org/activeio/FactoryFinder.java
rename to activeio/src/java/org/activeio/util/FactoryFinder.java
index 3673f7b350..989ed92b44 100644
--- a/activeio/src/java/org/activeio/FactoryFinder.java
+++ b/activeio/src/java/org/activeio/util/FactoryFinder.java
@@ -1,7 +1,7 @@
/**
*
*/
-package org.activeio;
+package org.activeio.util;
import java.io.BufferedInputStream;
import java.io.IOException;
diff --git a/activeio/src/java/org/activeio/filter/PacketAggregator.java b/activeio/src/java/org/activeio/util/PacketAggregator.java
similarity index 93%
rename from activeio/src/java/org/activeio/filter/PacketAggregator.java
rename to activeio/src/java/org/activeio/util/PacketAggregator.java
index 2e1a24b5cd..04934385c7 100644
--- a/activeio/src/java/org/activeio/filter/PacketAggregator.java
+++ b/activeio/src/java/org/activeio/util/PacketAggregator.java
@@ -14,15 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio.filter;
+package org.activeio.util;
import java.io.IOException;
-import org.activeio.Packet;
-import org.activeio.PacketData;
import org.activeio.packet.AppendedPacket;
import org.activeio.packet.ByteArrayPacket;
import org.activeio.packet.EOSPacket;
+import org.activeio.packet.Packet;
+import org.activeio.packet.PacketData;
/**
* @version $Revision$
diff --git a/activeio/src/java/org/activeio/net/URISupport.java b/activeio/src/java/org/activeio/util/URISupport.java
similarity index 97%
rename from activeio/src/java/org/activeio/net/URISupport.java
rename to activeio/src/java/org/activeio/util/URISupport.java
index 3f018b37f2..e49f08b90d 100644
--- a/activeio/src/java/org/activeio/net/URISupport.java
+++ b/activeio/src/java/org/activeio/util/URISupport.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio.net;
+package org.activeio.util;
import java.net.URI;
import java.net.URISyntaxException;
diff --git a/activeio/src/java/org/activeio/xnet/SyncChannelServerDaemon.java b/activeio/src/java/org/activeio/xnet/SyncChannelServerDaemon.java
index 077d0e5bca..853cfeb533 100644
--- a/activeio/src/java/org/activeio/xnet/SyncChannelServerDaemon.java
+++ b/activeio/src/java/org/activeio/xnet/SyncChannelServerDaemon.java
@@ -16,10 +16,10 @@
*/
package org.activeio.xnet;
-import org.activeio.SyncChannel;
-import org.activeio.SyncChannelServer;
import org.activeio.adapter.SyncChannelToSocket;
-import org.activeio.net.SocketSyncChannelFactory;
+import org.activeio.packet.sync.SyncChannel;
+import org.activeio.packet.sync.SyncChannelServer;
+import org.activeio.packet.sync.socket.SocketSyncChannelFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -85,10 +85,10 @@ public class SyncChannelServerDaemon implements Runnable {
stopped = true;
}
- public synchronized void doFail() {
+ public synchronized void doFail() throws IOException {
doStop();
if (server != null) {
- server.dispose();
+ server.stop();
}
}
@@ -140,7 +140,7 @@ public class SyncChannelServerDaemon implements Runnable {
if (server != null) {
try {
- server.dispose();
+ server.stop();
} catch (Exception ioException) {
log.debug("Error cleaning up socked", ioException);
}
diff --git a/activeio/src/resources/META-INF/org.activeio.ChannelFactory/aio b/activeio/src/resources/META-INF/org.activeio.ChannelFactory/aio
index 085a18ab15..07a411fcd8 100644
--- a/activeio/src/resources/META-INF/org.activeio.ChannelFactory/aio
+++ b/activeio/src/resources/META-INF/org.activeio.ChannelFactory/aio
@@ -1 +1 @@
-AsyncChannelFactory.class=org.activeio.net.AIOAsyncChannelFactory
+AsyncChannelFactory.class=org.activeio.packet.async.aio.AIOAsyncChannelFactory
diff --git a/activeio/src/resources/META-INF/org.activeio.ChannelFactory/datagram b/activeio/src/resources/META-INF/org.activeio.ChannelFactory/datagram
index 51865e4eba..720f9b1cf6 100644
--- a/activeio/src/resources/META-INF/org.activeio.ChannelFactory/datagram
+++ b/activeio/src/resources/META-INF/org.activeio.ChannelFactory/datagram
@@ -1 +1 @@
-SyncChannelFactory.class=org.activeio.net.DatagramSocketSyncChannelFactory
\ No newline at end of file
+SyncChannelFactory.class=org.activeio.packet.sync.datagram.DatagramSocketSyncChannelFactory
\ No newline at end of file
diff --git a/activeio/src/resources/META-INF/org.activeio.ChannelFactory/jxta b/activeio/src/resources/META-INF/org.activeio.ChannelFactory/jxta
index aad0a8fbdc..cc1c86d284 100644
--- a/activeio/src/resources/META-INF/org.activeio.ChannelFactory/jxta
+++ b/activeio/src/resources/META-INF/org.activeio.ChannelFactory/jxta
@@ -1 +1 @@
-SyncChannelFactory.class=org.activeio.net.JxtaSocketSyncChannelFactory
\ No newline at end of file
+SyncChannelFactory.class=org.activeio.packet.sync.jxta.JxtaSocketSyncChannelFactory
\ No newline at end of file
diff --git a/activeio/src/resources/META-INF/org.activeio.ChannelFactory/multicast b/activeio/src/resources/META-INF/org.activeio.ChannelFactory/multicast
index b8766e7b8f..811e445909 100644
--- a/activeio/src/resources/META-INF/org.activeio.ChannelFactory/multicast
+++ b/activeio/src/resources/META-INF/org.activeio.ChannelFactory/multicast
@@ -1 +1 @@
-SyncChannelFactory.class=org.activeio.net.MulticastSocketSyncChannelFactory
\ No newline at end of file
+SyncChannelFactory.class=org.activeio.packet.sync.multicast.MulticastSocketSyncChannelFactory
\ No newline at end of file
diff --git a/activeio/src/resources/META-INF/org.activeio.ChannelFactory/nio b/activeio/src/resources/META-INF/org.activeio.ChannelFactory/nio
index 8e9daf7e20..3495992b0a 100644
--- a/activeio/src/resources/META-INF/org.activeio.ChannelFactory/nio
+++ b/activeio/src/resources/META-INF/org.activeio.ChannelFactory/nio
@@ -1,2 +1,2 @@
-SyncChannelFactory.class=org.activeio.net.NIOSyncChannelFactory
-AsyncChannelFactory.class=org.activeio.net.NIOAsyncChannelFactory
\ No newline at end of file
+SyncChannelFactory.class=org.activeio.packet.sync.nio.NIOSyncChannelFactory
+AsyncChannelFactory.class=org.activeio.packet.async.nio.NIOAsyncChannelFactory
\ No newline at end of file
diff --git a/activeio/src/resources/META-INF/org.activeio.ChannelFactory/nio-async b/activeio/src/resources/META-INF/org.activeio.ChannelFactory/nio-async
index 9efad3bf4e..4795cce335 100644
--- a/activeio/src/resources/META-INF/org.activeio.ChannelFactory/nio-async
+++ b/activeio/src/resources/META-INF/org.activeio.ChannelFactory/nio-async
@@ -1 +1 @@
-AsyncChannelFactory.class=org.activeio.net.NIOAsyncChannelFactory
\ No newline at end of file
+AsyncChannelFactory.class=org.activeio.packet.async.nio.NIOAsyncChannelFactory
\ No newline at end of file
diff --git a/activeio/src/resources/META-INF/org.activeio.ChannelFactory/nio-sync b/activeio/src/resources/META-INF/org.activeio.ChannelFactory/nio-sync
index 82b7d11a6f..ffe5a48c89 100644
--- a/activeio/src/resources/META-INF/org.activeio.ChannelFactory/nio-sync
+++ b/activeio/src/resources/META-INF/org.activeio.ChannelFactory/nio-sync
@@ -1 +1 @@
-SyncChannelFactory.class=org.activeio.net.NIOSyncChannelFactory
\ No newline at end of file
+SyncChannelFactory.class=org.activeio.packet.sync.nio.NIOSyncChannelFactory
\ No newline at end of file
diff --git a/activeio/src/resources/META-INF/org.activeio.ChannelFactory/socket b/activeio/src/resources/META-INF/org.activeio.ChannelFactory/socket
index 2fc06b1b94..52c7f68039 100644
--- a/activeio/src/resources/META-INF/org.activeio.ChannelFactory/socket
+++ b/activeio/src/resources/META-INF/org.activeio.ChannelFactory/socket
@@ -1 +1 @@
-SyncChannelFactory.class=org.activeio.net.SocketSyncChannelFactory
\ No newline at end of file
+SyncChannelFactory.class=org.activeio.packet.sync.socket.SocketSyncChannelFactory
\ No newline at end of file
diff --git a/activeio/src/resources/META-INF/org.activeio.ChannelFactory/ssl b/activeio/src/resources/META-INF/org.activeio.ChannelFactory/ssl
index 0e20e20baa..3dab44f557 100644
--- a/activeio/src/resources/META-INF/org.activeio.ChannelFactory/ssl
+++ b/activeio/src/resources/META-INF/org.activeio.ChannelFactory/ssl
@@ -1 +1 @@
-SyncChannelFactory.class=org.activeio.net.SslSocketSyncChannelFactory
\ No newline at end of file
+SyncChannelFactory.class=org.activeio.packet.sync.ssl.SslSocketSyncChannelFactory
\ No newline at end of file
diff --git a/activeio/src/resources/META-INF/org.activeio.ChannelFactory/vmpipe b/activeio/src/resources/META-INF/org.activeio.ChannelFactory/vmpipe
index 6a069d65cf..5e54f531a8 100644
--- a/activeio/src/resources/META-INF/org.activeio.ChannelFactory/vmpipe
+++ b/activeio/src/resources/META-INF/org.activeio.ChannelFactory/vmpipe
@@ -1 +1 @@
-AsyncChannelFactory.class=org.activeio.net.VMPipeAsyncChannelFactory
+AsyncChannelFactory.class=org.activeio.packet.async.vmpipe.VMPipeAsyncChannelFactory
diff --git a/activeio/src/test/org/activeio/ChannelFactoryTest.java b/activeio/src/test/org/activeio/ChannelFactoryTest.java
index c046127ee7..a9036825f3 100644
--- a/activeio/src/test/org/activeio/ChannelFactoryTest.java
+++ b/activeio/src/test/org/activeio/ChannelFactoryTest.java
@@ -25,16 +25,20 @@ import junit.framework.TestCase;
import org.activeio.adapter.AsyncToSyncChannel;
import org.activeio.adapter.SyncToAsyncChannel;
-import org.activeio.net.AIOAsyncChannel;
-import org.activeio.net.AIOSyncChannelServer;
-import org.activeio.net.NIOAsyncChannel;
-import org.activeio.net.NIOAsyncChannelServer;
-import org.activeio.net.NIOSyncChannel;
-import org.activeio.net.NIOSyncChannelServer;
-import org.activeio.net.SocketSyncChannel;
-import org.activeio.net.SocketSyncChannelServer;
-import org.activeio.net.VMPipeAsyncChannelPipe;
-import org.activeio.net.VMPipeAsyncChannelServer;
+import org.activeio.packet.async.AsyncChannel;
+import org.activeio.packet.async.AsyncChannelServer;
+import org.activeio.packet.async.aio.AIOAsyncChannel;
+import org.activeio.packet.async.aio.AIOSyncChannelServer;
+import org.activeio.packet.async.nio.NIOAsyncChannel;
+import org.activeio.packet.async.nio.NIOAsyncChannelServer;
+import org.activeio.packet.async.vmpipe.VMPipeAsyncChannelPipe;
+import org.activeio.packet.async.vmpipe.VMPipeAsyncChannelServer;
+import org.activeio.packet.sync.SyncChannel;
+import org.activeio.packet.sync.SyncChannelServer;
+import org.activeio.packet.sync.nio.NIOSyncChannel;
+import org.activeio.packet.sync.nio.NIOSyncChannelServer;
+import org.activeio.packet.sync.socket.SocketSyncChannel;
+import org.activeio.packet.sync.socket.SocketSyncChannelServer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
diff --git a/activeio/src/test/org/activeio/ChannelRequestTestSupport.java b/activeio/src/test/org/activeio/ChannelRequestTestSupport.java
deleted file mode 100644
index ba801fd1c8..0000000000
--- a/activeio/src/test/org/activeio/ChannelRequestTestSupport.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- *
- * Copyright 2004 Hiram Chirino
- *
- * 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.
- *
- **/
-package org.activeio;
-
-import org.activeio.packet.ByteArrayPacket;
-
-import java.io.IOException;
-import java.net.URISyntaxException;
-
-import junit.framework.TestCase;
-
-/**
- */
-abstract public class ChannelRequestTestSupport extends TestCase implements RequestListener {
-
- private ChannelServer server;
-
- public void test() throws IOException {
- final RequestChannel channel = createClientRequestChannel();
- try {
- channel.start();
- sendRequest(channel, 1001);
- sendRequest(channel, 1002);
- sendRequest(channel, 1003);
- sendRequest(channel, 1004);
- sendRequest(channel, 1005);
- } finally {
- channel.dispose();
- }
- }
-
- private void sendRequest(final RequestChannel channel, int packetSize) throws IOException {
- Packet request = new ByteArrayPacket(fill(new byte[packetSize],(byte)1));
- Packet response = channel.request(request, 1000 * 30*1000);
- assertNotNull(response);
- assertEquals(packetSize, response.remaining());
- }
-
- private byte[] fill(byte[] bs, byte b) {
- for (int i = 0; i < bs.length; i++) {
- bs[i] = b;
- }
- return bs;
- }
-
- public Packet onRequest(Packet request) {
- return new ByteArrayPacket(fill(new byte[request.remaining()],(byte)2));
- }
-
- public void onRquestError(IOException error) {
- error.printStackTrace();
- }
-
- protected void setUp() throws Exception {
- server = createChannelServer(this);
- server.start();
- }
-
- protected void tearDown() throws Exception {
- server.dispose();
- }
-
- abstract protected RequestChannel createClientRequestChannel() throws IOException;
- abstract protected ChannelServer createChannelServer(final RequestListener requestListener) throws IOException, URISyntaxException;}
diff --git a/activeio/src/test/org/activeio/PacketDataTest.java b/activeio/src/test/org/activeio/PacketDataTest.java
index e7ae39f38e..40e2e40f22 100644
--- a/activeio/src/test/org/activeio/PacketDataTest.java
+++ b/activeio/src/test/org/activeio/PacketDataTest.java
@@ -20,6 +20,7 @@ package org.activeio;
import java.io.IOException;
import org.activeio.packet.ByteArrayPacket;
+import org.activeio.packet.PacketData;
import junit.framework.TestCase;
diff --git a/activeio/src/test/org/activeio/filter/PacketAggregatingChannelFilterTest.java b/activeio/src/test/org/activeio/filter/PacketAggregatingChannelFilterTest.java
deleted file mode 100644
index aeaeb3e650..0000000000
--- a/activeio/src/test/org/activeio/filter/PacketAggregatingChannelFilterTest.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
- *
- * Copyright 2004 Hiram Chirino
- *
- * 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.
- *
- **/
-package org.activeio.filter;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import org.activeio.AcceptListener;
-import org.activeio.AsyncChannelServer;
-import org.activeio.Channel;
-import org.activeio.ChannelRequestTestSupport;
-import org.activeio.ChannelServer;
-import org.activeio.RequestChannel;
-import org.activeio.RequestListener;
-import org.activeio.SyncChannelFactory;
-import org.activeio.adapter.AsyncChannelToClientRequestChannel;
-import org.activeio.adapter.AsyncChannelToServerRequestChannel;
-import org.activeio.adapter.SyncToAsyncChannel;
-import org.activeio.adapter.SyncToAsyncChannelServer;
-import org.activeio.net.SocketMetadata;
-import org.activeio.net.SocketSyncChannelFactory;
-
-/**
- */
-public class PacketAggregatingChannelFilterTest extends ChannelRequestTestSupport {
-
- private URI serverURI;
-
- protected ChannelServer createChannelServer(final RequestListener requestListener) throws IOException, URISyntaxException {
-
- SyncChannelFactory factory = new SocketSyncChannelFactory();
-
- AsyncChannelServer server = new SyncToAsyncChannelServer(factory.bindSyncChannel(new URI("tcp://localhost:0")));
-
- server.setAcceptListener(new AcceptListener() {
- public void onAccept(Channel channel) {
-
- RequestChannel requestChannel = null;
- try {
- ((SocketMetadata)channel.getAdapter(SocketMetadata.class)).setTcpNoDelay(true);
- requestChannel =
- new AsyncChannelToServerRequestChannel(
- new PacketAggregatingAsyncChannel(
- SyncToAsyncChannel.adapt(channel)));
-
- requestChannel.setRequestListener(requestListener);
- requestChannel.start();
-
- } catch (IOException e) {
- if (requestChannel != null)
- requestChannel.dispose();
- else
- channel.dispose();
- }
- }
-
- public void onAcceptError(IOException error) {
- error.printStackTrace();
- }
- });
- serverURI = server.getConnectURI();
- return server;
- }
-
- /**
- * @return
- * @throws IOException
- */
- protected RequestChannel createClientRequestChannel() throws IOException {
- SyncChannelFactory factory = new SocketSyncChannelFactory();
- PacketAggregatingSyncChannel channel = new PacketAggregatingSyncChannel(factory.openSyncChannel(serverURI));
- ((SocketMetadata)channel.getAdapter(SocketMetadata.class)).setTcpNoDelay(true);
- return new AsyncChannelToClientRequestChannel(channel);
- }
-
-}
diff --git a/activeio/src/test/org/activeio/journal/JournalStatsFilter.java b/activeio/src/test/org/activeio/journal/JournalStatsFilter.java
index c3e1dacca5..11c332452b 100644
--- a/activeio/src/test/org/activeio/journal/JournalStatsFilter.java
+++ b/activeio/src/test/org/activeio/journal/JournalStatsFilter.java
@@ -21,7 +21,7 @@ import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
-import org.activeio.Packet;
+import org.activeio.packet.Packet;
import org.activeio.stats.CountStatisticImpl;
import org.activeio.stats.IndentPrinter;
import org.activeio.stats.TimeStatisticImpl;
diff --git a/activeio/src/test/org/activeio/journal/active/JournalImplTest.java b/activeio/src/test/org/activeio/journal/active/JournalImplTest.java
index c535099947..b39583d5a0 100644
--- a/activeio/src/test/org/activeio/journal/active/JournalImplTest.java
+++ b/activeio/src/test/org/activeio/journal/active/JournalImplTest.java
@@ -22,11 +22,11 @@ import java.io.IOException;
import junit.framework.TestCase;
-import org.activeio.Packet;
import org.activeio.journal.InvalidRecordLocationException;
import org.activeio.journal.Journal;
import org.activeio.journal.RecordLocation;
import org.activeio.packet.ByteArrayPacket;
+import org.activeio.packet.Packet;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
diff --git a/activeio/src/test/org/activeio/oneport/OnePortAsyncChannelServerTest.java b/activeio/src/test/org/activeio/oneport/OnePortAsyncChannelServerTest.java
index a9e11f0612..b6c9abfa6c 100644
--- a/activeio/src/test/org/activeio/oneport/OnePortAsyncChannelServerTest.java
+++ b/activeio/src/test/org/activeio/oneport/OnePortAsyncChannelServerTest.java
@@ -26,19 +26,19 @@ import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger;
import org.activeio.AcceptListener;
-import org.activeio.AsyncChannel;
-import org.activeio.AsyncChannelFactory;
-import org.activeio.AsyncChannelServer;
import org.activeio.Channel;
-import org.activeio.FilterAsyncChannelServer;
-import org.activeio.FilterSyncChannel;
-import org.activeio.Packet;
-import org.activeio.SyncChannel;
import org.activeio.adapter.AsyncToSyncChannel;
import org.activeio.adapter.SyncToAsyncChannelFactory;
-import org.activeio.net.SocketMetadata;
-import org.activeio.net.SocketSyncChannelFactory;
import org.activeio.packet.ByteArrayPacket;
+import org.activeio.packet.Packet;
+import org.activeio.packet.async.AsyncChannel;
+import org.activeio.packet.async.AsyncChannelFactory;
+import org.activeio.packet.async.AsyncChannelServer;
+import org.activeio.packet.async.FilterAsyncChannelServer;
+import org.activeio.packet.sync.FilterSyncChannel;
+import org.activeio.packet.sync.SyncChannel;
+import org.activeio.packet.sync.socket.SocketSyncChannelFactory;
+import org.activeio.stream.sync.socket.SocketMetadata;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -103,7 +103,7 @@ public class OnePortAsyncChannelServerTest extends TestCase {
((SocketMetadata)channel.getAdapter(SocketMetadata.class)).setTcpNoDelay(true);
channel.write(new ByteArrayPacket("GIOPcrapcrap".getBytes("UTF-8")));
channel.flush();
- channel.dispose();
+ channel.stop();
}
public void testUnknownAccept() throws IOException, URISyntaxException, InterruptedException {
@@ -132,7 +132,7 @@ public class OnePortAsyncChannelServerTest extends TestCase {
public void onAccept(Channel channel) {
SyncChannel syncChannel = AsyncToSyncChannel.adapt(channel);
super.onAccept(new FilterSyncChannel(syncChannel) {
- public org.activeio.Packet read(long timeout) throws IOException {
+ public org.activeio.packet.Packet read(long timeout) throws IOException {
Packet packet = super.read(timeout);
if( packet!=null && packet.hasRemaining() )
serverPacketCounter.incrementAndGet();
diff --git a/activeio/src/test/org/activeio/oneport/JettyOnePortSocketListenerTest.java b/activeio/src/test/org/activeio/oneport/jetty/JettyOnePortSocketListenerTest.java
similarity index 89%
rename from activeio/src/test/org/activeio/oneport/JettyOnePortSocketListenerTest.java
rename to activeio/src/test/org/activeio/oneport/jetty/JettyOnePortSocketListenerTest.java
index 820bf129da..dd27b6061d 100644
--- a/activeio/src/test/org/activeio/oneport/JettyOnePortSocketListenerTest.java
+++ b/activeio/src/test/org/activeio/oneport/jetty/JettyOnePortSocketListenerTest.java
@@ -15,9 +15,10 @@
* limitations under the License.
*
**/
-package org.activeio.oneport;
+package org.activeio.oneport.jetty;
-import org.activeio.oneport.JettyOnePortSocketListener;
+import org.activeio.oneport.OnePortAsyncChannelServerTest;
+import org.activeio.oneport.jetty.JettyOnePortSocketListener;
import org.mortbay.http.HttpContext;
import org.mortbay.http.HttpServer;
import org.mortbay.jetty.servlet.ServletHandler;
diff --git a/activeio/src/test/org/activeio/oneport/TestServlet.java b/activeio/src/test/org/activeio/oneport/jetty/TestServlet.java
similarity index 94%
rename from activeio/src/test/org/activeio/oneport/TestServlet.java
rename to activeio/src/test/org/activeio/oneport/jetty/TestServlet.java
index 1670f225c7..a72c609ee9 100644
--- a/activeio/src/test/org/activeio/oneport/TestServlet.java
+++ b/activeio/src/test/org/activeio/oneport/jetty/TestServlet.java
@@ -15,7 +15,7 @@
* limitations under the License.
*
**/
-package org.activeio.oneport;
+package org.activeio.oneport.jetty;
import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
diff --git a/activeio/src/test/org/activeio/oneport/OpenORBOnePortSocketFactoryTest.java b/activeio/src/test/org/activeio/oneport/openorb/OpenORBOnePortSocketFactoryTest.java
similarity index 92%
rename from activeio/src/test/org/activeio/oneport/OpenORBOnePortSocketFactoryTest.java
rename to activeio/src/test/org/activeio/oneport/openorb/OpenORBOnePortSocketFactoryTest.java
index ccb2a74801..b43ff9a1e0 100644
--- a/activeio/src/test/org/activeio/oneport/OpenORBOnePortSocketFactoryTest.java
+++ b/activeio/src/test/org/activeio/oneport/openorb/OpenORBOnePortSocketFactoryTest.java
@@ -15,19 +15,20 @@
* limitations under the License.
*
**/
-package org.activeio.oneport;
+package org.activeio.oneport.openorb;
-import edu.emory.mathcs.backport.java.util.concurrent.BlockingQueue;
+import java.rmi.RemoteException;
+import java.util.Properties;
+import javax.naming.NamingException;
+
+import org.activeio.oneport.OnePortAsyncChannelServerTest;
import org.omg.CORBA.ORB;
import org.omg.CORBA.Object;
import org.omg.PortableServer.POA;
import org.omg.PortableServer.POAHelper;
-import javax.naming.NamingException;
-
-import java.rmi.RemoteException;
-import java.util.Properties;
+import edu.emory.mathcs.backport.java.util.concurrent.BlockingQueue;
/**
*
@@ -44,7 +45,7 @@ public class OpenORBOnePortSocketFactoryTest extends OnePortAsyncChannelServerTe
staticResultSlot = resultSlot;
Properties props = new Properties();
- props.setProperty("org.omg.PortableInterceptor.ORBInitializerClass.org.activeio.oneport.OpenORBOpenPortFeatureInitializer", "");
+ props.setProperty("org.omg.PortableInterceptor.ORBInitializerClass."+OpenORBOpenPortFeatureInitializer.class.getName(), "");
props.setProperty("org.omg.CORBA.ORBClass", "org.openorb.orb.core.ORB");
props.setProperty("org.omg.CORBA.ORBSingletonClass", "org.openorb.orb.core.ORBSingleton");
diff --git a/activeio/src/test/org/activeio/oneport/TestIIOPServer.idl b/activeio/src/test/org/activeio/oneport/openorb/TestIIOPServer.idl
similarity index 100%
rename from activeio/src/test/org/activeio/oneport/TestIIOPServer.idl
rename to activeio/src/test/org/activeio/oneport/openorb/TestIIOPServer.idl
diff --git a/activeio/src/test/org/activeio/oneport/TestIIOPServer.java b/activeio/src/test/org/activeio/oneport/openorb/TestIIOPServer.java
similarity index 81%
rename from activeio/src/test/org/activeio/oneport/TestIIOPServer.java
rename to activeio/src/test/org/activeio/oneport/openorb/TestIIOPServer.java
index f9a9172e8e..df965b1f06 100644
--- a/activeio/src/test/org/activeio/oneport/TestIIOPServer.java
+++ b/activeio/src/test/org/activeio/oneport/openorb/TestIIOPServer.java
@@ -1,4 +1,4 @@
-package org.activeio.oneport;
+package org.activeio.oneport.openorb;
/**
* Interface definition: TestIIOPServer.
diff --git a/activeio/src/test/org/activeio/oneport/TestIIOPServerHelper.java b/activeio/src/test/org/activeio/oneport/openorb/TestIIOPServerHelper.java
similarity index 81%
rename from activeio/src/test/org/activeio/oneport/TestIIOPServerHelper.java
rename to activeio/src/test/org/activeio/oneport/openorb/TestIIOPServerHelper.java
index 104becf214..23e1eae3ad 100644
--- a/activeio/src/test/org/activeio/oneport/TestIIOPServerHelper.java
+++ b/activeio/src/test/org/activeio/oneport/openorb/TestIIOPServerHelper.java
@@ -1,4 +1,5 @@
-package org.activeio.oneport;
+package org.activeio.oneport.openorb;
+
/**
* Helper class for : TestIIOPServer
@@ -12,7 +13,7 @@ public class TestIIOPServerHelper
* @param a an any
* @param t TestIIOPServer value
*/
- public static void insert(org.omg.CORBA.Any a, org.activeio.oneport.TestIIOPServer t)
+ public static void insert(org.omg.CORBA.Any a, org.activeio.oneport.openorb.TestIIOPServer t)
{
a.insert_Object(t , type());
}
@@ -23,7 +24,7 @@ public class TestIIOPServerHelper
* @param a an any
* @return the extracted TestIIOPServer value
*/
- public static org.activeio.oneport.TestIIOPServer extract( org.omg.CORBA.Any a )
+ public static org.activeio.oneport.openorb.TestIIOPServer extract( org.omg.CORBA.Any a )
{
if ( !a.type().equivalent( type() ) )
{
@@ -31,7 +32,7 @@ public class TestIIOPServerHelper
}
try
{
- return org.activeio.oneport.TestIIOPServerHelper.narrow( a.extract_Object() );
+ return org.activeio.oneport.openorb.TestIIOPServerHelper.narrow( a.extract_Object() );
}
catch ( final org.omg.CORBA.BAD_PARAM e )
{
@@ -73,9 +74,9 @@ public class TestIIOPServerHelper
* @param istream the input stream
* @return the readed TestIIOPServer value
*/
- public static org.activeio.oneport.TestIIOPServer read(org.omg.CORBA.portable.InputStream istream)
+ public static org.activeio.oneport.openorb.TestIIOPServer read(org.omg.CORBA.portable.InputStream istream)
{
- return(org.activeio.oneport.TestIIOPServer)istream.read_Object(org.activeio.oneport._TestIIOPServerStub.class);
+ return(org.activeio.oneport.openorb.TestIIOPServer)istream.read_Object(org.activeio.oneport.openorb._TestIIOPServerStub.class);
}
/**
@@ -83,7 +84,7 @@ public class TestIIOPServerHelper
* @param ostream the output stream
* @param value TestIIOPServer value
*/
- public static void write(org.omg.CORBA.portable.OutputStream ostream, org.activeio.oneport.TestIIOPServer value)
+ public static void write(org.omg.CORBA.portable.OutputStream ostream, org.activeio.oneport.openorb.TestIIOPServer value)
{
ostream.write_Object((org.omg.CORBA.portable.ObjectImpl)value);
}
diff --git a/activeio/src/test/org/activeio/oneport/TestIIOPServerHolder.java b/activeio/src/test/org/activeio/oneport/openorb/TestIIOPServerHolder.java
similarity index 82%
rename from activeio/src/test/org/activeio/oneport/TestIIOPServerHolder.java
rename to activeio/src/test/org/activeio/oneport/openorb/TestIIOPServerHolder.java
index 8f4d4ddbb6..352a5bea51 100644
--- a/activeio/src/test/org/activeio/oneport/TestIIOPServerHolder.java
+++ b/activeio/src/test/org/activeio/oneport/openorb/TestIIOPServerHolder.java
@@ -1,4 +1,4 @@
-package org.activeio.oneport;
+package org.activeio.oneport.openorb;
/**
* Holder class for : TestIIOPServer
@@ -11,7 +11,7 @@ final public class TestIIOPServerHolder
/**
* Internal TestIIOPServer value
*/
- public org.activeio.oneport.TestIIOPServer value;
+ public org.activeio.oneport.openorb.TestIIOPServer value;
/**
* Default constructor
@@ -23,7 +23,7 @@ final public class TestIIOPServerHolder
* Constructor with value initialisation
* @param initial the initial value
*/
- public TestIIOPServerHolder(org.activeio.oneport.TestIIOPServer initial)
+ public TestIIOPServerHolder(org.activeio.oneport.openorb.TestIIOPServer initial)
{
value = initial;
}
diff --git a/activeio/src/test/org/activeio/oneport/TestIIOPServerImpl.java b/activeio/src/test/org/activeio/oneport/openorb/TestIIOPServerImpl.java
similarity index 93%
rename from activeio/src/test/org/activeio/oneport/TestIIOPServerImpl.java
rename to activeio/src/test/org/activeio/oneport/openorb/TestIIOPServerImpl.java
index bc0a530929..db5f25339d 100644
--- a/activeio/src/test/org/activeio/oneport/TestIIOPServerImpl.java
+++ b/activeio/src/test/org/activeio/oneport/openorb/TestIIOPServerImpl.java
@@ -15,7 +15,7 @@
* limitations under the License.
*
**/
-package org.activeio.oneport;
+package org.activeio.oneport.openorb;
import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
diff --git a/activeio/src/test/org/activeio/oneport/TestIIOPServerOperations.java b/activeio/src/test/org/activeio/oneport/openorb/TestIIOPServerOperations.java
similarity index 78%
rename from activeio/src/test/org/activeio/oneport/TestIIOPServerOperations.java
rename to activeio/src/test/org/activeio/oneport/openorb/TestIIOPServerOperations.java
index 6f001c2957..bf78ad5a49 100644
--- a/activeio/src/test/org/activeio/oneport/TestIIOPServerOperations.java
+++ b/activeio/src/test/org/activeio/oneport/openorb/TestIIOPServerOperations.java
@@ -1,4 +1,4 @@
-package org.activeio.oneport;
+package org.activeio.oneport.openorb;
/**
* Interface definition: TestIIOPServer.
diff --git a/activeio/src/test/org/activeio/oneport/TestIIOPServerPOA.java b/activeio/src/test/org/activeio/oneport/openorb/TestIIOPServerPOA.java
similarity index 93%
rename from activeio/src/test/org/activeio/oneport/TestIIOPServerPOA.java
rename to activeio/src/test/org/activeio/oneport/openorb/TestIIOPServerPOA.java
index 948017fdc8..0e04272ac8 100644
--- a/activeio/src/test/org/activeio/oneport/TestIIOPServerPOA.java
+++ b/activeio/src/test/org/activeio/oneport/openorb/TestIIOPServerPOA.java
@@ -1,4 +1,4 @@
-package org.activeio.oneport;
+package org.activeio.oneport.openorb;
/**
* Interface definition: TestIIOPServer.
diff --git a/activeio/src/test/org/activeio/oneport/TestIIOPServerPOATie.java b/activeio/src/test/org/activeio/oneport/openorb/TestIIOPServerPOATie.java
similarity index 91%
rename from activeio/src/test/org/activeio/oneport/TestIIOPServerPOATie.java
rename to activeio/src/test/org/activeio/oneport/openorb/TestIIOPServerPOATie.java
index ab10f5ccb0..e70c89488d 100644
--- a/activeio/src/test/org/activeio/oneport/TestIIOPServerPOATie.java
+++ b/activeio/src/test/org/activeio/oneport/openorb/TestIIOPServerPOATie.java
@@ -1,4 +1,4 @@
-package org.activeio.oneport;
+package org.activeio.oneport.openorb;
/**
* Interface definition: TestIIOPServer.
diff --git a/activeio/src/test/org/activeio/oneport/_TestIIOPServerStub.java b/activeio/src/test/org/activeio/oneport/openorb/_TestIIOPServerStub.java
similarity index 86%
rename from activeio/src/test/org/activeio/oneport/_TestIIOPServerStub.java
rename to activeio/src/test/org/activeio/oneport/openorb/_TestIIOPServerStub.java
index 6e39ad25b6..b1768b0dbf 100644
--- a/activeio/src/test/org/activeio/oneport/_TestIIOPServerStub.java
+++ b/activeio/src/test/org/activeio/oneport/openorb/_TestIIOPServerStub.java
@@ -1,4 +1,5 @@
-package org.activeio.oneport;
+package org.activeio.oneport.openorb;
+
/**
* Interface definition: TestIIOPServer.
@@ -18,7 +19,7 @@ public class _TestIIOPServerStub extends org.omg.CORBA.portable.ObjectImpl
return _ids_list;
}
- private final static Class _opsClass = org.activeio.oneport.TestIIOPServerOperations.class;
+ private final static Class _opsClass = org.activeio.oneport.openorb.TestIIOPServerOperations.class;
/**
* Operation test
@@ -55,7 +56,7 @@ public class _TestIIOPServerStub extends org.omg.CORBA.portable.ObjectImpl
org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("test",_opsClass);
if (_so == null)
continue;
- org.activeio.oneport.TestIIOPServerOperations _self = (org.activeio.oneport.TestIIOPServerOperations) _so.servant;
+ org.activeio.oneport.openorb.TestIIOPServerOperations _self = (org.activeio.oneport.openorb.TestIIOPServerOperations) _so.servant;
try
{
_self.test();
diff --git a/activeio/src/test/org/activeio/packet/AppendedPacketTest.java b/activeio/src/test/org/activeio/packet/AppendedPacketTest.java
index e6f726b388..2921c4e819 100644
--- a/activeio/src/test/org/activeio/packet/AppendedPacketTest.java
+++ b/activeio/src/test/org/activeio/packet/AppendedPacketTest.java
@@ -16,7 +16,6 @@
*/
package org.activeio.packet;
-import org.activeio.Packet;
/**
*/
diff --git a/activeio/src/test/org/activeio/packet/ByteArrayPacketTest.java b/activeio/src/test/org/activeio/packet/ByteArrayPacketTest.java
index 5d1e6a60b9..2d22780ccd 100644
--- a/activeio/src/test/org/activeio/packet/ByteArrayPacketTest.java
+++ b/activeio/src/test/org/activeio/packet/ByteArrayPacketTest.java
@@ -16,7 +16,6 @@
*/
package org.activeio.packet;
-import org.activeio.Packet;
/**
*/
diff --git a/activeio/src/test/org/activeio/packet/ByteBufferPacketTest.java b/activeio/src/test/org/activeio/packet/ByteBufferPacketTest.java
index 81e81cddd5..8afa75d0b3 100644
--- a/activeio/src/test/org/activeio/packet/ByteBufferPacketTest.java
+++ b/activeio/src/test/org/activeio/packet/ByteBufferPacketTest.java
@@ -18,7 +18,6 @@ package org.activeio.packet;
import java.nio.ByteBuffer;
-import org.activeio.Packet;
/**
*/
diff --git a/activeio/src/test/org/activeio/net/benchmark/ClientLoadSimulator.java b/activeio/src/test/org/activeio/packet/ClientLoadSimulator.java
similarity index 99%
rename from activeio/src/test/org/activeio/net/benchmark/ClientLoadSimulator.java
rename to activeio/src/test/org/activeio/packet/ClientLoadSimulator.java
index 52d1d941ae..7c5e24e7d2 100644
--- a/activeio/src/test/org/activeio/net/benchmark/ClientLoadSimulator.java
+++ b/activeio/src/test/org/activeio/packet/ClientLoadSimulator.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio.net.benchmark;
+package org.activeio.packet;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
@@ -25,10 +25,10 @@ import java.util.HashMap;
import java.util.Iterator;
import org.activeio.ChannelFactory;
-import org.activeio.Packet;
-import org.activeio.SyncChannel;
import org.activeio.packet.ByteArrayPacket;
import org.activeio.packet.EOSPacket;
+import org.activeio.packet.Packet;
+import org.activeio.packet.sync.SyncChannel;
import org.activeio.stats.CountStatisticImpl;
import org.activeio.stats.TimeStatisticImpl;
import org.apache.commons.beanutils.BeanUtils;
diff --git a/activeio/src/test/org/activeio/packet/PacketTestSupport.java b/activeio/src/test/org/activeio/packet/PacketTestSupport.java
index 0f80252a30..ae8357489e 100644
--- a/activeio/src/test/org/activeio/packet/PacketTestSupport.java
+++ b/activeio/src/test/org/activeio/packet/PacketTestSupport.java
@@ -20,7 +20,6 @@ import java.util.Arrays;
import junit.framework.TestCase;
-import org.activeio.Packet;
/**
*/
diff --git a/activeio/src/test/org/activeio/net/benchmark/Server.java b/activeio/src/test/org/activeio/packet/Server.java
similarity index 96%
rename from activeio/src/test/org/activeio/net/benchmark/Server.java
rename to activeio/src/test/org/activeio/packet/Server.java
index fc2b662d1d..a2e2f21e90 100644
--- a/activeio/src/test/org/activeio/net/benchmark/Server.java
+++ b/activeio/src/test/org/activeio/packet/Server.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio.net.benchmark;
+package org.activeio.packet;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
@@ -23,14 +23,14 @@ import java.net.URISyntaxException;
import java.util.HashMap;
import org.activeio.AcceptListener;
-import org.activeio.AsyncChannel;
-import org.activeio.AsyncChannelListener;
-import org.activeio.AsyncChannelServer;
import org.activeio.Channel;
import org.activeio.ChannelFactory;
-import org.activeio.Packet;
import org.activeio.adapter.SyncToAsyncChannel;
import org.activeio.packet.EOSPacket;
+import org.activeio.packet.Packet;
+import org.activeio.packet.async.AsyncChannel;
+import org.activeio.packet.async.AsyncChannelListener;
+import org.activeio.packet.async.AsyncChannelServer;
import org.activeio.stats.CountStatisticImpl;
import org.apache.commons.beanutils.BeanUtils;
@@ -109,7 +109,7 @@ public class Server implements Runnable, AcceptListener {
}
System.out.println("Stopping server.");
- server.stop(1000*5);
+ server.stop();
server.dispose();
} catch (IOException e) {
diff --git a/activeio/src/test/org/activeio/net/AIOAsyncChannelTest.java b/activeio/src/test/org/activeio/packet/async/aio/AIOAsyncChannelTest.java
similarity index 87%
rename from activeio/src/test/org/activeio/net/AIOAsyncChannelTest.java
rename to activeio/src/test/org/activeio/packet/async/aio/AIOAsyncChannelTest.java
index c5a35aeb70..336653986f 100644
--- a/activeio/src/test/org/activeio/net/AIOAsyncChannelTest.java
+++ b/activeio/src/test/org/activeio/packet/async/aio/AIOAsyncChannelTest.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio.net;
+package org.activeio.packet.async.aio;
import java.io.IOException;
import java.net.URI;
@@ -22,6 +22,8 @@ import java.net.URISyntaxException;
import org.activeio.Channel;
import org.activeio.ChannelServer;
+import org.activeio.packet.async.aio.AIOAsyncChannelFactory;
+import org.activeio.packet.sync.SyncChannelTestSupport;
/**
* @version $Revision$
diff --git a/activeio/src/test/org/activeio/net/NIOAsyncChannelTest.java b/activeio/src/test/org/activeio/packet/async/nio/NIOAsyncChannelTest.java
similarity index 86%
rename from activeio/src/test/org/activeio/net/NIOAsyncChannelTest.java
rename to activeio/src/test/org/activeio/packet/async/nio/NIOAsyncChannelTest.java
index 664e994d2f..a9a215e82e 100644
--- a/activeio/src/test/org/activeio/net/NIOAsyncChannelTest.java
+++ b/activeio/src/test/org/activeio/packet/async/nio/NIOAsyncChannelTest.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio.net;
+package org.activeio.packet.async.nio;
import java.io.IOException;
import java.net.URI;
@@ -22,6 +22,8 @@ import java.net.URISyntaxException;
import org.activeio.Channel;
import org.activeio.ChannelServer;
+import org.activeio.packet.async.nio.NIOAsyncChannelFactory;
+import org.activeio.packet.sync.SyncChannelTestSupport;
/**
* @version $Revision$
diff --git a/activeio/src/test/org/activeio/net/VMPipeAsyncChannelTest.java b/activeio/src/test/org/activeio/packet/async/vmpipe/VMPipeAsyncChannelTest.java
similarity index 85%
rename from activeio/src/test/org/activeio/net/VMPipeAsyncChannelTest.java
rename to activeio/src/test/org/activeio/packet/async/vmpipe/VMPipeAsyncChannelTest.java
index 8a4c079b64..22f0946c5f 100644
--- a/activeio/src/test/org/activeio/net/VMPipeAsyncChannelTest.java
+++ b/activeio/src/test/org/activeio/packet/async/vmpipe/VMPipeAsyncChannelTest.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio.net;
+package org.activeio.packet.async.vmpipe;
import java.io.IOException;
import java.net.URI;
@@ -22,6 +22,8 @@ import java.net.URISyntaxException;
import org.activeio.Channel;
import org.activeio.ChannelServer;
+import org.activeio.packet.async.vmpipe.VMPipeAsyncChannelFactory;
+import org.activeio.packet.sync.SyncChannelTestSupport;
/**
* @version $Revision$
diff --git a/activeio/src/test/org/activeio/net/VMPipeReflectionAsyncChannelTest.java b/activeio/src/test/org/activeio/packet/async/vmpipe/VMPipeReflectionAsyncChannelTest.java
similarity index 86%
rename from activeio/src/test/org/activeio/net/VMPipeReflectionAsyncChannelTest.java
rename to activeio/src/test/org/activeio/packet/async/vmpipe/VMPipeReflectionAsyncChannelTest.java
index dcff958b8b..3e3d9901de 100644
--- a/activeio/src/test/org/activeio/net/VMPipeReflectionAsyncChannelTest.java
+++ b/activeio/src/test/org/activeio/packet/async/vmpipe/VMPipeReflectionAsyncChannelTest.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio.net;
+package org.activeio.packet.async.vmpipe;
import java.io.IOException;
import java.net.URI;
@@ -22,6 +22,8 @@ import java.net.URISyntaxException;
import org.activeio.Channel;
import org.activeio.ChannelServer;
+import org.activeio.packet.async.vmpipe.VMPipeAsyncChannelFactory;
+import org.activeio.packet.sync.SyncChannelTestSupport;
/**
* @version $Revision$
diff --git a/activeio/src/test/org/activeio/net/NIOSyncChannelTest.java b/activeio/src/test/org/activeio/packet/nio/NIOSyncChannelTest.java
similarity index 86%
rename from activeio/src/test/org/activeio/net/NIOSyncChannelTest.java
rename to activeio/src/test/org/activeio/packet/nio/NIOSyncChannelTest.java
index c4e90e100c..8f03c3217b 100644
--- a/activeio/src/test/org/activeio/net/NIOSyncChannelTest.java
+++ b/activeio/src/test/org/activeio/packet/nio/NIOSyncChannelTest.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio.net;
+package org.activeio.packet.nio;
import java.io.IOException;
import java.net.URI;
@@ -22,6 +22,8 @@ import java.net.URISyntaxException;
import org.activeio.Channel;
import org.activeio.ChannelServer;
+import org.activeio.packet.sync.SyncChannelTestSupport;
+import org.activeio.packet.sync.nio.NIOSyncChannelFactory;
/**
* @version $Revision$
diff --git a/activeio/src/test/org/activeio/net/ConnectionlessSyncChannelTestSupport.java b/activeio/src/test/org/activeio/packet/sync/ConnectionlessSyncChannelTestSupport.java
similarity index 94%
rename from activeio/src/test/org/activeio/net/ConnectionlessSyncChannelTestSupport.java
rename to activeio/src/test/org/activeio/packet/sync/ConnectionlessSyncChannelTestSupport.java
index 2039545d01..1196873e92 100644
--- a/activeio/src/test/org/activeio/net/ConnectionlessSyncChannelTestSupport.java
+++ b/activeio/src/test/org/activeio/packet/sync/ConnectionlessSyncChannelTestSupport.java
@@ -14,17 +14,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio.net;
+package org.activeio.packet.sync;
import edu.emory.mathcs.backport.java.util.concurrent.Executor;
import edu.emory.mathcs.backport.java.util.concurrent.ScheduledThreadPoolExecutor;
import org.activeio.Channel;
-import org.activeio.Packet;
-import org.activeio.SyncChannel;
import org.activeio.adapter.AsyncToSyncChannel;
import org.activeio.packet.ByteArrayPacket;
import org.activeio.packet.FilterPacket;
+import org.activeio.packet.Packet;
+import org.activeio.packet.sync.SyncChannel;
+import org.activeio.packet.sync.datagram.DatagramContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
diff --git a/activeio/src/test/org/activeio/net/SlowWriteSyncChannelFactory.java b/activeio/src/test/org/activeio/packet/sync/SlowWriteSyncChannelFactory.java
similarity index 87%
rename from activeio/src/test/org/activeio/net/SlowWriteSyncChannelFactory.java
rename to activeio/src/test/org/activeio/packet/sync/SlowWriteSyncChannelFactory.java
index e366cea9e8..4412745d08 100644
--- a/activeio/src/test/org/activeio/net/SlowWriteSyncChannelFactory.java
+++ b/activeio/src/test/org/activeio/packet/sync/SlowWriteSyncChannelFactory.java
@@ -15,19 +15,19 @@
* limitations under the License.
*
**/
-package org.activeio.net;
+package org.activeio.packet.sync;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.net.URI;
import org.activeio.Channel;
-import org.activeio.FilterSyncChannel;
-import org.activeio.FilterSyncChannelServer;
-import org.activeio.Packet;
-import org.activeio.SyncChannel;
-import org.activeio.SyncChannelFactory;
-import org.activeio.SyncChannelServer;
+import org.activeio.packet.Packet;
+import org.activeio.packet.sync.FilterSyncChannel;
+import org.activeio.packet.sync.FilterSyncChannelServer;
+import org.activeio.packet.sync.SyncChannel;
+import org.activeio.packet.sync.SyncChannelFactory;
+import org.activeio.packet.sync.SyncChannelServer;
/**
* Makes all the channels produced by another [@see org.activeio.SyncChannelFactory}
diff --git a/activeio/src/test/org/activeio/net/SyncChannelTestSupport.java b/activeio/src/test/org/activeio/packet/sync/SyncChannelTestSupport.java
similarity index 94%
rename from activeio/src/test/org/activeio/net/SyncChannelTestSupport.java
rename to activeio/src/test/org/activeio/packet/sync/SyncChannelTestSupport.java
index 6a0e7b6181..121f3c4341 100644
--- a/activeio/src/test/org/activeio/net/SyncChannelTestSupport.java
+++ b/activeio/src/test/org/activeio/packet/sync/SyncChannelTestSupport.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio.net;
+package org.activeio.packet.sync;
import edu.emory.mathcs.backport.java.util.concurrent.Executor;
import edu.emory.mathcs.backport.java.util.concurrent.ScheduledThreadPoolExecutor;
@@ -22,13 +22,14 @@ import edu.emory.mathcs.backport.java.util.concurrent.Semaphore;
import org.activeio.Channel;
import org.activeio.ChannelServer;
-import org.activeio.Packet;
-import org.activeio.SyncChannel;
-import org.activeio.SyncChannelServer;
import org.activeio.adapter.AsyncToSyncChannel;
import org.activeio.adapter.AsyncToSyncChannelServer;
import org.activeio.packet.ByteArrayPacket;
import org.activeio.packet.EOSPacket;
+import org.activeio.packet.Packet;
+import org.activeio.packet.sync.SyncChannel;
+import org.activeio.packet.sync.SyncChannelServer;
+import org.activeio.stream.sync.socket.SocketMetadata;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
diff --git a/activeio/src/test/org/activeio/net/DatagramSyncChannelTest.java b/activeio/src/test/org/activeio/packet/sync/datagram/DatagramSyncChannelTest.java
similarity index 84%
rename from activeio/src/test/org/activeio/net/DatagramSyncChannelTest.java
rename to activeio/src/test/org/activeio/packet/sync/datagram/DatagramSyncChannelTest.java
index 3ad5f918bf..29ec233445 100644
--- a/activeio/src/test/org/activeio/net/DatagramSyncChannelTest.java
+++ b/activeio/src/test/org/activeio/packet/sync/datagram/DatagramSyncChannelTest.java
@@ -14,12 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio.net;
+package org.activeio.packet.sync.datagram;
import java.io.IOException;
import java.net.URI;
import org.activeio.Channel;
+import org.activeio.packet.sync.ConnectionlessSyncChannelTestSupport;
+import org.activeio.packet.sync.datagram.DatagramSocketSyncChannelFactory;
/**
diff --git a/activeio/src/test/org/activeio/net/MulticastSyncChannelTest.java b/activeio/src/test/org/activeio/packet/sync/multicast/MulticastSyncChannelTest.java
similarity index 84%
rename from activeio/src/test/org/activeio/net/MulticastSyncChannelTest.java
rename to activeio/src/test/org/activeio/packet/sync/multicast/MulticastSyncChannelTest.java
index abaa827924..d090015b77 100644
--- a/activeio/src/test/org/activeio/net/MulticastSyncChannelTest.java
+++ b/activeio/src/test/org/activeio/packet/sync/multicast/MulticastSyncChannelTest.java
@@ -14,12 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio.net;
+package org.activeio.packet.sync.multicast;
import java.io.IOException;
import java.net.URI;
import org.activeio.Channel;
+import org.activeio.packet.sync.ConnectionlessSyncChannelTestSupport;
+import org.activeio.packet.sync.multicast.MulticastSocketSyncChannelFactory;
/**
diff --git a/activeio/src/test/org/activeio/net/SlowSocketChannelSyncChannelTest.java b/activeio/src/test/org/activeio/packet/sync/socket/SlowSocketChannelSyncChannelTest.java
similarity index 84%
rename from activeio/src/test/org/activeio/net/SlowSocketChannelSyncChannelTest.java
rename to activeio/src/test/org/activeio/packet/sync/socket/SlowSocketChannelSyncChannelTest.java
index 761eab7544..48b0c4593c 100644
--- a/activeio/src/test/org/activeio/net/SlowSocketChannelSyncChannelTest.java
+++ b/activeio/src/test/org/activeio/packet/sync/socket/SlowSocketChannelSyncChannelTest.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio.net;
+package org.activeio.packet.sync.socket;
import java.io.IOException;
import java.net.URI;
@@ -22,6 +22,9 @@ import java.net.URISyntaxException;
import org.activeio.Channel;
import org.activeio.ChannelServer;
+import org.activeio.packet.sync.SlowWriteSyncChannelFactory;
+import org.activeio.packet.sync.SyncChannelTestSupport;
+import org.activeio.packet.sync.nio.NIOSyncChannelFactory;
/**
* @version $Revision$
diff --git a/activeio/src/test/org/activeio/net/SlowSocketSyncChannelTest.java b/activeio/src/test/org/activeio/packet/sync/socket/SlowSocketSyncChannelTest.java
similarity index 83%
rename from activeio/src/test/org/activeio/net/SlowSocketSyncChannelTest.java
rename to activeio/src/test/org/activeio/packet/sync/socket/SlowSocketSyncChannelTest.java
index 991ed6643f..74ceefcf76 100644
--- a/activeio/src/test/org/activeio/net/SlowSocketSyncChannelTest.java
+++ b/activeio/src/test/org/activeio/packet/sync/socket/SlowSocketSyncChannelTest.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio.net;
+package org.activeio.packet.sync.socket;
import java.io.IOException;
import java.net.URI;
@@ -22,6 +22,9 @@ import java.net.URISyntaxException;
import org.activeio.Channel;
import org.activeio.ChannelServer;
+import org.activeio.packet.sync.SlowWriteSyncChannelFactory;
+import org.activeio.packet.sync.SyncChannelTestSupport;
+import org.activeio.packet.sync.socket.SocketSyncChannelFactory;
/**
* @version $Revision$
diff --git a/activeio/src/test/org/activeio/net/SocketSyncChannelTest.java b/activeio/src/test/org/activeio/packet/sync/socket/SocketSyncChannelTest.java
similarity index 85%
rename from activeio/src/test/org/activeio/net/SocketSyncChannelTest.java
rename to activeio/src/test/org/activeio/packet/sync/socket/SocketSyncChannelTest.java
index e255dce9a7..e72cb08a7d 100644
--- a/activeio/src/test/org/activeio/net/SocketSyncChannelTest.java
+++ b/activeio/src/test/org/activeio/packet/sync/socket/SocketSyncChannelTest.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio.net;
+package org.activeio.packet.sync.socket;
import java.io.IOException;
import java.net.URI;
@@ -22,6 +22,8 @@ import java.net.URISyntaxException;
import org.activeio.Channel;
import org.activeio.ChannelServer;
+import org.activeio.packet.sync.SyncChannelTestSupport;
+import org.activeio.packet.sync.socket.SocketSyncChannelFactory;
/**
* @version $Revision$
diff --git a/activeio/src/test/org/activeio/net/SslSocketSynchChannelTest.java b/activeio/src/test/org/activeio/packet/sync/ssl/SslSocketSynchChannelTest.java
similarity index 89%
rename from activeio/src/test/org/activeio/net/SslSocketSynchChannelTest.java
rename to activeio/src/test/org/activeio/packet/sync/ssl/SslSocketSynchChannelTest.java
index d0a98ec34e..c9f363555a 100644
--- a/activeio/src/test/org/activeio/net/SslSocketSynchChannelTest.java
+++ b/activeio/src/test/org/activeio/packet/sync/ssl/SslSocketSynchChannelTest.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.activeio.net;
+package org.activeio.packet.sync.ssl;
import java.io.IOException;
import java.net.URI;
@@ -22,6 +22,8 @@ import java.net.URISyntaxException;
import org.activeio.Channel;
import org.activeio.ChannelServer;
+import org.activeio.packet.sync.SyncChannelTestSupport;
+import org.activeio.packet.sync.ssl.SslSocketSyncChannelFactory;
/**
* @version $Revision$