hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r500289 - in /jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio: impl/reactor/ reactor/
Date Fri, 26 Jan 2007 17:53:04 GMT
Author: olegk
Date: Fri Jan 26 09:53:04 2007
New Revision: 500289

URL: http://svn.apache.org/viewvc?view=rev&rev=500289
Log:
HTTPCORE-29: DefaultConnectingIOReactor.execute propagates IOException, but isn't really re-callable

Changelog:
* I/O reactor implementations re-throw all fatal I/O exceptions as IOReactorException (subclass
of IOException)
* All non-fatal I/O exceptions are passed onto a user defined event dispatcher
* Default implementation of the listening I/O reactor now can use an optional exception handler
to detemine whether an I/O exception thrown while accepting a new connection is fatal or not

Added:
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/reactor/IOReactorException.java
  (with props)
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/reactor/IOReactorExceptionHandler.java
  (with props)
Modified:
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/reactor/AbstractIOReactor.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/reactor/AbstractMultiworkerIOReactor.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/reactor/BaseIOReactor.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/reactor/DefaultConnectingIOReactor.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/reactor/DefaultListeningIOReactor.java

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/reactor/AbstractIOReactor.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/reactor/AbstractIOReactor.java?view=diff&rev=500289&r1=500288&r2=500289
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/reactor/AbstractIOReactor.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/reactor/AbstractIOReactor.java
Fri Jan 26 09:53:04 2007
@@ -32,6 +32,7 @@
 package org.apache.http.nio.impl.reactor;
 
 import java.io.IOException;
+import java.io.InterruptedIOException;
 import java.nio.channels.CancelledKeyException;
 import java.nio.channels.ClosedSelectorException;
 import java.nio.channels.SelectionKey;
@@ -42,6 +43,7 @@
 
 import org.apache.http.nio.reactor.IOEventDispatch;
 import org.apache.http.nio.reactor.IOReactor;
+import org.apache.http.nio.reactor.IOReactorException;
 import org.apache.http.nio.reactor.IOSession;
 
 public abstract class AbstractIOReactor implements IOReactor {
@@ -56,16 +58,20 @@
     
     protected IOEventDispatch eventDispatch = null;
     
-    public AbstractIOReactor(long selectTimeout) throws IOException {
+    public AbstractIOReactor(long selectTimeout) throws IOReactorException {
         super();
         if (selectTimeout <= 0) {
             throw new IllegalArgumentException("Select timeout may not be negative or zero");
         }
         this.selectTimeout = selectTimeout;
-        this.selector = Selector.open();
         this.sessions = new SessionSet();
         this.closedSessions = new SessionQueue();
         this.newChannels = new ChannelQueue();
+        try {
+            this.selector = Selector.open();
+        } catch (IOException ex) {
+            throw new IOReactorException("Failure opening selector", ex);
+        }
     }
 
     protected abstract void acceptable(SelectionKey key);
@@ -92,7 +98,8 @@
         this.selector.wakeup();
     }
     
-    public void execute(final IOEventDispatch eventDispatch) throws IOException {
+    public void execute(final IOEventDispatch eventDispatch) 
+            throws InterruptedIOException, IOReactorException {
         if (eventDispatch == null) {
             throw new IllegalArgumentException("Event dispatcher may not be null");
         }
@@ -101,7 +108,15 @@
         try {
             for (;;) {
                 
-                int readyCount = this.selector.select(this.selectTimeout);
+                int readyCount;
+                try {
+                    readyCount = this.selector.select(this.selectTimeout);
+                } catch (InterruptedIOException ex) {
+                    throw ex;
+                } catch (IOException ex) {
+                    throw new IOReactorException("Unexpected selector failure", ex);
+                }
+                
                 if (this.closed) {
                     break;
                 }
@@ -156,13 +171,20 @@
         }
     }
 
-    private void processNewChannels() throws IOException {
+    private void processNewChannels() throws IOReactorException {
         ChannelEntry entry;
         while ((entry = this.newChannels.pop()) != null) {
             
-            SocketChannel channel = entry.getChannel();
-            channel.configureBlocking(false);
-            SelectionKey key = channel.register(this.selector, 0);
+            SocketChannel channel;
+            SelectionKey key;
+            try {
+                channel = entry.getChannel();
+                channel.configureBlocking(false);
+                key = channel.register(this.selector, 0);
+            } catch (IOException ex) {
+                throw new IOReactorException("Failure registering channel " +
+                        "with the selector", ex);
+            }
 
             IOSession session = new IOSessionImpl(key, new SessionClosedCallback() {
 
@@ -171,8 +193,18 @@
                 }
                 
             });
+            
+            int timeout = 0;
+            try {
+                timeout = channel.socket().getSoTimeout();
+            } catch (IOException ex) {
+                // Very unlikely to happen and is not fatal
+                // as the protocol layer is expected to overwrite
+                // this value anyways
+            }
+            
             session.setAttribute(IOSession.ATTACHMENT_KEY, entry.getAttachment());
-            session.setSocketTimeout(channel.socket().getSoTimeout());
+            session.setSocketTimeout(timeout);
             this.sessions.add(session);
             keyCreated(key, session);
             this.eventDispatch.connected(session);
@@ -202,13 +234,17 @@
         }
     }
     
-    public void shutdown() throws IOException {
+    public void shutdown() throws IOReactorException {
         if (this.closed) {
             return;
         }
         this.closed = true;
         // Stop dispatching I/O events
-        this.selector.close();
+        try {
+            this.selector.close();
+        } catch (IOException ex) {
+            throw new IOReactorException("Failure closing selector", ex);
+        }
     }
         
 }

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/reactor/AbstractMultiworkerIOReactor.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/reactor/AbstractMultiworkerIOReactor.java?view=diff&rev=500289&r1=500288&r2=500289
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/reactor/AbstractMultiworkerIOReactor.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/reactor/AbstractMultiworkerIOReactor.java
Fri Jan 26 09:53:04 2007
@@ -31,11 +31,11 @@
 
 package org.apache.http.nio.impl.reactor;
 
-import java.io.IOException;
 import java.io.InterruptedIOException;
 
 import org.apache.http.nio.reactor.IOEventDispatch;
 import org.apache.http.nio.reactor.IOReactor;
+import org.apache.http.nio.reactor.IOReactorException;
 
 public abstract class AbstractMultiworkerIOReactor implements IOReactor {
 
@@ -45,7 +45,8 @@
     
     private int currentWorker = 0;
     
-    public AbstractMultiworkerIOReactor(long selectTimeout, int workerCount) throws IOException
{
+    public AbstractMultiworkerIOReactor(long selectTimeout, int workerCount) 
+            throws IOReactorException {
         super();
         if (workerCount <= 0) {
             throw new IllegalArgumentException("Worker count may not be negative or zero");
@@ -68,7 +69,8 @@
         }
     }
 
-    protected void stopWorkers(int millis) throws IOException {
+    protected void stopWorkers(int millis) 
+            throws InterruptedIOException, IOReactorException {
         for (int i = 0; i < this.workerCount; i++) {
             this.ioReactors[i].shutdown();
         }
@@ -81,19 +83,22 @@
         }
     }
     
-    protected void verifyWorkers() throws IOException {
+    protected void verifyWorkers() 
+            throws InterruptedIOException, IOReactorException {
         for (int i = 0; i < this.workerCount; i++) {
             WorkerThread worker = this.threads[i];
             if (!worker.isAlive()) {
-                IOException ex = worker.getException();
-                if (ex != null) {
-                    throw ex;
+                if (worker.getReactorException() != null) {
+                    throw worker.getReactorException();
+                }
+                if (worker.getInterruptedException() != null) {
+                    throw worker.getInterruptedException();
                 }
             }
         }
     }
     
-    protected void addChannel(final ChannelEntry entry) throws IOException {
+    protected void addChannel(final ChannelEntry entry) {
         // Distribute new channels among the workers
         this.ioReactors[this.currentWorker++ % this.workerCount].addChannel(entry);
     }
@@ -103,7 +108,8 @@
         final BaseIOReactor ioReactor;
         final IOEventDispatch eventDispatch;
         
-        private volatile IOException exception;
+        private volatile IOReactorException reactorException;
+        private volatile InterruptedIOException interruptedException;
         
         public WorkerThread(final BaseIOReactor ioReactor, final IOEventDispatch eventDispatch)
{
             super();
@@ -114,19 +120,27 @@
         public void run() {
             try {
                 this.ioReactor.execute(this.eventDispatch);
-            } catch (IOException ex) {
-                this.exception = ex;
+            } catch (InterruptedIOException ex) {
+                this.interruptedException = ex;
+            } catch (IOReactorException ex) {
+                this.reactorException = ex;
             } finally {
                 try {
                     this.ioReactor.shutdown();
-                } catch (IOException ex2) {
-                    this.exception = ex2;
+                } catch (IOReactorException ex2) {
+                    if (this.reactorException == null) {
+                        this.reactorException = ex2;
+                    }
                 }
             }
         }
         
-        public IOException getException() {
-            return this.exception;
+        public IOReactorException getReactorException() {
+            return this.reactorException;
+        }
+
+        public InterruptedIOException getInterruptedException() {
+            return this.interruptedException;
         }
         
     }

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/reactor/BaseIOReactor.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/reactor/BaseIOReactor.java?view=diff&rev=500289&r1=500288&r2=500289
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/reactor/BaseIOReactor.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/reactor/BaseIOReactor.java
Fri Jan 26 09:53:04 2007
@@ -31,13 +31,13 @@
 
 package org.apache.http.nio.impl.reactor;
 
-import java.io.IOException;
 import java.nio.channels.CancelledKeyException;
 import java.nio.channels.SelectionKey;
 import java.util.Iterator;
 import java.util.Set;
 
 import org.apache.http.nio.reactor.EventMask;
+import org.apache.http.nio.reactor.IOReactorException;
 import org.apache.http.nio.reactor.IOSession;
 import org.apache.http.nio.reactor.SessionBufferStatus;
 
@@ -48,7 +48,7 @@
     
     private long lastTimeoutCheck;
     
-    public BaseIOReactor(long selectTimeout) throws IOException {
+    public BaseIOReactor(long selectTimeout) throws IOReactorException {
         super(selectTimeout);
         this.bufferingSessions = new SessionSet();
         this.timeoutCheckInterval = selectTimeout;

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/reactor/DefaultConnectingIOReactor.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/reactor/DefaultConnectingIOReactor.java?view=diff&rev=500289&r1=500288&r2=500289
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/reactor/DefaultConnectingIOReactor.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/reactor/DefaultConnectingIOReactor.java
Fri Jan 26 09:53:04 2007
@@ -32,6 +32,7 @@
 package org.apache.http.nio.impl.reactor;
 
 import java.io.IOException;
+import java.io.InterruptedIOException;
 import java.net.Socket;
 import java.net.SocketAddress;
 import java.nio.channels.CancelledKeyException;
@@ -43,6 +44,7 @@
 
 import org.apache.http.nio.reactor.ConnectingIOReactor;
 import org.apache.http.nio.reactor.IOEventDispatch;
+import org.apache.http.nio.reactor.IOReactorException;
 import org.apache.http.nio.reactor.SessionRequest;
 import org.apache.http.params.HttpConnectionParams;
 import org.apache.http.params.HttpParams;
@@ -61,24 +63,37 @@
     private long lastTimeoutCheck;
     
     public DefaultConnectingIOReactor(int workerCount, final HttpParams params) 
-            throws IOException {
+            throws IOReactorException {
         super(TIMEOUT_CHECK_INTERVAL, workerCount);
         if (params == null) {
             throw new IllegalArgumentException("HTTP parameters may not be null");
         }
         this.params = params;
-        this.selector = Selector.open();
         this.requestQueue = new SessionRequestQueue();
         this.lastTimeoutCheck = System.currentTimeMillis();
+        try {
+            this.selector = Selector.open();
+        } catch (IOException ex) {
+            throw new IOReactorException("Failure opening selector", ex);
+        }
     }
 
-    public void execute(final IOEventDispatch eventDispatch) throws IOException {
+    public void execute(final IOEventDispatch eventDispatch) 
+            throws InterruptedIOException, IOReactorException {
         if (eventDispatch == null) {
             throw new IllegalArgumentException("Event dispatcher may not be null");
         }
         startWorkers(eventDispatch);
         for (;;) {
-            int readyCount = this.selector.select(TIMEOUT_CHECK_INTERVAL);
+            int readyCount;
+            try {
+                readyCount = this.selector.select(TIMEOUT_CHECK_INTERVAL);
+            } catch (InterruptedIOException ex) {
+                throw ex;
+            } catch (IOException ex) {
+                throw new IOReactorException("Unexpected selector failure", ex);
+            }
+
             if (this.closed) {
                 break;
             }
@@ -101,7 +116,7 @@
         }
     }
     
-    private void processEvents(final Set selectedKeys) throws IOException {
+    private void processEvents(final Set selectedKeys) {
         for (Iterator it = selectedKeys.iterator(); it.hasNext(); ) {
             
             SelectionKey key = (SelectionKey) it.next();
@@ -111,7 +126,7 @@
         selectedKeys.clear();
     }
 
-    private void processEvent(final SelectionKey key) throws IOException {
+    private void processEvent(final SelectionKey key) {
         try {
             
             if (key.isConnectable()) {
@@ -189,20 +204,36 @@
         return sessionRequest;
     }
     
-    private void processSessionRequests() throws IOException {
+    private void processSessionRequests() throws IOReactorException {
         SessionRequestImpl request;
         while ((request = this.requestQueue.pop()) != null) {
             if (request.isCompleted()) {
                 continue;
             }
-            SocketChannel socketChannel = SocketChannel.open();
-            socketChannel.configureBlocking(false);
-            if (request.getLocalAddress() != null) {
-                socketChannel.socket().bind(request.getLocalAddress());
-            }
-            socketChannel.connect(request.getRemoteAddress());
-            SelectionKey key = socketChannel.register(this.selector, 0);
-            request.setKey(key);
+            SocketChannel socketChannel;
+            try {
+                socketChannel = SocketChannel.open();
+                socketChannel.configureBlocking(false);
+            } catch (IOException ex) {
+                throw new IOReactorException("Failure opening socket", ex);
+            }
+            try {
+                if (request.getLocalAddress() != null) {
+                    socketChannel.socket().bind(request.getLocalAddress());
+                }
+                socketChannel.connect(request.getRemoteAddress());
+            } catch (IOException ex) {
+                request.failed(ex);
+            }
+            
+            SelectionKey key;
+            try {
+                key = socketChannel.register(this.selector, 0);
+                request.setKey(key);
+            } catch (IOException ex) {
+                throw new IOReactorException("Failure registering channel " +
+                        "with the selector", ex);
+            }
 
             SessionRequestHandle requestHandle = new SessionRequestHandle(request); 
             key.attach(requestHandle);

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/reactor/DefaultListeningIOReactor.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/reactor/DefaultListeningIOReactor.java?view=diff&rev=500289&r1=500288&r2=500289
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/reactor/DefaultListeningIOReactor.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/reactor/DefaultListeningIOReactor.java
Fri Jan 26 09:53:04 2007
@@ -32,6 +32,7 @@
 package org.apache.http.nio.impl.reactor;
 
 import java.io.IOException;
+import java.io.InterruptedIOException;
 import java.net.Socket;
 import java.net.SocketAddress;
 import java.nio.channels.CancelledKeyException;
@@ -43,6 +44,8 @@
 import java.util.Set;
 
 import org.apache.http.nio.reactor.IOEventDispatch;
+import org.apache.http.nio.reactor.IOReactorException;
+import org.apache.http.nio.reactor.IOReactorExceptionHandler;
 import org.apache.http.nio.reactor.ListeningIOReactor;
 import org.apache.http.params.HttpConnectionParams;
 import org.apache.http.params.HttpParams;
@@ -57,24 +60,43 @@
     private final HttpParams params;
     private final Selector selector;
     
+    private IOReactorExceptionHandler exceptionHandler;
+    
     public DefaultListeningIOReactor(int workerCount, final HttpParams params) 
-            throws IOException {
+            throws IOReactorException {
         super(TIMEOUT_CHECK_INTERVAL, workerCount);
         if (params == null) {
             throw new IllegalArgumentException("HTTP parameters may not be null");
         }
         this.params = params;
-        this.selector = Selector.open();
+        try {
+            this.selector = Selector.open();
+        } catch (IOException ex) {
+            throw new IOReactorException("Failure opening selector", ex);
+        }
     }
 
+    public void setExceptionHandler(final IOReactorExceptionHandler exceptionHandler) {
+        this.exceptionHandler = exceptionHandler;
+    }
+    
     public void execute(final IOEventDispatch eventDispatch) 
-            throws IOException {
+            throws InterruptedIOException, IOReactorException {
         if (eventDispatch == null) {
             throw new IllegalArgumentException("Event dispatcher may not be null");
         }
         startWorkers(eventDispatch);
         for (;;) {
-            int readyCount = this.selector.select(TIMEOUT_CHECK_INTERVAL);
+
+            int readyCount;
+            try {
+                readyCount = this.selector.select(TIMEOUT_CHECK_INTERVAL);
+            } catch (InterruptedIOException ex) {
+                throw ex;
+            } catch (IOException ex) {
+                throw new IOReactorException("Unexpected selector failure", ex);
+            }
+            
             if (this.closed) {
                 break;
             }
@@ -85,7 +107,8 @@
         }
     }
     
-    private void processEvents(final Set selectedKeys) throws IOException {
+    private void processEvents(final Set selectedKeys)
+            throws IOReactorException {
         for (Iterator it = selectedKeys.iterator(); it.hasNext(); ) {
             
             SelectionKey key = (SelectionKey) it.next();
@@ -95,15 +118,30 @@
         selectedKeys.clear();
     }
 
-    private void processEvent(final SelectionKey key) throws IOException {
+    private void processEvent(final SelectionKey key) 
+            throws IOReactorException {
         try {
             
             if (key.isAcceptable()) {
                 
                 ServerSocketChannel serverChannel = (ServerSocketChannel) key.channel();
-                SocketChannel socketChannel = serverChannel.accept();
+                SocketChannel socketChannel = null;
+                try {
+                    socketChannel = serverChannel.accept();
+                } catch (IOException ex) {
+                    if (this.exceptionHandler == null || !this.exceptionHandler.handle(ex))
{
+                        throw new IOReactorException("Failure accepting connection", ex);
+                    }
+                }
+                
                 if (socketChannel != null) {
-                    prepareSocket(socketChannel.socket());
+                    try {
+                        prepareSocket(socketChannel.socket());
+                    } catch (IOException ex) {
+                        if (this.exceptionHandler == null || !this.exceptionHandler.handle(ex))
{
+                            throw new IOReactorException("Failure initalizing socket", ex);
+                        }
+                    }
                     ChannelEntry entry = new ChannelEntry(socketChannel); 
                     addChannel(entry);
                 }
@@ -142,5 +180,5 @@
         // Stop the workers
         stopWorkers(500);
     }
-        
+
 }

Added: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/reactor/IOReactorException.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/reactor/IOReactorException.java?view=auto&rev=500289
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/reactor/IOReactorException.java
(added)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/reactor/IOReactorException.java
Fri Jan 26 09:53:04 2007
@@ -0,0 +1,55 @@
+/*
+ * $HeadURL$
+ * $Revision$
+ * $Date$
+ *
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.nio.reactor;
+
+import java.io.IOException;
+
+/**
+ * I/O exception that can be thrown by an I/O reactor. Usually exceptions
+ * of this type are fatal and are not recoverable.
+ */
+public class IOReactorException extends IOException {
+
+    private static final long serialVersionUID = 6986850002663481135L;
+
+    public IOReactorException(final String message, final IOException cause) {
+        super(message);
+        if (cause != null) {
+            initCause(cause);
+        }
+    }
+    
+    public IOReactorException(final String message) {
+        super(message);
+    }
+
+}

Propchange: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/reactor/IOReactorException.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/reactor/IOReactorException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/reactor/IOReactorExceptionHandler.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/reactor/IOReactorExceptionHandler.java?view=auto&rev=500289
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/reactor/IOReactorExceptionHandler.java
(added)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/reactor/IOReactorExceptionHandler.java
Fri Jan 26 09:53:04 2007
@@ -0,0 +1,56 @@
+/*
+ * $HeadURL$
+ * $Revision$
+ * $Date$
+ *
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.nio.reactor;
+
+import java.io.IOException;
+
+/**
+ * Abstract exception handler intended to deal with potentially recoverable 
+ * I/O exceptions thrown by an I/O reactor
+ * 
+ * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
+ * 
+ */
+public interface IOReactorExceptionHandler {
+
+    /**
+     * This method is expected to examine the I/O exception passed as a parameter
+     * and decide whether it is safe to continue execution of the i/O reactor 
+     * 
+     * @param ex potentially recoverable I/O exception 
+     * @return <code>true</code> if it is safe to ignore the exception 
+     * and continue execution of the I/O reactor; <code>false</code> if the
+     * I/O reactor must throw {@link IOReactorException} and terminate 
+     */
+    boolean handle(IOException ex); 
+    
+}

Propchange: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/reactor/IOReactorExceptionHandler.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/reactor/IOReactorExceptionHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message