|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.knipp.rritoolkit.PooledPort
public class PooledPort
class that manages a pool of channels to the registry
Nested Class Summary | |
---|---|
private class |
PooledPort.PoolManager
thread that coordinates the pool, i.e. allocates and deallocates channels depending on the needs |
private static class |
PooledPort.WaitEntry
class that describes a waiting thread |
private static class |
PooledPort.WriteException
exception that specifically marks I/O exceptions that happen during the sending of the EPP command |
Field Summary | |
---|---|
private int |
allocateChannels
the number of channels to allocate |
private java.util.Queue<RegistryChannel> |
available
the pool of available channels |
private int |
channelCount
the number of currently allocated channels |
private Codec |
codec
the codec we are using |
private ChannelFactory |
factory
the channel factory |
private PooledPort.PoolManager |
manager
the pool mananger |
private java.lang.Thread |
managerThread
the thread the manager is running on |
private int |
maxChannels
the maximum number of channels to allocate |
private int |
minChannels
minimum number of channels to leave in the pool |
private java.lang.String |
password
the password for the login |
private boolean |
shutdown
the shutdown flag |
private java.lang.Object |
syncObject
the object on which internal synchronisation is coordinated |
private java.lang.String |
userName
user name for the login |
private java.util.Queue<PooledPort.WaitEntry> |
waiting
the queue of waiting threads |
Constructor Summary | |
---|---|
PooledPort(ChannelFactory theFactory,
Codec theCodec,
java.lang.String theUserName,
java.lang.String thePassword,
int allocate,
int min,
int max)
constructor |
Method Summary | |
---|---|
private RegistryChannel |
acquireChannel()
acquire a channel. |
private void |
discardChannel(RegistryChannel channel)
discard a channel |
private Response |
execute(RegistryChannel channel,
Request request)
execute a request on the given channel |
Response |
execute(Request request)
"execute" a request, i.e. send it to the registry and wait for the response |
private void |
returnChannel(RegistryChannel channel)
return a channel to the pool or to a waiting thread |
void |
shutdown()
terminate the port and close all open channels. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Codec codec
private ChannelFactory factory
private int allocateChannels
private int minChannels
private int maxChannels
private java.lang.String userName
private java.lang.String password
private final java.lang.Object syncObject
private int channelCount
private java.util.Queue<RegistryChannel> available
private java.util.Queue<PooledPort.WaitEntry> waiting
private PooledPort.PoolManager manager
private java.lang.Thread managerThread
private boolean shutdown
Constructor Detail |
---|
public PooledPort(ChannelFactory theFactory, Codec theCodec, java.lang.String theUserName, java.lang.String thePassword, int allocate, int min, int max)
theFactory
- the channel factorytheCodec
- the codec to use; if null
a default codec is used.theUserName
- the user namethePassword
- the passwordallocate
- the number of connections that shall
be allocated without request (should be
less or equal to min)min
- the minium number of channels to keep in
the poolmax
- the maximum number of channels that
shall be allocatedMethod Detail |
---|
private void discardChannel(RegistryChannel channel)
channel
- the channel to discardprivate void returnChannel(RegistryChannel channel)
channel
- the channel to returnprivate RegistryChannel acquireChannel() throws java.io.IOException
java.io.IOException
- if the channel could not be allocatedprivate Response execute(RegistryChannel channel, Request request) throws java.io.IOException
channel
- the channelrequest
- the request
java.io.IOException
- if either the transmission or the reception failedpublic void shutdown()
public Response execute(Request request) throws java.io.IOException
execute
in interface Port
request
- the request
java.io.IOException
- if either the transmission or the reception failed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |