KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > caucho > server > port > PortAdmin


1 /*
2  * Copyright (c) 1998-2006 Caucho Technology -- all rights reserved
3  *
4  * This file is part of Resin(R) Open Source
5  *
6  * Each copy or derived work must preserve the copyright notice and this
7  * notice unmodified.
8  *
9  * Resin Open Source is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Resin Open Source is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
17  * of NON-INFRINGEMENT. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with Resin Open Source; if not, write to the
22  * Free SoftwareFoundation, Inc.
23  * 59 Temple Place, Suite 330
24  * Boston, MA 02111-1307 USA
25  *
26  * @author Sam
27  */

28
29
30 package com.caucho.server.port;
31
32 import com.caucho.management.server.AbstractManagedObject;
33 import com.caucho.management.server.PortMXBean;
34
35 public class PortAdmin extends AbstractManagedObject
36   implements PortMXBean
37 {
38   private Port _port;
39
40   public PortAdmin(Port port)
41   {
42     _port = port;
43   }
44
45   public String JavaDoc getName()
46   {
47     String JavaDoc addr = _port.getAddress();
48
49     if (addr == null)
50       addr = "INADDR_ANY";
51     
52     return addr + '-' + _port.getPort();
53   }
54
55   public String JavaDoc getProtocolName()
56   {
57     return _port.getProtocolName();
58   }
59
60   public String JavaDoc getAddress()
61   {
62     return _port.getAddress();
63   }
64
65   public int getPort()
66   {
67     return _port.getPort();
68   }
69
70   public int getConnectionMax()
71   {
72     return _port.getConnectionMax();
73   }
74
75   public int getKeepaliveMax()
76   {
77     return _port.getKeepaliveMax();
78   }
79
80   public long getKeepaliveTimeout()
81   {
82     return _port.getKeepaliveTimeout();
83   }
84
85   public boolean isSSL()
86   {
87     return _port.isSSL();
88   }
89
90   public long getSocketTimeout()
91   {
92     return _port.getSocketTimeout();
93   }
94
95   public String JavaDoc getState()
96   {
97     return _port.getLifecycleState().getStateName();
98   }
99
100   public int getThreadCount()
101   {
102     return _port.getThreadCount();
103   }
104
105   public int getThreadActiveCount()
106   {
107     return _port.getActiveThreadCount();
108   }
109
110   public int getThreadIdleCount()
111   {
112     return _port.getIdleThreadCount();
113   }
114
115   public int getThreadKeepaliveCount()
116   {
117     return _port.getKeepaliveConnectionCount();
118   }
119
120   public int getSelectKeepaliveCount()
121   {
122     return _port.getSelectConnectionCount();
123   }
124
125   public long getRequestCountTotal()
126   {
127     return _port.getLifetimeRequestCount();
128   }
129
130   public long getKeepaliveCountTotal()
131   {
132     return _port.getLifetimeKeepaliveCount();
133   }
134
135   public long getClientDisconnectCountTotal()
136   {
137     return _port.getLifetimeClientDisconnectCount();
138   }
139
140   public long getRequestTimeTotal()
141   {
142     return _port.getLifetimeRequestTime();
143   }
144
145   public long getReadBytesTotal()
146   {
147     return _port.getLifetimeReadBytes();
148   }
149
150   public long getWriteBytesTotal()
151   {
152     return _port.getLifetimeWriteBytes();
153   }
154
155   void register()
156   {
157     registerSelf();
158   }
159
160   public String JavaDoc toString()
161   {
162     return "PortAdmin[" + getObjectName() + "]";
163   }
164
165 }
166
Popular Tags