svn commit: r708203 - /mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioProcessor.java

2008-10-27 Thread elecharny
Author: elecharny
Date: Mon Oct 27 07:48:26 2008
New Revision: 708203

URL: http://svn.apache.org/viewvc?rev=708203&view=rev
Log:
Added some javadoc

Modified:

mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioProcessor.java

Modified: 
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioProcessor.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioProcessor.java?rev=708203&r1=708202&r2=708203&view=diff
==
--- 
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioProcessor.java
 (original)
+++ 
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioProcessor.java
 Mon Oct 27 07:48:26 2008
@@ -206,22 +206,43 @@
 }
 }
 
+/**
+ * An encapsulating iterator around the  [EMAIL PROTECTED] 
Selector#selectedKeys()} 
+ * or the [EMAIL PROTECTED] Selector#keys()} iterator;
+ */
 protected static class IoSessionIterator implements Iterator {
-private final Iterator i;
+private final Iterator iterator;
+
+/**
+ * Create this iterator as a wrapper on top of the selectionKey
+ * Set.
+ * @param keys
+ */
 private IoSessionIterator(Set keys) {
-i = keys.iterator();
+   iterator = keys.iterator();
 }
+
+/**
+ * [EMAIL PROTECTED]
+ */
 public boolean hasNext() {
-return i.hasNext();
+return iterator.hasNext();
 }
 
+/**
+ * [EMAIL PROTECTED]
+ */
 public NioSession next() {
-SelectionKey key = i.next();
-return (NioSession) key.attachment();
+SelectionKey key = iterator.next();
+NioSession nioSession =  (NioSession) key.attachment();
+return nioSession;
 }
 
+/**
+ * [EMAIL PROTECTED]
+ */
 public void remove() {
-i.remove();
+   iterator.remove();
 }
 }
 }
\ No newline at end of file




svn commit: r708218 - in /mina/trunk/core/src/main/java/org/apache/mina: core/polling/ transport/socket/nio/

2008-10-27 Thread elecharny
Author: elecharny
Date: Mon Oct 27 08:16:48 2008
New Revision: 708218

URL: http://svn.apache.org/viewvc?rev=708218&view=rev
Log:
o Removed some dead code
o Added a select() method without timeout for the IoProcessor
o Replaced a call to select(1000) by a call to select(), as there are no reason 
we should stop the select process every second.

Modified:

mina/trunk/core/src/main/java/org/apache/mina/core/polling/AbstractPollingConnectionlessIoAcceptor.java

mina/trunk/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java

mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramAcceptor.java

mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioProcessor.java

Modified: 
mina/trunk/core/src/main/java/org/apache/mina/core/polling/AbstractPollingConnectionlessIoAcceptor.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/core/polling/AbstractPollingConnectionlessIoAcceptor.java?rev=708218&r1=708217&r2=708218&view=diff
==
--- 
mina/trunk/core/src/main/java/org/apache/mina/core/polling/AbstractPollingConnectionlessIoAcceptor.java
 (original)
+++ 
mina/trunk/core/src/main/java/org/apache/mina/core/polling/AbstractPollingConnectionlessIoAcceptor.java
 Mon Oct 27 08:16:48 2008
@@ -114,6 +114,7 @@
 
 protected abstract void init() throws Exception;
 protected abstract void destroy() throws Exception;
+protected abstract int select() throws Exception;
 protected abstract int select(int timeout) throws Exception;
 protected abstract void wakeup();
 protected abstract Iterator selectedHandles();
@@ -333,7 +334,7 @@
 
 while (selectable) {
 try {
-int selected = select(1000);
+int selected = select();
 
 nHandles += registerHandles();
 

Modified: 
mina/trunk/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java?rev=708218&r1=708217&r2=708218&view=diff
==
--- 
mina/trunk/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java
 (original)
+++ 
mina/trunk/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java
 Mon Oct 27 08:16:48 2008
@@ -187,6 +187,13 @@
 protected abstract int select(int timeout) throws Exception;
 
 /**
+ * poll those sessions forever
+ * @return The number of session ready for read or for write
+ * @throws Exception if some low level IO error occurs
+ */
+protected abstract int select() throws Exception;
+
+/**
  * Say if the list of [EMAIL PROTECTED] IoSession} polled by this [EMAIL 
PROTECTED] IoProcessor} 
  * is empty
  * @return true if at least a session is managed by this [EMAIL PROTECTED] 
IoProcessor}
@@ -340,14 +347,6 @@
  * [EMAIL PROTECTED]
  */
 public final void flush(T session) {
-// The following optimization has been disabled because it can cause 
StackOverflowError.
-//if (Thread.currentThread() == workerThread) {
-//// Bypass the queue if called from the worker thread itself
-//// (i.e. single thread model).
-//flushNow(session, System.currentTimeMillis());
-//return;
-//}
-
 boolean needsWakeup = flushingSessions.isEmpty();
 if (scheduleFlush(session) && needsWakeup) {
 wakeup();
@@ -533,7 +532,8 @@
 
 private void process() throws Exception {
 for (Iterator i = selectedSessions(); i.hasNext();) {
-process(i.next());
+   T session = i.next();
+process(session);
 i.remove();
 }
 }

Modified: 
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramAcceptor.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramAcceptor.java?rev=708218&r1=708217&r2=708218&view=diff
==
--- 
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramAcceptor.java
 (original)
+++ 
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramAcceptor.java
 Mon Oct 27 08:16:48 2008
@@ -170,6 +170,11 @@
 }
 
 @Override
+protected int select() throws Exception {
+return selector.select();
+}
+
+@Override
 protected int select(int timeout) throws Exception {
 return selector.select(timeout);
 }

Modified: 
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioProcessor.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/

Build failed in Hudson: MINA-trun k » Apache MINA APR Transport #62

2008-10-27 Thread Apache Hudson Server
See 
http://hudson.zones.apache.org/hudson/job/MINA-trunk/org.apache.mina$mina-transport-apr/62/changes

--
[INFO] 
[INFO] Building Apache MINA APR Transport
[INFO]task-segment: [clean, install]
[INFO] 
[INFO] [clean:clean]
[INFO] Deleting directory 
http://hudson.zones.apache.org/hudson/job/MINA-trunk/org.apache.mina$mina-transport-apr/ws/target
 
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] snapshot org.apache.mina:mina-core:2.0.0-M4-SNAPSHOT: checking for 
updates from apache.snapshots
[INFO] [compiler:compile]
[INFO] Compiling 7 source files to 
http://hudson.zones.apache.org/hudson/job/MINA-trunk/org.apache.mina$mina-transport-apr/ws/target/classes
 
[HUDSON] Archiving 
http://hudson.zones.apache.org/hudson/job/MINA-trunk/org.apache.mina$mina-transport-apr/ws/pom.xml
  to 
/export/home/hudson/hudson/jobs/MINA-trunk/modules/org.apache.mina$mina-transport-apr/builds/2008-10-27_15-20-51/archive/org.apache.mina/mina-transport-apr/2.0.0-M4-SNAPSHOT/pom.xml
[INFO] 
[ERROR] BUILD FAILURE
[INFO] 
[INFO] Compilation failure
http://hudson.zones.apache.org/hudson/job/MINA-trunk/org.apache.mina$mina-transport-apr/ws/src/main/java/org/apache/mina/transport/socket/apr/AprIoProcessor.java
 :[46,13] org.apache.mina.transport.socket.apr.AprIoProcessor is not abstract 
and does not override abstract method select() in 
org.apache.mina.core.polling.AbstractPollingIoProcessor



http://hudson.zones.apache.org/hudson/job/MINA-trunk/org.apache.mina$mina-transport-apr/ws/src/main/java/org/apache/mina/transport/socket/apr/AprIoProcessor.java
 :[46,13] org.apache.mina.transport.socket.apr.AprIoProcessor is not abstract 
and does not override abstract method select() in 
org.apache.mina.core.polling.AbstractPollingIoProcessor


[INFO] 
[INFO] For more information, run Maven with the -e switch
[INFO] 
[INFO] Total time: 1 minute 17 seconds
[INFO] Finished at: Mon Oct 27 15:22:11 UTC 2008
[INFO] Final Memory: 31M/189M
[INFO] 



svn commit: r708221 - /mina/trunk/transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprIoProcessor.java

2008-10-27 Thread elecharny
Author: elecharny
Date: Mon Oct 27 08:31:36 2008
New Revision: 708221

URL: http://svn.apache.org/viewvc?rev=708221&view=rev
Log:
Forget to commit this class after the addition of the select() method

Modified:

mina/trunk/transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprIoProcessor.java

Modified: 
mina/trunk/transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprIoProcessor.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprIoProcessor.java?rev=708221&r1=708220&r2=708221&view=diff
==
--- 
mina/trunk/transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprIoProcessor.java
 (original)
+++ 
mina/trunk/transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprIoProcessor.java
 Mon Oct 27 08:31:36 2008
@@ -125,6 +125,11 @@
 }
 
 @Override
+protected int select() throws Exception {
+   return select(Integer.MAX_VALUE);
+}
+
+   @Override
 protected int select(int timeout) throws Exception {
 int rv = Poll.poll(pollset, 1000 * timeout, polledSockets, false);
 if (rv <= 0) {




Hudson build is back to normal: MINA- trunk » Apache MINA APR Transport #63

2008-10-27 Thread Apache Hudson Server
See 
http://hudson.zones.apache.org/hudson/job/MINA-trunk/org.apache.mina$mina-transport-apr/63/changes




svn commit: r708228 - /mina/trunk/core/src/main/java/org/apache/mina/core/session/IdleStatusChecker.java

2008-10-27 Thread elecharny
Author: elecharny
Date: Mon Oct 27 09:11:51 2008
New Revision: 708228

URL: http://svn.apache.org/viewvc?rev=708228&view=rev
Log:
Removed the useless inner Invokedtask interface, and renamed the 
InvokedTaskImpl to InvokedTask.

Modified:

mina/trunk/core/src/main/java/org/apache/mina/core/session/IdleStatusChecker.java

Modified: 
mina/trunk/core/src/main/java/org/apache/mina/core/session/IdleStatusChecker.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/core/session/IdleStatusChecker.java?rev=708228&r1=708227&r2=708228&view=diff
==
--- 
mina/trunk/core/src/main/java/org/apache/mina/core/session/IdleStatusChecker.java
 (original)
+++ 
mina/trunk/core/src/main/java/org/apache/mina/core/session/IdleStatusChecker.java
 Mon Oct 27 09:11:51 2008
@@ -42,7 +42,7 @@
 private final Set services =
 new ConcurrentHashSet();
 
-private final NotifyingTask notifyingTask = new NotifyingTaskImpl();
+private final NotifyingTask notifyingTask = new NotifyingTask();
 private final IoFutureListener sessionCloseListener =
 new SessionCloseListener();
 
@@ -69,16 +69,7 @@
 return notifyingTask;
 }
 
-public interface NotifyingTask extends Runnable {
-/**
- * Cancels this task.  Once canceled, [EMAIL PROTECTED] #run()} method 
will always return immediately.
- * To start this task again after calling this method, you have to 
create a new instance of
- * [EMAIL PROTECTED] IdleStatusChecker} again.
- */
-void cancel();
-}
-
-private class NotifyingTaskImpl implements NotifyingTask {
+public class NotifyingTask implements Runnable {
 private volatile boolean cancelled;
 private volatile Thread thread;
 




svn commit: r708239 - in /mina/trunk/core/src/main/java/org/apache/mina/core/session: AbstractIoSession.java IoSession.java

2008-10-27 Thread elecharny
Author: elecharny
Date: Mon Oct 27 10:12:16 2008
New Revision: 708239

URL: http://svn.apache.org/viewvc?rev=708239&view=rev
Log:
o Added some Javadoc and comments
o Declared three methods in IoSession interface

Modified:

mina/trunk/core/src/main/java/org/apache/mina/core/session/AbstractIoSession.java
mina/trunk/core/src/main/java/org/apache/mina/core/session/IoSession.java

Modified: 
mina/trunk/core/src/main/java/org/apache/mina/core/session/AbstractIoSession.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/core/session/AbstractIoSession.java?rev=708239&r1=708238&r2=708239&view=diff
==
--- 
mina/trunk/core/src/main/java/org/apache/mina/core/session/AbstractIoSession.java
 (original)
+++ 
mina/trunk/core/src/main/java/org/apache/mina/core/session/AbstractIoSession.java
 Mon Oct 27 10:12:16 2008
@@ -31,6 +31,7 @@
 
 import org.apache.mina.core.buffer.IoBuffer;
 import org.apache.mina.core.file.DefaultFileRegion;
+import org.apache.mina.core.filterchain.IoFilterChain;
 import org.apache.mina.core.future.CloseFuture;
 import org.apache.mina.core.future.DefaultCloseFuture;
 import org.apache.mina.core.future.DefaultReadFuture;
@@ -44,6 +45,7 @@
 import org.apache.mina.core.service.IoService;
 import org.apache.mina.core.service.TransportMetadata;
 import org.apache.mina.core.write.DefaultWriteRequest;
+import org.apache.mina.core.write.WriteException;
 import org.apache.mina.core.write.WriteRequest;
 import org.apache.mina.core.write.WriteRequestQueue;
 import org.apache.mina.core.write.WriteToClosedSessionException;
@@ -363,22 +365,33 @@
 throw new NullPointerException("message");
 }
 
+// We can't send a message to a connected session if we don't have 
+// the remote address
 if (!getTransportMetadata().isConnectionless() &&
 remoteAddress != null) {
 throw new UnsupportedOperationException();
 }
 
+
+// If the session has been closed or is closing, we can't either
+// send a message to the remote side. We generate a future
+// containing an exception.
 if (isClosing() || !isConnected()) {
 WriteFuture future = new DefaultWriteFuture(this);
 WriteRequest request = new DefaultWriteRequest(message, future, 
remoteAddress);
-future.setException(new WriteToClosedSessionException(request));
+WriteException writeException = new 
WriteToClosedSessionException(request);
+future.setException(writeException);
 return future;
 }
 
 FileChannel openedFileChannel = null;
+
+// TODO: remove this code as soon as we use InputStream
+// instead of Object for the message.
 try {
 if (message instanceof IoBuffer
 && !((IoBuffer) message).hasRemaining()) {
+// Nothing to write : probably an error in the user code
 throw new IllegalArgumentException(
 "message is empty. Forgot to call flip()?");
 } else if (message instanceof FileChannel) {
@@ -394,14 +407,20 @@
 return DefaultWriteFuture.newNotWrittenFuture(this, e);
 }
 
-WriteFuture future = new DefaultWriteFuture(this);
-getFilterChain().fireFilterWrite(
-new DefaultWriteRequest(message, future, remoteAddress));
+// Now, we can write the message. First, create a future
+WriteFuture writeFuture = new DefaultWriteFuture(this);
+WriteRequest writeRequest = new DefaultWriteRequest(message, 
writeFuture, remoteAddress);
+
+// Then, get the chain and inject the WriteRequest into it
+IoFilterChain filterChain = getFilterChain();
+filterChain.fireFilterWrite(writeRequest);
 
+// TODO : This is not our business ! The caller has created a 
FileChannel,
+// he has to close it !
 if (openedFileChannel != null) {
 // If we opened a FileChannel, it needs to be closed when the 
write has completed
 final FileChannel finalChannel = openedFileChannel;
-future.addListener(new IoFutureListener() {
+writeFuture.addListener(new IoFutureListener() {
 public void operationComplete(WriteFuture future) {
 try {
 finalChannel.close();
@@ -412,7 +431,8 @@
 });
 }
 
-return future;
+// Return the WriteFuture.
+return writeFuture;
 }
 
 /**
@@ -642,15 +662,7 @@
 }
 
 /**
- * Update all statistical properties related with throughput assuming
- * the specified time is the current time.  By default this method returns
- * silently without updating the throughput properties if they were
- * calculated already within last
- * [EMAIL PROTECTED] Io

svn commit: r708247 - /mina/trunk/core/src/main/java/org/apache/mina/core/filterchain/DefaultIoFilterChain.java

2008-10-27 Thread elecharny
Author: elecharny
Date: Mon Oct 27 10:35:16 2008
New Revision: 708247

URL: http://svn.apache.org/viewvc?rev=708247&view=rev
Log:
Split chained calls in multiple lines, to help the poor guy who tries to debug 
those methods.

In this case, using method chaining is really a bad idea :
entry.getFilter().sessionCreated(entry.getNextFilter(), session);
o there is no way to directly know which is the current filter
o there is no way to directly know which is the next filter
o If one wants to jump into the sessioncreated() method directly, it's quite a 
nightmare on almost all current IDE (having to go in and out 3 methods for 
nothing ...

Modified:

mina/trunk/core/src/main/java/org/apache/mina/core/filterchain/DefaultIoFilterChain.java

Modified: 
mina/trunk/core/src/main/java/org/apache/mina/core/filterchain/DefaultIoFilterChain.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/core/filterchain/DefaultIoFilterChain.java?rev=708247&r1=708246&r2=708247&view=diff
==
--- 
mina/trunk/core/src/main/java/org/apache/mina/core/filterchain/DefaultIoFilterChain.java
 (original)
+++ 
mina/trunk/core/src/main/java/org/apache/mina/core/filterchain/DefaultIoFilterChain.java
 Mon Oct 27 10:35:16 2008
@@ -353,7 +353,9 @@
 
 private void callNextSessionCreated(Entry entry, IoSession session) {
 try {
-entry.getFilter().sessionCreated(entry.getNextFilter(), session);
+IoFilter filter = entry.getFilter();
+NextFilter nextFilter = entry.getNextFilter();
+filter.sessionCreated(nextFilter, session);
 } catch (Throwable e) {
 fireExceptionCaught(e);
 }
@@ -366,7 +368,9 @@
 
 private void callNextSessionOpened(Entry entry, IoSession session) {
 try {
-entry.getFilter().sessionOpened(entry.getNextFilter(), session);
+IoFilter filter = entry.getFilter();
+NextFilter nextFilter = entry.getNextFilter();
+filter.sessionOpened(nextFilter, session);
 } catch (Throwable e) {
 fireExceptionCaught(e);
 }
@@ -387,7 +391,9 @@
 
 private void callNextSessionClosed(Entry entry, IoSession session) {
 try {
-entry.getFilter().sessionClosed(entry.getNextFilter(), session);
+IoFilter filter = entry.getFilter();
+NextFilter nextFilter = entry.getNextFilter();
+filter.sessionClosed(nextFilter, session);
 } catch (Throwable e) {
 fireExceptionCaught(e);
 }
@@ -402,7 +408,9 @@
 private void callNextSessionIdle(Entry entry, IoSession session,
 IdleStatus status) {
 try {
-entry.getFilter().sessionIdle(entry.getNextFilter(), session,
+IoFilter filter = entry.getFilter();
+NextFilter nextFilter = entry.getNextFilter();
+filter.sessionIdle(nextFilter, session,
 status);
 } catch (Throwable e) {
 fireExceptionCaught(e);
@@ -422,7 +430,9 @@
 private void callNextMessageReceived(Entry entry, IoSession session,
 Object message) {
 try {
-entry.getFilter().messageReceived(entry.getNextFilter(), session,
+IoFilter filter = entry.getFilter();
+NextFilter nextFilter = entry.getNextFilter();
+filter.messageReceived(nextFilter, session,
 message);
 } catch (Throwable e) {
 fireExceptionCaught(e);
@@ -445,7 +455,9 @@
 private void callNextMessageSent(Entry entry, IoSession session,
 WriteRequest writeRequest) {
 try {
-entry.getFilter().messageSent(entry.getNextFilter(), session,
+IoFilter filter = entry.getFilter();
+NextFilter nextFilter = entry.getNextFilter();
+filter.messageSent(nextFilter, session,
 writeRequest);
 } catch (Throwable e) {
 fireExceptionCaught(e);
@@ -464,7 +476,9 @@
 .removeAttribute(SESSION_CREATED_FUTURE);
 if (future == null) {
 try {
-entry.getFilter().exceptionCaught(entry.getNextFilter(),
+IoFilter filter = entry.getFilter();
+NextFilter nextFilter = entry.getNextFilter();
+filter.exceptionCaught(nextFilter,
 session, cause);
 } catch (Throwable e) {
 logger
@@ -488,8 +502,9 @@
 private void callPreviousFilterWrite(Entry entry, IoSession session,
 WriteRequest writeRequest) {
 try {
-entry.getFilter().filterWrite(entry.getNextFilter(), session,
-writeRequest);
+IoFilter filter = entry.getFilter();
+NextFilter nextFilter = entry.getNextFilter();
+filter.filterWrite(nextFilter, session, writeRequest);

svn commit: r708265 - /mina/trunk/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoAcceptor.java

2008-10-27 Thread elecharny
Author: elecharny
Date: Mon Oct 27 11:21:41 2008
New Revision: 708265

URL: http://svn.apache.org/viewvc?rev=708265&view=rev
Log:
Added some comment

Modified:

mina/trunk/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoAcceptor.java

Modified: 
mina/trunk/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoAcceptor.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoAcceptor.java?rev=708265&r1=708264&r2=708265&view=diff
==
--- 
mina/trunk/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoAcceptor.java
 (original)
+++ 
mina/trunk/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoAcceptor.java
 Mon Oct 27 11:21:41 2008
@@ -389,6 +389,9 @@
 while (selectable) {
 try {
 // Detect if we have some keys ready to be processed
+// The select() will be woke up if some new connection
+// have occurred, or if the selector has been explicitely
+// woke up
 int selected = select();
 
 // this actually sets the selector to OP_ACCEPT,




svn commit: r708268 - /mina/trunk/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java

2008-10-27 Thread elecharny
Author: elecharny
Date: Mon Oct 27 11:22:33 2008
New Revision: 708268

URL: http://svn.apache.org/viewvc?rev=708268&view=rev
Log:
Unfold some method chaining.

Modified:

mina/trunk/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java

Modified: 
mina/trunk/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java?rev=708268&r1=708267&r2=708268&view=diff
==
--- 
mina/trunk/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java
 (original)
+++ 
mina/trunk/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java
 Mon Oct 27 11:22:33 2008
@@ -33,6 +33,7 @@
 
 import org.apache.mina.core.buffer.IoBuffer;
 import org.apache.mina.core.file.FileRegion;
+import org.apache.mina.core.filterchain.IoFilterChain;
 import org.apache.mina.core.future.DefaultIoFuture;
 import org.apache.mina.core.service.AbstractIoService;
 import org.apache.mina.core.service.IoProcessor;
@@ -427,7 +428,8 @@
 // Clear the DefaultIoFilterChain.CONNECT_FUTURE attribute
 // and call ConnectFuture.setException().
 scheduleRemove(session);
-session.getFilterChain().fireExceptionCaught(e);
+IoFilterChain filterChain = session.getFilterChain(); 
+filterChain.fireExceptionCaught(e);
 wakeup();
 } else {
 ExceptionMonitor.getInstance().exceptionCaught(e);
@@ -482,7 +484,8 @@
 destroy(session);
 return true;
 } catch (Exception e) {
-session.getFilterChain().fireExceptionCaught(e);
+IoFilterChain filterChain = session.getFilterChain(); 
+filterChain.fireExceptionCaught(e);
 } finally {
 clearWriteRequestQueue(session);
 ((AbstractIoService) 
session.getService()).getListeners().fireSessionDestroyed(session);
@@ -507,7 +510,8 @@
 buf.reset();
 failedRequests.add(req);
 } else {
-session.getFilterChain().fireMessageSent(req);
+IoFilterChain filterChain = session.getFilterChain(); 
+filterChain.fireMessageSent(req);
 }
 } else {
 failedRequests.add(req);
@@ -526,7 +530,8 @@
 session.decreaseScheduledBytesAndMessages(r);
 r.getFuture().setException(cause);
 }
-session.getFilterChain().fireExceptionCaught(cause);
+IoFilterChain filterChain = session.getFilterChain(); 
+filterChain.fireExceptionCaught(cause);
 }
 }
 
@@ -579,7 +584,8 @@
 }
 
 if (readBytes > 0) {
-session.getFilterChain().fireMessageReceived(buf);
+IoFilterChain filterChain = session.getFilterChain(); 
+filterChain.fireMessageReceived(buf);
 buf = null;
 
 if (hasFragmentation) {
@@ -597,7 +603,8 @@
 if (e instanceof IOException) {
 scheduleRemove(session);
 }
-session.getFilterChain().fireExceptionCaught(e);
+IoFilterChain filterChain = session.getFilterChain(); 
+filterChain.fireExceptionCaught(e);
 }
 }
 
@@ -629,7 +636,8 @@
 }
 } catch (Exception e) {
 scheduleRemove(session);
-session.getFilterChain().fireExceptionCaught(e);
+IoFilterChain filterChain = session.getFilterChain(); 
+filterChain.fireExceptionCaught(e);
 }
 break;
 case CLOSED:
@@ -729,7 +737,8 @@
 }
 } while (writtenBytes < maxWrittenBytes);
 } catch (Exception e) {
-session.getFilterChain().fireExceptionCaught(e);
+IoFilterChain filterChain = session.getFilterChain(); 
+filterChain.fireExceptionCaught(e);
 return false;
 }
 
@@ -795,7 +804,8 @@
 
 private void fireMessageSent(T session, WriteRequest req) {
 session.setCurrentWriteRequest(null);
-session.getFilterChain().fireMessageSent(req);
+IoFilterChain filterChain = session.getFilterChain(); 
+filterChain.fireMessageSent(req);
 }
 
 private void updateTrafficMask() {
@@ -832,7 +842,8 @@
 try {
 setInterestedInRead(session, (mask & SelectionKey.OP_READ) != 0);
 } catch (Exception e) {
-session.getFilterChain().fireExceptionCaught(e);
+IoFilterChain filterChain = session.getFilterChain(); 
+filterChain.fireExceptionCaught(e);
 }

svn commit: r708386 - /mina/trunk/core/src/main/java/org/apache/mina/core/session/IdleStatusChecker.java

2008-10-27 Thread elecharny
Author: elecharny
Date: Mon Oct 27 16:47:56 2008
New Revision: 708386

URL: http://svn.apache.org/viewvc?rev=708386&view=rev
Log:
o Simplified a method by suppressing some useless test and branch.
o Using IoSession as an argument instead of AbstractIoSession for two methods
o Removed some method chaining to facilitate the debugging

Modified:

mina/trunk/core/src/main/java/org/apache/mina/core/session/IdleStatusChecker.java

Modified: 
mina/trunk/core/src/main/java/org/apache/mina/core/session/IdleStatusChecker.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/core/session/IdleStatusChecker.java?rev=708386&r1=708385&r2=708386&view=diff
==
--- 
mina/trunk/core/src/main/java/org/apache/mina/core/session/IdleStatusChecker.java
 (original)
+++ 
mina/trunk/core/src/main/java/org/apache/mina/core/session/IdleStatusChecker.java
 Mon Oct 27 16:47:56 2008
@@ -22,6 +22,7 @@
 import java.util.Iterator;
 import java.util.Set;
 
+import org.apache.mina.core.future.CloseFuture;
 import org.apache.mina.core.future.IoFuture;
 import org.apache.mina.core.future.IoFutureListener;
 import org.apache.mina.core.service.AbstractIoService;
@@ -50,7 +51,8 @@
 
 public void addSession(AbstractIoSession session) {
 sessions.add(session);
-session.getCloseFuture().addListener(sessionCloseListener);
+CloseFuture closeFuture = session.getCloseFuture();
+closeFuture.addListener(sessionCloseListener);
 }
 
 public void addService(AbstractIoService service) {
@@ -165,53 +167,29 @@
  * @param currentTime the current time (i.e. [EMAIL PROTECTED] 
System#currentTimeMillis()})
  */
 public static void notifyIdleSession(IoSession session, long currentTime) {
-if (session instanceof AbstractIoSession) {
-AbstractIoSession s = (AbstractIoSession) session;
-notifyIdleSession1(
-s, currentTime,
-s.getConfig().getIdleTimeInMillis(IdleStatus.BOTH_IDLE),
-IdleStatus.BOTH_IDLE, Math.max(
-s.getLastIoTime(),
-s.getLastIdleTime(IdleStatus.BOTH_IDLE)));
-
-notifyIdleSession1(
-s, currentTime,
-s.getConfig().getIdleTimeInMillis(IdleStatus.READER_IDLE),
-IdleStatus.READER_IDLE, Math.max(
-s.getLastReadTime(),
-s.getLastIdleTime(IdleStatus.READER_IDLE)));
-
-notifyIdleSession1(
-s, currentTime,
-s.getConfig().getIdleTimeInMillis(IdleStatus.WRITER_IDLE),
-IdleStatus.WRITER_IDLE, Math.max(
-s.getLastWriteTime(),
-s.getLastIdleTime(IdleStatus.WRITER_IDLE)));
-
-notifyWriteTimeout(s, currentTime);
-updateThroughput(s, currentTime);
-} else {
-notifyIdleSession0(
-session, currentTime,
-
session.getConfig().getIdleTimeInMillis(IdleStatus.BOTH_IDLE),
-IdleStatus.BOTH_IDLE, Math.max(
-session.getLastIoTime(),
-session.getLastIdleTime(IdleStatus.BOTH_IDLE)));
-
-notifyIdleSession0(
-session, currentTime,
-
session.getConfig().getIdleTimeInMillis(IdleStatus.READER_IDLE),
-IdleStatus.READER_IDLE, Math.max(
-session.getLastReadTime(),
-session.getLastIdleTime(IdleStatus.READER_IDLE)));
-
-notifyIdleSession0(
-session, currentTime,
-
session.getConfig().getIdleTimeInMillis(IdleStatus.WRITER_IDLE),
-IdleStatus.WRITER_IDLE, Math.max(
-session.getLastWriteTime(),
-session.getLastIdleTime(IdleStatus.WRITER_IDLE)));
-}
+notifyIdleSession0(
+session, currentTime,
+session.getConfig().getIdleTimeInMillis(IdleStatus.BOTH_IDLE),
+IdleStatus.BOTH_IDLE, Math.max(
+session.getLastIoTime(),
+session.getLastIdleTime(IdleStatus.BOTH_IDLE)));
+
+notifyIdleSession0(
+session, currentTime,
+
session.getConfig().getIdleTimeInMillis(IdleStatus.READER_IDLE),
+IdleStatus.READER_IDLE, Math.max(
+session.getLastReadTime(),
+session.getLastIdleTime(IdleStatus.READER_IDLE)));
+
+notifyIdleSession0(
+session, currentTime,
+
session.getConfig().getIdleTimeInMillis(IdleStatus.WRITER_IDLE),
+IdleStatus.WRITER_IDLE, Math.max(
+session.getLastWriteTime(),

svn commit: r708390 - /mina/trunk/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java

2008-10-27 Thread elecharny
Author: elecharny
Date: Mon Oct 27 16:55:27 2008
New Revision: 708390

URL: http://svn.apache.org/viewvc?rev=708390&view=rev
Log:
Unfold some method chaining.

Modified:

mina/trunk/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java

Modified: 
mina/trunk/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java?rev=708390&r1=708389&r2=708390&view=diff
==
--- 
mina/trunk/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java
 (original)
+++ 
mina/trunk/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java
 Mon Oct 27 16:55:27 2008
@@ -597,9 +597,10 @@
 // Flush only when the buffer has remaining.
 if (!(encodedMessage instanceof IoBuffer) ||
 ((IoBuffer) encodedMessage).hasRemaining()) {
-nextFilter.filterWrite(
-session, new EncodedWriteRequest(
-encodedMessage, null, 
writeRequest.getDestination()));
+SocketAddress destination = writeRequest.getDestination();
+WriteRequest writeRequest = new EncodedWriteRequest(
+encodedMessage, null, destination); 
+nextFilter.filterWrite(session, writeRequest);
 }
 }
 }




[CONF] Apache MINA FtpServer: Index (page edited)

2008-10-27 Thread confluence










Page Edited :
FTPSERVER :
Index



 
Index
has been edited by Emmanuel Lécharny
(Oct 27, 2008).
 

  Change summary:
  Fix minor typoes

 
 (View changes)
 

Content:
Overview

The Apache FtpServer is a 100% pure Java FTP server. It's designed to be a complete and portable FTP server engine solution based on currently available open protocols. FtpServer can be run standalone as a Windows service or Unix/Linux daemon, or embedded into a Java application. We also provide support for integration within Spring applications.

The default network support is based on Apache MINA, a high performance asynchronous IO library. Using MINA, FtpServer can scale to a large number of concurrent users.

It is also an FTP application platform. We have developed a Java API to let you write Java code to process FTP event notifications that we call the Ftplet API. Apache FtpServer provides an implementation of an FTP server to support this API. 

To get started, have a look at one of our tutorials:

	Embedding FtpServer in 5 minutes
	Running FtpServer stand-alone in 5 minutes



You can also have a look at the documentation for how to configure FtpServer to suite your needs.

News




Monday, September 8, 2008




Apache FtpServer 1.0.0-M3 release




 The Apache MINA project is pleased to announce the release of FtpServer 1.0.0-M3.

This is the second milestone release of FtpServer. This release mainly contains bug fixes and minor enhancements since the last release. 

Release notes
Downloads
Documentation

We welcome you to try it out


Posted at 08 Sep @ 11:54 AM by

Niklas Gustavsson|

0 comments






Monday, August 11, 2008




Apache FtpServer 1.0.0-M2 release




 The Apache MINA project is pleased to announce the release of FtpServer 1.0.0-M2.

This is the first release of FtpServer and a big step towards getting 1.0 done, hopefully later this year.

We welcome you to try it out. We have tried to make it simple both to embed within your application as well as running it standalone. Feedback on feature requests, bugs or questions are most welcome at our mailing lists.


Posted at 11 Aug @ 2:18 PM by

Niklas Gustavsson|

0 comments
















Powered by
Atlassian Confluence
(Version: 2.2.9 Build:#527 Sep 07, 2006)
-
Bug/feature request

Unsubscribe or edit your notifications preferences