QuickServer
v1.4.7

org.quickserver.util.pool.thread
Class ClientPool

java.lang.Object
  extended byorg.quickserver.util.pool.thread.ClientPool

public class ClientPool
extends java.lang.Object

This is a class for managing the pool of threads for handling clients.

Since:
1.3
Author:
Akshathkumar Shetty

Field Summary
protected  java.util.List clients
           
protected  org.apache.commons.pool.ObjectPool pool
           
protected  PoolConfig poolConfig
           
 
Constructor Summary
ClientPool(QSObjectPool objectPool, PoolConfig poolConfig)
           
 
Method Summary
 void addClient(java.lang.Runnable r)
           
 void addClient(java.lang.Runnable r, boolean keepObjOnFail)
           
 void clear()
           
 void close()
           
protected  void finalize()
           
 java.util.Iterator getAllClientThread()
          Returns iterator containing all the active threads i.e ClientHandler handling connected clients.
 java.lang.Runnable getClient()
           
 int getMaxThreadsForNioWrite()
          Returns the maximum threads allowed for nio write
 int getNumActive()
          Return the number of instances currently borrowed from my pool.
 int getNumIdle()
          Return the number of instances currently idle in my pool.
 org.apache.commons.pool.ObjectPool getObjectPool()
           
 java.lang.Object getObjectToSynchronize()
           
 PoolConfig getPoolConfig()
          Returns PoolConfig object that configured this pool
 boolean isClientAvailable()
           
protected  void nioWriteEnd()
          Notifies when NIO write is complete.
protected  void nioWriteStart()
          Notifies when NIO write is about to start.
 void returnObject(java.lang.Object object)
           
 void setMaxThreadsForNioWrite(int count)
          Sets the maximum threads allowed for nio write.
 boolean shouldNioWriteHappen()
          Method to suggest if nio write should be sent for processing.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

clients

protected java.util.List clients

pool

protected org.apache.commons.pool.ObjectPool pool

poolConfig

protected PoolConfig poolConfig
Constructor Detail

ClientPool

public ClientPool(QSObjectPool objectPool,
                  PoolConfig poolConfig)
Method Detail

getObjectPool

public org.apache.commons.pool.ObjectPool getObjectPool()

addClient

public void addClient(java.lang.Runnable r)
               throws java.util.NoSuchElementException
Throws:
java.util.NoSuchElementException

addClient

public void addClient(java.lang.Runnable r,
                      boolean keepObjOnFail)
               throws java.util.NoSuchElementException
Throws:
java.util.NoSuchElementException

returnObject

public void returnObject(java.lang.Object object)

getClient

public java.lang.Runnable getClient()

isClientAvailable

public boolean isClientAvailable()
Since:
1.4.5

finalize

protected void finalize()
                 throws java.lang.Throwable
Throws:
java.lang.Throwable

close

public void close()
           throws java.lang.Exception
Throws:
java.lang.Exception

clear

public void clear()
           throws java.lang.Exception
Throws:
java.lang.Exception

getNumActive

public int getNumActive()
Return the number of instances currently borrowed from my pool.

Since:
1.4.1

getNumIdle

public int getNumIdle()
Return the number of instances currently idle in my pool.

Since:
1.4.1

getAllClientThread

public final java.util.Iterator getAllClientThread()
Returns iterator containing all the active threads i.e ClientHandler handling connected clients.

Since:
1.3.1

getObjectToSynchronize

public java.lang.Object getObjectToSynchronize()

getPoolConfig

public PoolConfig getPoolConfig()
Returns PoolConfig object that configured this pool

Since:
1.4.5

setMaxThreadsForNioWrite

public void setMaxThreadsForNioWrite(int count)
Sets the maximum threads allowed for nio write. If set to 0 or less no limit is imposed.

Since:
1.4.6

getMaxThreadsForNioWrite

public int getMaxThreadsForNioWrite()
Returns the maximum threads allowed for nio write

Since:
1.4.6

nioWriteEnd

protected void nioWriteEnd()
Notifies when NIO write is complete.

Since:
1.4.6

nioWriteStart

protected void nioWriteStart()
Notifies when NIO write is about to start.

Since:
1.4.6

shouldNioWriteHappen

public boolean shouldNioWriteHappen()
Method to suggest if nio write should be sent for processing.

Since:
1.4.6

QuickServer
v1.4.7

Copyright © 2003-2006 QuickServer.org