public class ServerManagerImpl extends java.lang.Object implements ServerManager
| Modifier and Type | Class and Description |
|---|---|
class |
ServerManagerImpl.AdapterManagerImpl
This class provides an implementation for the AdapterManager
interface.
|
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map |
m_channels
Active server channels.
|
protected java.lang.Object |
m_sync_io
Synchronization for the protocol and channel sets
|
| Constructor and Description |
|---|
ServerManagerImpl(org.omg.CORBA.ORB orb)
Construct new server manager.
|
| Modifier and Type | Method and Description |
|---|---|
void |
channel_reaper()
This function runs in a separate thread and cleans up
any channels which are not used for a long time.
|
AdapterManager |
create_adapter_manager()
Create an adapter manager.
|
byte[] |
create_cacheable_object_key(boolean use_suid,
byte[][] parts)
This function is used by adapters to generate a key which will
participate in adapter lookup short-circuiting.
|
void |
enqueue_request(ServerRequest request)
Begin dispatch sequence for incoming request.
|
byte[][] |
extract_cacheable_object_key(byte[] object_key)
Extract the component parts of a cacheable object_key.
|
ObjectAdapter |
find_adapter(byte[] object_key)
This function finds an adapter for the specified object id.
|
java.lang.Object[] |
get_protocol_ids()
Return the array of registered protocols.
|
protected java.lang.String[] |
getChannelsInfo()
Returns an array of strings describing the active server channels.
|
boolean |
is_cacheable_object_key(byte[] object_key)
Returns true if the given object_key can be used in the cache.
|
boolean |
is_local_cacheable_object_key(byte[] object_key)
Returns true if the given object_key is cacheable and was
created by this server.
|
boolean |
is_suid_object_key(byte[] object_key)
Returns true if the given object key has a persistent target.
|
org.omg.CORBA.ORB |
orb()
Return the orb.
|
void |
protocol_listening(ServerProtocol protocol)
This is called when a server protocol begins listening.
|
void |
protocol_not_listening(ServerProtocol protocol,
boolean paused)
This is called when a server protocol is no longer listening.
|
void |
register_adapter(byte[] aid,
ObjectAdapter adapter)
Register an adapter.
|
void |
register_channel(ServerChannel channel)
This operation occours when a protocol accepts a new incoming channel.
|
void |
register_protocol(int profile_tag,
ServerProtocol protocol)
Register a server protocol.
|
boolean |
serve_request(boolean wait)
This is called from orb.perform_work, it serves a single request.
|
protected void |
serve_request(ServerRequest request)
This function is responsible for all the queue management, it takes
an incoming request from the head of the queue and either dispatches
the request or puts it in the appropriate holding location.
|
void |
setMaxManagerHeldRequests(int maxManagerHeldRequests)
Maximum number of requests which may be held by an adapter in the HOLDING
state.
|
void |
setMaxQueueSize(int maxQueueSize)
Set maximum queue size.
|
void |
setThreadPoolLimits(int min,
int max)
Set thread pool size ranges.
|
void |
shutdown(boolean wait_for_complete)
Spawns a thread to do the shutdown if wait_for_complete is false.
|
void |
startup(boolean block,
boolean allowPool)
Start the thread groups for server io operations and for channel
reaping.
|
void |
unregister_adapter(byte[] aid)
Unregister an adapter.
|
void |
unregister_channel(ServerChannel channel)
Called when a channel enters the closed state.
|
boolean |
work_pending()
Returns true if there are requests waiting in the incomming request
queue for resources.
|
protected final java.lang.Object m_sync_io
protected java.util.Map m_channels
public ServerManagerImpl(org.omg.CORBA.ORB orb)
orb - The controling orb.public org.omg.CORBA.ORB orb()
orb in interface ServerManagerpublic void setThreadPoolLimits(int min,
int max)
setThreadPoolLimits in interface ServerManagermin - minimum size for thread pool. Must be greater than 0 and
less than max.max - maximum thread pool size. If this is 0 then requests
will only be processed when the orb.perform_work function is
called. Must be greater than 0.public void setMaxQueueSize(int maxQueueSize)
setMaxQueueSize in interface ServerManagermaxQueueSize - maximum queue size. Must be greater than 1. Values
should be several times the maximum thread pool size.public void setMaxManagerHeldRequests(int maxManagerHeldRequests)
setMaxManagerHeldRequests in interface ServerManagermaxManagerHeldRequests - ceiling on adapter held requests.
Individial adapter managers may modify this value downwards. Use 0 to
dissallow the adapter holding state, and Integer.MAX_VALUE for
no limit.public byte[] create_cacheable_object_key(boolean use_suid,
byte[][] parts)
create_cacheable_object_key in interface ServerManagerpublic byte[][] extract_cacheable_object_key(byte[] object_key)
extract_cacheable_object_key in interface ServerManagerpublic boolean is_cacheable_object_key(byte[] object_key)
is_cacheable_object_key in interface ServerManagerpublic boolean is_suid_object_key(byte[] object_key)
is_suid_object_key in interface ServerManagerpublic boolean is_local_cacheable_object_key(byte[] object_key)
is_local_cacheable_object_key in interface ServerManagerpublic void register_protocol(int profile_tag,
ServerProtocol protocol)
register_protocol in interface ServerManagerprofile_tag - Profile tag of IOR consturcted with the protocol.protocol - The server protocol.public java.lang.Object[] get_protocol_ids()
get_protocol_ids in interface ServerManagerpublic void protocol_listening(ServerProtocol protocol)
protocol_listening in interface ServerManagerprotocol - The server protocol.public void protocol_not_listening(ServerProtocol protocol, boolean paused)
protocol_not_listening in interface ServerManagerprotocol - The server protocol.paused - If true when the server side is shut down close will still
be called on the protocol.public void register_channel(ServerChannel channel)
register_channel in interface ServerManagerpublic void unregister_channel(ServerChannel channel)
unregister_channel in interface ServerManagerpublic void channel_reaper()
channel_reaper in interface ServerManagerpublic ObjectAdapter find_adapter(byte[] object_key)
find_adapter in interface ServerManagerpublic void register_adapter(byte[] aid,
ObjectAdapter adapter)
register_adapter in interface ServerManagerpublic void unregister_adapter(byte[] aid)
unregister_adapter in interface ServerManagerpublic AdapterManager create_adapter_manager()
create_adapter_manager in interface ServerManagerpublic void enqueue_request(ServerRequest request)
enqueue_request in interface ServerManagerpublic boolean work_pending()
ServerManagerwork_pending in interface ServerManagerpublic boolean serve_request(boolean wait)
serve_request in interface ServerManagerprotected void serve_request(ServerRequest request)
public void startup(boolean block,
boolean allowPool)
startup in interface ServerManagerblock - true if this funtion should not return until
the server is shut down.allowPool - true if the thread pool is allowed. Once a call
the thread pool has been started it cannot be dissallowed
in the future by calling this with a false.public void shutdown(boolean wait_for_complete)
shutdown in interface ServerManagerwait_for_complete - If true wait until all channels have closed
and incomming requests have finished processing. If false all
active requests will be canceled and the function will return once
connections have shutdown.protected java.lang.String[] getChannelsInfo()