站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 server API Documentation 英文版文档

PooledInvoker (JBoss Server API) - JBoss 4.0.1 sp1 server API Documentation 英文版文档


org.jboss.invocation.pooled.server
Class PooledInvoker

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended byorg.jboss.system.ServiceMBeanSupport
          extended byorg.jboss.invocation.pooled.server.PooledInvoker
All Implemented Interfaces:
javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, PooledInvokerMBean, Runnable, org.jboss.system.Service, org.jboss.system.ServiceMBean

public class PooledInvoker
extends org.jboss.system.ServiceMBeanSupport
implements PooledInvokerMBean, Runnable

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.

Version:
$Revision: 1.10.2.1 $
Author:
Bill Burke

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  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
           
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 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.
 int getSocketTimeout()
          Getter for property timeout
 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()
           
 void run()
           
 void setBacklog(int backlog)
           
 void setClientConnectAddress(String clientConnectAddress)
           
 void setClientConnectPort(int clientConnectPort)
           
 void setClientMaxPoolSize(int clientMaxPoolSize)
          Setter for property maxPoolSize.
 void setEnableTcpNoDelay(boolean enableTcpNoDelay)
           
 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 setSocketTimeout(int time)
          Setter for property timeout
 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, 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, 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

log

protected static final org.jboss.logging.Logger log
logger instance.


enableTcpNoDelay

protected boolean enableTcpNoDelay
If the TcpNoDelay option should be used on the socket.


serverBindAddress

protected String serverBindAddress
The internet address to bind to by default.


serverBindPort

protected int serverBindPort
The server port to bind to.


clientConnectAddress

protected String clientConnectAddress
The internet address client will use to connect to the sever.


clientConnectPort

protected int clientConnectPort
The port a client will use to connect to the sever.


backlog

protected int backlog

serverSocket

protected ServerSocket serverSocket

timeout

protected int timeout

maxPoolSize

protected int maxPoolSize

clientMaxPoolSize

protected int clientMaxPoolSize

numAcceptThreads

protected int numAcceptThreads

acceptThreads

protected Thread[] acceptThreads

clientpool

protected LRUPool clientpool

threadpool

protected LinkedList threadpool

running

protected boolean running

trace

protected boolean trace
The logging trace level flag


transactionManagerService

protected javax.management.ObjectName transactionManagerService
ObjectName of the transactionManagerService we use. Probably should not be here -- used to set txInterceptor tx mananger.


optimizedInvokerProxy

protected PooledInvokerProxy optimizedInvokerProxy

tpcFactory

protected static org.jboss.tm.TransactionPropagationContextFactory tpcFactory

tpcImporter

protected static org.jboss.tm.TransactionPropagationContextImporter tpcImporter
Constructor Detail

PooledInvoker

public PooledInvoker()
Method Detail

jmxBind

protected void jmxBind()

startService

public void startService()
                  throws Exception
Starts this IL, and binds it to JNDI

Throws:
Exception - Description of Exception

run

public void run()
Specified by:
run in interface Runnable

stopService

public void stopService()
                 throws Exception
Stops this service, and unbinds it from JNDI.

Throws:
Exception

destroyService

protected void destroyService()
                       throws Exception
Throws:
Exception

invoke

public Object invoke(Invocation invocation)
              throws Exception
The ServerProtocol will use this method to service an invocation request.

Throws:
Exception

importTPC

protected Transaction importTPC(Object tpc)

getNumAcceptThreads

public int getNumAcceptThreads()
Getter for property numAcceptThreads

Specified by:
getNumAcceptThreads in interface PooledInvokerMBean
Returns:
Value of property numAcceptThreads

setNumAcceptThreads

public void setNumAcceptThreads(int size)
Setter for property numAcceptThreads

Specified by:
setNumAcceptThreads in interface PooledInvokerMBean
Parameters:
size - New value of property numAcceptThreads.

getMaxPoolSize

public int getMaxPoolSize()
Getter for property maxPoolSize;

Specified by:
getMaxPoolSize in interface PooledInvokerMBean
Returns:
Value of property maxPoolSize.

setMaxPoolSize

public void setMaxPoolSize(int maxPoolSize)
Setter for property maxPoolSize.

Specified by:
setMaxPoolSize in interface PooledInvokerMBean
Parameters:
maxPoolSize - New value of property serverBindPort.

getClientMaxPoolSize

public int getClientMaxPoolSize()
Getter for property maxPoolSize;

Specified by:
getClientMaxPoolSize in interface PooledInvokerMBean
Returns:
Value of property maxPoolSize.

setClientMaxPoolSize

public void setClientMaxPoolSize(int clientMaxPoolSize)
Setter for property maxPoolSize.

Specified by:
setClientMaxPoolSize in interface PooledInvokerMBean
Parameters:
clientMaxPoolSize - New value of property serverBindPort.

getSocketTimeout

public int getSocketTimeout()
Getter for property timeout

Specified by:
getSocketTimeout in interface PooledInvokerMBean
Returns:
Value of property timeout

setSocketTimeout

public void setSocketTimeout(int time)
Setter for property timeout

Specified by:
setSocketTimeout in interface PooledInvokerMBean
Parameters:
time - New value of property timeout

getCurrentClientPoolSize

public int getCurrentClientPoolSize()
Specified by:
getCurrentClientPoolSize in interface PooledInvokerMBean
Returns:
Value of property serverBindPort.

getCurrentThreadPoolSize

public int getCurrentThreadPoolSize()
Specified by:
getCurrentThreadPoolSize in interface PooledInvokerMBean
Returns:
Value of property serverBindPort.

getServerBindPort

public int getServerBindPort()
Getter for property serverBindPort.

Specified by:
getServerBindPort in interface PooledInvokerMBean
Returns:
Value of property serverBindPort.

setServerBindPort

public void setServerBindPort(int serverBindPort)
Setter for property serverBindPort.

Specified by:
setServerBindPort in interface PooledInvokerMBean
Parameters:
serverBindPort - New value of property serverBindPort.

getClientConnectAddress

public String getClientConnectAddress()
Specified by:
getClientConnectAddress in interface PooledInvokerMBean

setClientConnectAddress

public void setClientConnectAddress(String clientConnectAddress)
Specified by:
setClientConnectAddress in interface PooledInvokerMBean

getClientConnectPort

public int getClientConnectPort()
Specified by:
getClientConnectPort in interface PooledInvokerMBean

setClientConnectPort

public void setClientConnectPort(int clientConnectPort)
Specified by:
setClientConnectPort in interface PooledInvokerMBean

getBacklog

public int getBacklog()
Specified by:
getBacklog in interface PooledInvokerMBean

setBacklog

public void setBacklog(int backlog)
Specified by:
setBacklog in interface PooledInvokerMBean

isEnableTcpNoDelay

public boolean isEnableTcpNoDelay()
Specified by:
isEnableTcpNoDelay in interface PooledInvokerMBean

setEnableTcpNoDelay

public void setEnableTcpNoDelay(boolean enableTcpNoDelay)
Specified by:
setEnableTcpNoDelay in interface PooledInvokerMBean

getServerBindAddress

public String getServerBindAddress()
Specified by:
getServerBindAddress in interface PooledInvokerMBean

setServerBindAddress

public void setServerBindAddress(String serverBindAddress)
Specified by:
setServerBindAddress in interface PooledInvokerMBean

getTransactionManagerService

public javax.management.ObjectName getTransactionManagerService()
mbean get-set pair for field transactionManagerService Get the value of transactionManagerService

Specified by:
getTransactionManagerService in interface PooledInvokerMBean
Returns:
value of transactionManagerService

setTransactionManagerService

public void setTransactionManagerService(javax.management.ObjectName transactionManagerService)
Set the value of transactionManagerService

Specified by:
setTransactionManagerService in interface PooledInvokerMBean
Parameters:
transactionManagerService - Value to assign to transactionManagerService

getOptimizedInvokerProxy

public PooledInvokerProxy getOptimizedInvokerProxy()
Specified by:
getOptimizedInvokerProxy in interface PooledInvokerMBean


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.