C# 클래스 Spring.Messaging.Nms.Connections.CachingConnectionFactory

SingleConnectionFactory subclass that adds Session, MessageProducer, and MessageConsumer caching. This ConnectionFactory also switches the ReconnectOnException property to true by default, allowing for automatic recovery of the underlying Connection.
By default, only one single Session will be cached, with further requested Sessions being created and disposed on demand. Consider raising the SessionCacheSize property in case of a high-concurrency environment.

NOTE: This ConnectionFactory requires explicit closing of all Sessions obtained from its shared Connection. This is the usual recommendation for native NMS access code anyway. However, with this ConnectionFactory, its use is mandatory in order to actually allow for Session reuse.

Note also that MessageConsumers obtained from a cached Session won't get closed until the Session will eventually be removed from the pool. This may lead to semantic side effects in some cases. For a durable subscriber, the logical Session.Close() call will also close the subscription. Re-registering a durable consumer for the same subscription on the same Session handle is not supported; close and reobtain a cached Session first.

상속: Spring.Messaging.Nms.Connections.SingleConnectionFactory
파일 보기 프로젝트 열기: spring-projects/spring-net 1 사용 예제들

공개 메소드들

메소드 설명
CachingConnectionFactory ( ) : System

Initializes a new instance of the CachingConnectionFactory class. and sets the ReconnectOnException to true

CachingConnectionFactory ( IConnectionFactory targetConnectionFactory ) : System

Initializes a new instance of the CachingConnectionFactory class for the given IConnectionFactory

GetSession ( IConnection con, AcknowledgementMode mode ) : ISession

Obtaining a cached Session.

ResetConnection ( ) : void

Resets the Session cache as well as resetting the connection.

보호된 메소드들

메소드 설명
GetCachedSessionWrapper ( ISession targetSession, Spring.Collections.LinkedList sessionList ) : ISession

Wraps the given Session so that it delegates every method call to the target session but adapts close calls. This is useful for allowing application code to handle a special framework Session just like an ordinary Session.

메소드 상세

CachingConnectionFactory() 공개 메소드

Initializes a new instance of the CachingConnectionFactory class. and sets the ReconnectOnException to true
public CachingConnectionFactory ( ) : System
리턴 System

CachingConnectionFactory() 공개 메소드

Initializes a new instance of the CachingConnectionFactory class for the given IConnectionFactory
public CachingConnectionFactory ( IConnectionFactory targetConnectionFactory ) : System
targetConnectionFactory IConnectionFactory The target connection factory.
리턴 System

GetCachedSessionWrapper() 보호된 메소드

Wraps the given Session so that it delegates every method call to the target session but adapts close calls. This is useful for allowing application code to handle a special framework Session just like an ordinary Session.
protected GetCachedSessionWrapper ( ISession targetSession, Spring.Collections.LinkedList sessionList ) : ISession
targetSession ISession The original Session to wrap.
sessionList Spring.Collections.LinkedList The List of cached Sessions that the given Session belongs to.
리턴 ISession

GetSession() 공개 메소드

Obtaining a cached Session.
public GetSession ( IConnection con, AcknowledgementMode mode ) : ISession
con IConnection The connection to operate on.
mode AcknowledgementMode The session ack mode.
리턴 ISession

ResetConnection() 공개 메소드

Resets the Session cache as well as resetting the connection.
public ResetConnection ( ) : void
리턴 void