|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.mx.util.JBossNotificationBroadcasterSupport
org.jboss.system.ServiceMBeanSupport
org.jboss.invocation.pooled.server.PooledInvoker
public class PooledInvoker
This invoker pools Threads and client connections to one server socket. The purpose is to avoid a bunch of failings of RMI. 1. Avoid making a client socket connection with every invocation call. This is very expensive. Also on windows if too many clients try to connect at the same time, you get connection refused exceptions. This invoker/proxy combo alleviates this. 2. Avoid creating a thread per invocation. The client/server connection is preserved and attached to the same thread. So we have connection pooling on the server and client side, and thread pooling on the server side. Pool, is an LRU pool, so resources should be cleaned up.
| Field Summary | |
|---|---|
protected Thread[] |
acceptThreads
|
protected int |
backlog
|
protected String |
clientConnectAddress
The internet address client will use to connect to the sever. |
protected int |
clientConnectPort
The port a client will use to connect to the sever. |
protected int |
clientMaxPoolSize
|
protected LRUPool |
clientpool
|
protected int |
clientRetryCount
The number of retry attempts on |
protected SocketFactory |
clientSocketFactory
An optional custom client socket factory |
protected String |
clientSocketFactoryName
The class name of the optional custom client socket factory |
protected boolean |
enableTcpNoDelay
If the TcpNoDelay option should be used on the socket. |
protected static org.jboss.logging.Logger |
log
logger instance. |
protected int |
maxPoolSize
|
protected int |
numAcceptThreads
|
protected PooledInvokerProxy |
optimizedInvokerProxy
|
protected boolean |
running
|
protected String |
serverBindAddress
The internet address to bind to by default. |
protected int |
serverBindPort
The server port to bind to. |
protected ServerSocket |
serverSocket
The server socket for |
protected ServerSocketFactory |
serverSocketFactory
An optional custom server socket factory |
protected String |
serverSocketFactoryName
The class name of the optional custom server socket factory |
protected String |
sslDomain
The name of the security domain to use with server sockets that support SSL |
protected LinkedList |
threadpool
|
protected int |
timeout
|
protected static org.jboss.tm.TransactionPropagationContextFactory |
tpcFactory
|
protected static org.jboss.tm.TransactionPropagationContextImporter |
tpcImporter
|
protected boolean |
trace
The logging trace level flag |
protected javax.management.ObjectName |
transactionManagerService
ObjectName of the transactionManagerService we use. |
| Fields inherited from class org.jboss.system.ServiceMBeanSupport |
|---|
server, SERVICE_CONTROLLER_SIG, serviceName |
| Fields inherited from interface org.jboss.system.ServiceMBean |
|---|
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED |
| Constructor Summary | |
|---|---|
PooledInvoker()
|
|
| Method Summary | |
|---|---|
protected void |
destroyService()
|
int |
getBacklog()
|
String |
getClientConnectAddress()
|
int |
getClientConnectPort()
|
int |
getClientMaxPoolSize()
Getter for property maxPoolSize; |
int |
getClientRetryCount()
|
SocketFactory |
getClientSocketFactory()
|
String |
getClientSocketFactoryName()
Set the client socket factory implementation |
int |
getCurrentClientPoolSize()
|
int |
getCurrentThreadPoolSize()
|
int |
getMaxPoolSize()
Getter for property maxPoolSize; |
int |
getNumAcceptThreads()
Getter for property numAcceptThreads |
PooledInvokerProxy |
getOptimizedInvokerProxy()
|
String |
getServerBindAddress()
|
int |
getServerBindPort()
Getter for property serverBindPort. |
ServerSocket |
getServerSocket()
|
ServerSocketFactory |
getServerSocketFactory()
|
String |
getServerSocketFactoryName()
Set the server socket factory implementation |
int |
getSocketTimeout()
Getter for property timeout |
String |
getSslDomain()
|
javax.management.ObjectName |
getTransactionManagerService()
mbean get-set pair for field transactionManagerService Get the value of transactionManagerService |
protected Transaction |
importTPC(Object tpc)
|
Object |
invoke(Invocation invocation)
The ServerProtocol will use this method to service an invocation request. |
boolean |
isEnableTcpNoDelay()
|
protected void |
jmxBind()
|
protected void |
loadCustomSocketFactories()
Load and instantiate the clientSocketFactory, serverSocketFactory using the TCL and set the bind address and SSL domain if the serverSocketFactory supports it. |
void |
run()
|
void |
setBacklog(int backlog)
|
void |
setClientConnectAddress(String clientConnectAddress)
Set the clientConnectAddress |
void |
setClientConnectPort(int clientConnectPort)
|
void |
setClientMaxPoolSize(int clientMaxPoolSize)
Setter for property maxPoolSize. |
void |
setClientRetryCount(int clientRetryCount)
|
void |
setClientSocketFactory(SocketFactory clientSocketFactory)
|
void |
setClientSocketFactoryName(String clientSocketFactoryName)
Set the client factory implementation |
void |
setEnableTcpNoDelay(boolean enableTcpNoDelay)
Socket.setTcpNoDelay flag |
void |
setMaxPoolSize(int maxPoolSize)
Setter for property maxPoolSize. |
void |
setNumAcceptThreads(int size)
Setter for property numAcceptThreads |
void |
setServerBindAddress(String serverBindAddress)
|
void |
setServerBindPort(int serverBindPort)
Setter for property serverBindPort. |
void |
setServerSocket(ServerSocket serverSocket)
|
void |
setServerSocketFactory(ServerSocketFactory serverSocketFactory)
|
void |
setServerSocketFactoryName(String serverSocketFactoryName)
Set the server factory implementation |
void |
setSocketTimeout(int time)
Setter for property timeout |
void |
setSslDomain(String sslDomain)
|
void |
setTransactionManagerService(javax.management.ObjectName transactionManagerService)
Set the value of transactionManagerService |
void |
startService()
Starts this IL, and binds it to JNDI |
void |
stopService()
Stops this service, and unbinds it from JNDI. |
| Methods inherited from class org.jboss.system.ServiceMBeanSupport |
|---|
create, createService, destroy, getDeploymentInfo, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop |
| Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport |
|---|
addNotificationListener, getNotificationInfo, handleNotification, nextNotificationSequenceNumber, removeNotificationListener, removeNotificationListener, sendNotification |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.jboss.system.ServiceMBean |
|---|
getName, getState, getStateString, jbossInternalLifecycle |
| Methods inherited from interface org.jboss.system.Service |
|---|
create, destroy, start, stop |
| Field Detail |
|---|
protected static final org.jboss.logging.Logger log
protected boolean enableTcpNoDelay
protected String serverBindAddress
protected int serverBindPort
protected String clientConnectAddress
protected int clientConnectPort
protected int clientRetryCount
protected int backlog
protected String clientSocketFactoryName
protected String serverSocketFactoryName
protected SocketFactory clientSocketFactory
protected ServerSocketFactory serverSocketFactory
protected ServerSocket serverSocket
protected String sslDomain
protected int timeout
protected int maxPoolSize
protected int clientMaxPoolSize
protected int numAcceptThreads
protected Thread[] acceptThreads
protected LRUPool clientpool
protected LinkedList threadpool
protected boolean running
protected boolean trace
protected javax.management.ObjectName transactionManagerService
transactionManagerService we use.
Probably should not be here -- used to set txInterceptor tx mananger.
protected PooledInvokerProxy optimizedInvokerProxy
protected static org.jboss.tm.TransactionPropagationContextFactory tpcFactory
protected static org.jboss.tm.TransactionPropagationContextImporter tpcImporter
| Constructor Detail |
|---|
public PooledInvoker()
| Method Detail |
|---|
protected void jmxBind()
public void startService()
throws Exception
startService in class org.jboss.system.ServiceMBeanSupportException - Description of Exceptionpublic void run()
run in interface Runnable
public void stopService()
throws Exception
stopService in class org.jboss.system.ServiceMBeanSupportException
protected void destroyService()
throws Exception
destroyService in class org.jboss.system.ServiceMBeanSupportException
public Object invoke(Invocation invocation)
throws Exception
Exceptionprotected Transaction importTPC(Object tpc)
public int getNumAcceptThreads()
getNumAcceptThreads in interface PooledInvokerMBeanpublic void setNumAcceptThreads(int size)
setNumAcceptThreads in interface PooledInvokerMBeansize - New value of property numAcceptThreads.public int getMaxPoolSize()
getMaxPoolSize in interface PooledInvokerMBeanpublic void setMaxPoolSize(int maxPoolSize)
setMaxPoolSize in interface PooledInvokerMBeanmaxPoolSize - New value of property maxPoolSize.public int getClientMaxPoolSize()
getClientMaxPoolSize in interface PooledInvokerMBeanpublic void setClientMaxPoolSize(int clientMaxPoolSize)
setClientMaxPoolSize in interface PooledInvokerMBeanclientMaxPoolSize - New value of property serverBindPort.public int getSocketTimeout()
getSocketTimeout in interface PooledInvokerMBeanpublic void setSocketTimeout(int time)
setSocketTimeout in interface PooledInvokerMBeantime - New value of property timeoutpublic int getCurrentClientPoolSize()
getCurrentClientPoolSize in interface PooledInvokerMBeanpublic int getCurrentThreadPoolSize()
getCurrentThreadPoolSize in interface PooledInvokerMBeanpublic int getServerBindPort()
getServerBindPort in interface PooledInvokerMBeanpublic void setServerBindPort(int serverBindPort)
setServerBindPort in interface PooledInvokerMBeanserverBindPort - New value of property serverBindPort.public String getClientConnectAddress()
getClientConnectAddress in interface PooledInvokerMBeanpublic void setClientConnectAddress(String clientConnectAddress)
PooledInvokerMBean
setClientConnectAddress in interface PooledInvokerMBeanclientConnectAddress - - address the client proxy connects topublic int getClientConnectPort()
getClientConnectPort in interface PooledInvokerMBeanpublic void setClientConnectPort(int clientConnectPort)
setClientConnectPort in interface PooledInvokerMBeanclientConnectPort - - the client local bind portpublic int getClientRetryCount()
getClientRetryCount in interface PooledInvokerMBeanpublic void setClientRetryCount(int clientRetryCount)
setClientRetryCount in interface PooledInvokerMBeanclientRetryCount - - the number of connect retriespublic int getBacklog()
getBacklog in interface PooledInvokerMBeanpublic void setBacklog(int backlog)
setBacklog in interface PooledInvokerMBeanbacklog - - the server accept backlogpublic boolean isEnableTcpNoDelay()
isEnableTcpNoDelay in interface PooledInvokerMBeanpublic void setEnableTcpNoDelay(boolean enableTcpNoDelay)
PooledInvokerMBean
setEnableTcpNoDelay in interface PooledInvokerMBeanpublic String getServerBindAddress()
getServerBindAddress in interface PooledInvokerMBeanpublic void setServerBindAddress(String serverBindAddress)
setServerBindAddress in interface PooledInvokerMBeanpublic String getClientSocketFactoryName()
PooledInvokerMBean
getClientSocketFactoryName in interface PooledInvokerMBeanpublic void setClientSocketFactoryName(String clientSocketFactoryName)
PooledInvokerMBean
setClientSocketFactoryName in interface PooledInvokerMBeanclientSocketFactoryName - - the javax.net.SocketFactory implementation class namepublic String getServerSocketFactoryName()
PooledInvokerMBean
getServerSocketFactoryName in interface PooledInvokerMBeanpublic void setServerSocketFactoryName(String serverSocketFactoryName)
PooledInvokerMBean
setServerSocketFactoryName in interface PooledInvokerMBeanserverSocketFactoryName - - the javax.net.ServerSocketFactory implementation class namepublic SocketFactory getClientSocketFactory()
public void setClientSocketFactory(SocketFactory clientSocketFactory)
public ServerSocket getServerSocket()
public void setServerSocket(ServerSocket serverSocket)
public String getSslDomain()
getSslDomain in interface PooledInvokerMBeanpublic void setSslDomain(String sslDomain)
setSslDomain in interface PooledInvokerMBeanpublic ServerSocketFactory getServerSocketFactory()
getServerSocketFactory in interface PooledInvokerMBeanpublic void setServerSocketFactory(ServerSocketFactory serverSocketFactory)
setServerSocketFactory in interface PooledInvokerMBeanpublic javax.management.ObjectName getTransactionManagerService()
getTransactionManagerService in interface PooledInvokerMBeanpublic void setTransactionManagerService(javax.management.ObjectName transactionManagerService)
setTransactionManagerService in interface PooledInvokerMBeantransactionManagerService - Value to assign to transactionManagerServicepublic PooledInvokerProxy getOptimizedInvokerProxy()
getOptimizedInvokerProxy in interface PooledInvokerMBeanprotected void loadCustomSocketFactories()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||