org.eclipse.jetty.websocket
类 WebSocketClientFactory

java.lang.Object
  继承者 org.eclipse.jetty.util.component.AbstractLifeCycle
      继承者 org.eclipse.jetty.util.component.AggregateLifeCycle
          继承者 org.eclipse.jetty.websocket.WebSocketClientFactory
所有已实现的接口:
Destroyable, Dumpable, LifeCycle

public class WebSocketClientFactory
extends AggregateLifeCycle

WebSocketClientFactory contains the common components needed by multiple WebSocketClient instances (for example, a ThreadPool, a NIO selector, etc).

WebSocketClients with different configurations should share the same factory to avoid to waste resources.

If a ThreadPool or MaskGen is passed in the constructor, then it is not added with AggregateLifeCycle.addBean(Object), so it's lifecycle must be controlled externally.

另请参见:
WebSocketClient

嵌套类摘要
 
从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的嵌套类/接口
AbstractLifeCycle.AbstractLifeCycleListener
 
从接口 org.eclipse.jetty.util.component.LifeCycle 继承的嵌套类/接口
LifeCycle.Listener
 
字段摘要
 
从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的字段
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
 
构造方法摘要
WebSocketClientFactory()
          Creates a WebSocketClientFactory with the default configuration.
WebSocketClientFactory(ThreadPool threadPool)
          Creates a WebSocketClientFactory with the given ThreadPool and the default configuration.
WebSocketClientFactory(ThreadPool threadPool, MaskGen maskGen)
          Creates a WebSocketClientFactory with the given ThreadPool and the given MaskGen.
WebSocketClientFactory(ThreadPool threadPool, MaskGen maskGen, int bufferSize)
          Creates a WebSocketClientFactory with the specified configuration.
 
方法摘要
protected  boolean addConnection(WebSocketConnection connection)
           
protected  void closeConnections()
           
protected  void doStop()
          Stop the joined lifecycle beans in the reverse order they were added.
 int getBufferSize()
           
 MaskGen getMaskGen()
           
 SelectorManager getSelectorManager()
          Get the selectorManager.
 SslContextFactory getSslContextFactory()
           
 ThreadPool getThreadPool()
          Get the ThreadPool.
protected  SSLEngine newSslEngine(SocketChannel channel)
           
 WebSocketClient newWebSocketClient()
          Creates and returns a new instance of a WebSocketClient, configured with this WebSocketClientFactory instance.
protected  boolean removeConnection(WebSocketConnection connection)
           
 void setBufferSize(int bufferSize)
           
 void setMaskGen(MaskGen maskGen)
           
 
从类 org.eclipse.jetty.util.component.AggregateLifeCycle 继承的方法
addBean, addBean, contains, destroy, doStart, dump, dump, dump, dump, dump, dumpObject, dumpStdErr, dumpThis, getBean, getBeans, getBeans, isManaged, manage, removeBean, removeBeans, unmanage
 
从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的方法
addLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

WebSocketClientFactory

public WebSocketClientFactory()

Creates a WebSocketClientFactory with the default configuration.


WebSocketClientFactory

public WebSocketClientFactory(ThreadPool threadPool)

Creates a WebSocketClientFactory with the given ThreadPool and the default configuration.

参数:
threadPool - the ThreadPool instance to use

WebSocketClientFactory

public WebSocketClientFactory(ThreadPool threadPool,
                              MaskGen maskGen)

Creates a WebSocketClientFactory with the given ThreadPool and the given MaskGen.

参数:
threadPool - the ThreadPool instance to use
maskGen - the MaskGen instance to use

WebSocketClientFactory

public WebSocketClientFactory(ThreadPool threadPool,
                              MaskGen maskGen,
                              int bufferSize)

Creates a WebSocketClientFactory with the specified configuration.

参数:
threadPool - the ThreadPool instance to use
maskGen - the mask generator to use
bufferSize - the read buffer size
方法详细信息

getSslContextFactory

public SslContextFactory getSslContextFactory()
返回:
the SslContextFactory used to configure SSL parameters

getSelectorManager

public SelectorManager getSelectorManager()
Get the selectorManager. Used to configure the manager.

返回:
The SelectorManager instance.

getThreadPool

public ThreadPool getThreadPool()
Get the ThreadPool. Used to set/query the thread pool configuration.

返回:
The ThreadPool

getMaskGen

public MaskGen getMaskGen()
返回:
the shared mask generator, or null if no shared mask generator is used
另请参见:
WebSocketClient.getMaskGen()

setMaskGen

public void setMaskGen(MaskGen maskGen)
参数:
maskGen - the shared mask generator, or null if no shared mask generator is used
另请参见:
WebSocketClient.setMaskGen(MaskGen)

setBufferSize

public void setBufferSize(int bufferSize)
参数:
bufferSize - the read buffer size
另请参见:
getBufferSize()

getBufferSize

public int getBufferSize()
返回:
the read buffer size

doStop

protected void doStop()
               throws Exception
从类 AggregateLifeCycle 复制的描述
Stop the joined lifecycle beans in the reverse order they were added.

覆盖:
AggregateLifeCycle 中的 doStop
抛出:
Exception
另请参见:
AbstractLifeCycle.doStart()

newWebSocketClient

public WebSocketClient newWebSocketClient()

Creates and returns a new instance of a WebSocketClient, configured with this WebSocketClientFactory instance.

返回:
a new WebSocketClient instance

newSslEngine

protected SSLEngine newSslEngine(SocketChannel channel)
                          throws IOException
抛出:
IOException

addConnection

protected boolean addConnection(WebSocketConnection connection)

removeConnection

protected boolean removeConnection(WebSocketConnection connection)

closeConnections

protected void closeConnections()


Copyright © 2013. All Rights Reserved.