1
1
// **********************************************************************
3
// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
3
// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
5
5
// This copy of Ice is licensed to you under the terms described in the
6
6
// ICE_LICENSE file included in this distribution.
10
10
package IceInternal;
12
public abstract class EventHandler extends SelectorHandler
12
public abstract class EventHandler
15
// Return true if the handler is for a datagram transport, false otherwise.
17
abstract public boolean datagram();
20
// Return true if read() must be called before calling message().
22
abstract public boolean readable();
25
// Read data via the event handler. May only be called if
26
// readable() returns true.
28
abstract public boolean read(BasicStream is);
31
// A complete message has been received.
33
abstract public void message(BasicStream stream, ThreadPool threadPool);
36
// Will be called if the event handler is finally
37
// unregistered. (Calling unregister() does not unregister
40
abstract public void finished(ThreadPool threadPool);
43
// Propagate an exception to the event handler.
45
abstract public void exception(Ice.LocalException ex);
15
// Called when there's a message ready to be processed.
17
abstract public void message(ThreadPoolCurrent current);
20
// Called when the event handler is unregistered.
22
abstract public void finished(ThreadPoolCurrent current);
48
25
// Get a textual representation of the event handler.
50
27
abstract public String toString();
52
public IceInternal.Instance
59
EventHandler(Instance instance)
62
_stream = new BasicStream(instance);
65
protected Instance _instance;
68
// The _stream data member is only for use by the ThreadPool or by the
69
// connection for validation.
71
protected BasicStream _stream;
30
// Get the native information of the handler, this is used by the selector.
32
abstract public java.nio.channels.SelectableChannel fd();
35
// In Java, it's possible that the transceiver reads more data than what was
36
// really asked. If this is the case, hasMoreData() returns true and the handler
37
// read() method should be called again (without doing a select()). This is
38
// handled by the Selector class (it adds the handler to a separate list of
39
// handlers if this method returns true.)
41
abstract public boolean hasMoreData();
46
java.nio.channels.SelectionKey _key = null;