diff options
author | Benoit Foucher <benoit@zeroc.com> | 2009-08-21 15:55:01 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2009-08-21 15:55:01 +0200 |
commit | b9f2fa14fb3f222a6ec5e0a93bf25fe5ad12b56a (patch) | |
tree | 183215e2dbeadfbc871b800ce09726e58af38b91 /java/src/IceInternal/EventHandler.java | |
parent | adding compression cookbook demo (diff) | |
download | ice-b9f2fa14fb3f222a6ec5e0a93bf25fe5ad12b56a.tar.bz2 ice-b9f2fa14fb3f222a6ec5e0a93bf25fe5ad12b56a.tar.xz ice-b9f2fa14fb3f222a6ec5e0a93bf25fe5ad12b56a.zip |
IOCP changes, bug 3501, 4200, 4156, 3101
Diffstat (limited to 'java/src/IceInternal/EventHandler.java')
-rw-r--r-- | java/src/IceInternal/EventHandler.java | 65 |
1 files changed, 19 insertions, 46 deletions
diff --git a/java/src/IceInternal/EventHandler.java b/java/src/IceInternal/EventHandler.java index ba7dfd69103..328db4ac1ca 100644 --- a/java/src/IceInternal/EventHandler.java +++ b/java/src/IceInternal/EventHandler.java @@ -9,66 +9,39 @@ package IceInternal; -public abstract class EventHandler extends SelectorHandler +public abstract class EventHandler { // - // Return true if the handler is for a datagram transport, false otherwise. + // Called when there's a message ready to be processed. // - abstract public boolean datagram(); + abstract public void message(ThreadPoolCurrent current); // - // Return true if read() must be called before calling message(). + // Called when the event handler is unregistered. // - abstract public boolean readable(); + abstract public void finished(ThreadPoolCurrent current); // - // Read data via the event handler. May only be called if - // readable() returns true. - // - abstract public boolean read(BasicStream is); - - // - // A complete message has been received. + // Get a textual representation of the event handler. // - abstract public void message(BasicStream stream, ThreadPool threadPool); + abstract public String toString(); // - // Will be called if the event handler is finally - // unregistered. (Calling unregister() does not unregister - // immediately.) + // Get the native information of the handler, this is used by the selector. // - abstract public void finished(ThreadPool threadPool); + abstract public java.nio.channels.SelectableChannel fd(); // - // Propagate an exception to the event handler. + // In Java, it's possible that the transceiver reads more data than what was + // really asked. If this is the case, hasMoreData() returns true and the handler + // read() method should be called again (without doing a select()). This is + // handled by the Selector class (it adds the handler to a separate list of + // handlers if this method returns true.) // - abstract public void exception(Ice.LocalException ex); + abstract public boolean hasMoreData(); - // - // Get a textual representation of the event handler. - // - abstract public String toString(); - - public IceInternal.Instance - instance() - { - return _instance; - } - - protected - EventHandler(Instance instance) - { - _instance = instance; - _stream = new BasicStream(instance); - } - - protected Instance _instance; - - // - // The _stream data member is only for use by the ThreadPool or by the - // connection for validation. - // - protected BasicStream _stream; - boolean _serializing; - boolean _registered; + int _disabled = 0; + int _registered = 0; + int _ready = 0; + java.nio.channels.SelectionKey _key = null; } |