~ubuntu-branches/ubuntu/quantal/zeroc-ice/quantal

« back to all changes in this revision

Viewing changes to java/src/IceInternal/EventHandler.java

  • Committer: Bazaar Package Importer
  • Author(s): Cleto Martin Angelina
  • Date: 2011-04-25 18:44:24 UTC
  • mfrom: (6.1.14 sid)
  • Revision ID: james.westby@ubuntu.com-20110425184424-sep9i9euu434vq4c
Tags: 3.4.1-7
* Bug fix: "libdb5.1-java.jar was renamed to db.jar", thanks to Ondřej
  Surý (Closes: #623555).
* Bug fix: "causes noise in php5", thanks to Jayen Ashar (Closes:
  #623533).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// **********************************************************************
2
2
//
3
 
// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
 
3
// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
4
4
//
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.
9
9
 
10
10
package IceInternal;
11
11
 
12
 
public abstract class EventHandler extends SelectorHandler
 
12
public abstract class EventHandler
13
13
{
14
14
    //
15
 
    // Return true if the handler is for a datagram transport, false otherwise.
16
 
    //
17
 
    abstract public boolean datagram();
18
 
 
19
 
    //
20
 
    // Return true if read() must be called before calling message().
21
 
    //
22
 
    abstract public boolean readable();
23
 
 
24
 
    //
25
 
    // Read data via the event handler. May only be called if
26
 
    // readable() returns true.
27
 
    //
28
 
    abstract public boolean read(BasicStream is);
29
 
 
30
 
    //
31
 
    // A complete message has been received.
32
 
    //
33
 
    abstract public void message(BasicStream stream, ThreadPool threadPool);
34
 
 
35
 
    //
36
 
    // Will be called if the event handler is finally
37
 
    // unregistered. (Calling unregister() does not unregister
38
 
    // immediately.)
39
 
    //
40
 
    abstract public void finished(ThreadPool threadPool);
41
 
 
42
 
    //
43
 
    // Propagate an exception to the event handler.
44
 
    //
45
 
    abstract public void exception(Ice.LocalException ex);
 
15
    // Called when there's a message ready to be processed.
 
16
    //
 
17
    abstract public void message(ThreadPoolCurrent current);
 
18
 
 
19
    //
 
20
    // Called when the event handler is unregistered.
 
21
    //
 
22
    abstract public void finished(ThreadPoolCurrent current);
46
23
 
47
24
    //
48
25
    // Get a textual representation of the event handler.
49
26
    //
50
27
    abstract public String toString();
51
28
 
52
 
    public IceInternal.Instance
53
 
    instance()
54
 
    {
55
 
        return _instance;
56
 
    }
57
 
 
58
 
    protected
59
 
    EventHandler(Instance instance)
60
 
    {
61
 
        _instance = instance;
62
 
        _stream = new BasicStream(instance);
63
 
    }
64
 
 
65
 
    protected Instance _instance;
66
 
 
67
 
    //
68
 
    // The _stream data member is only for use by the ThreadPool or by the
69
 
    // connection for validation.
70
 
    //
71
 
    protected BasicStream _stream;
72
 
    boolean _serializing;
73
 
    boolean _registered;
 
29
    //
 
30
    // Get the native information of the handler, this is used by the selector.
 
31
    //
 
32
    abstract public java.nio.channels.SelectableChannel fd();
 
33
 
 
34
    //
 
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.)
 
40
    //
 
41
    abstract public boolean hasMoreData();
 
42
 
 
43
    int _disabled = 0;
 
44
    int _registered = 0;
 
45
    int _ready = 0;
 
46
    java.nio.channels.SelectionKey _key = null;
74
47
}