KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > server > ss > provider > ASSelectionKey


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23 package com.sun.enterprise.server.ss.provider;
24
25 import java.nio.channels.SelectableChannel JavaDoc;
26 import java.nio.channels.SelectionKey JavaDoc;
27 import java.nio.channels.Selector JavaDoc;
28
29                                                                                                                              
30 /**
31  * SelectionKey implementation for the socket wrappers of Quick startup
32  * implementation.
33  * Basic reason for introducing this class is to make sure that any service
34  * that does a SelectionKey.channel().accept() to accept the connections
35  * are blocked until the server startup completes.
36  *
37  * @see ASSelector
38  */

39 public class ASSelectionKey extends SelectionKey JavaDoc {
40
41     private SelectableChannel JavaDoc channel = null;
42     private SelectionKey JavaDoc key = null;
43
44     private Selector JavaDoc sel = null;
45
46     ASSelectionKey(SelectableChannel JavaDoc channel,
47                    SelectionKey JavaDoc key,
48                    Selector JavaDoc sel) {
49         this.channel = channel;
50         this.key = key;
51         this.sel = sel;
52     }
53
54     public SelectableChannel JavaDoc channel() {
55         return channel;
56     }
57
58     public Selector JavaDoc selector() {
59         return sel;
60     }
61
62     public boolean isValid() {
63         return key.isValid();
64     }
65
66     public void cancel() {
67         key.cancel();
68     }
69
70     public int interestOps() {
71         return key.interestOps();
72     }
73
74     public SelectionKey JavaDoc interestOps(int i) {
75         return key.interestOps(i);
76     }
77
78     public int readyOps() {
79         return key.readyOps();
80     }
81
82     public boolean equals(java.lang.Object JavaDoc obj) {
83         return key.equals(obj);
84     }
85
86     public int hashCode() {
87         return key.hashCode();
88     }
89 }
90
Popular Tags