KickJava   Java API By Example, From Geeks To Geeks.

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


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  *
23  * Free Software Foundation, Inc.
24  * 59 Temple Place, Suite 330
25  * Boston, MA 02111-1307 USA
26  *
27  * @author Scott Ferguson
28  */

29
30 package com.caucho.server.port;
31
32 import com.caucho.server.dispatch.DispatchServer;
33
34 public class ProtocolDispatchServer extends DispatchServer {
35   private boolean _isIgnoreClientDisconnect = true;
36   private AbstractSelectManager _selectManager;
37
38   /**
39    * Sets the ignore-client-disconnect
40    */

41   public void setIgnoreClientDisconnect(boolean ignore)
42   {
43     _isIgnoreClientDisconnect = ignore;
44   }
45
46   /**
47    * Gets the ignore-client-disconnect
48    */

49   public boolean isIgnoreClientDisconnect()
50   {
51     return _isIgnoreClientDisconnect;
52   }
53
54   /**
55    * Returns true if the select manager is enabled.
56    */

57   public boolean isEnableSelectManager()
58   {
59     return false;
60   }
61
62   /**
63    * Gets the select manager.
64    */

65   public AbstractSelectManager getSelectManager()
66   {
67     return _selectManager;
68   }
69
70   /**
71    * Sets the select manager.
72    */

73   public void initSelectManager(AbstractSelectManager manager)
74   {
75     _selectManager = manager;
76   }
77
78   /**
79    * Returns the configured keepalive max.
80    */

81   public int getKeepaliveMax()
82   {
83     return Integer.MAX_VALUE / 2;
84   }
85
86   /**
87    * Returns the number of available keepalive connections.
88    */

89   public int getFreeSelectKeepalive()
90   {
91     return Integer.MAX_VALUE / 2;
92   }
93
94   /**
95    * Returns true if the server is active.
96    */

97   public boolean isActive()
98   {
99     return true;
100   }
101
102   /**
103    * Stops the server.
104    */

105   public void stop()
106   {
107     AbstractSelectManager manager = _selectManager;
108     _selectManager = null;
109
110     if (manager != null)
111       manager.stop();
112   }
113 }
114
Popular Tags