本文整理汇总了Java中org.apache.activemq.command.SessionId类的典型用法代码示例。如果您正苦于以下问题:Java SessionId类的具体用法?Java SessionId怎么用?Java SessionId使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SessionId类属于org.apache.activemq.command包,在下文中一共展示了SessionId类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processAddProducer
import org.apache.activemq.command.SessionId; //导入依赖的package包/类
public Response processAddProducer(ProducerInfo info) {
if (info != null && info.getProducerId() != null) {
SessionId sessionId = info.getProducerId().getParentId();
if (sessionId != null) {
ConnectionId connectionId = sessionId.getParentId();
if (connectionId != null) {
ConnectionState cs = connectionStates.get(connectionId);
if (cs != null) {
SessionState ss = cs.getSessionState(sessionId);
if (ss != null) {
ss.addProducer(info);
}
}
}
}
}
return TRACKED_RESPONSE_MARKER;
}
示例2: processRemoveProducer
import org.apache.activemq.command.SessionId; //导入依赖的package包/类
public Response processRemoveProducer(ProducerId id) {
if (id != null) {
SessionId sessionId = id.getParentId();
if (sessionId != null) {
ConnectionId connectionId = sessionId.getParentId();
if (connectionId != null) {
ConnectionState cs = connectionStates.get(connectionId);
if (cs != null) {
SessionState ss = cs.getSessionState(sessionId);
if (ss != null) {
ss.removeProducer(id);
}
}
}
}
}
return TRACKED_RESPONSE_MARKER;
}
示例3: processAddConsumer
import org.apache.activemq.command.SessionId; //导入依赖的package包/类
public Response processAddConsumer(ConsumerInfo info) {
if (info != null) {
SessionId sessionId = info.getConsumerId().getParentId();
if (sessionId != null) {
ConnectionId connectionId = sessionId.getParentId();
if (connectionId != null) {
ConnectionState cs = connectionStates.get(connectionId);
if (cs != null) {
SessionState ss = cs.getSessionState(sessionId);
if (ss != null) {
ss.addConsumer(info);
}
}
}
}
}
return TRACKED_RESPONSE_MARKER;
}
示例4: processRemoveConsumer
import org.apache.activemq.command.SessionId; //导入依赖的package包/类
public Response processRemoveConsumer(ConsumerId id, long lastDeliveredSequenceId) {
if (id != null) {
SessionId sessionId = id.getParentId();
if (sessionId != null) {
ConnectionId connectionId = sessionId.getParentId();
if (connectionId != null) {
ConnectionState cs = connectionStates.get(connectionId);
if (cs != null) {
SessionState ss = cs.getSessionState(sessionId);
if (ss != null) {
ss.removeConsumer(id);
}
cs.getRecoveringPullConsumers().remove(id);
}
}
}
}
return TRACKED_RESPONSE_MARKER;
}
示例5: ActiveMQSession
import org.apache.activemq.command.SessionId; //导入依赖的package包/类
/**
* Construct the Session
*
* @param connection
* @param sessionId
* @param acknowledgeMode n.b if transacted - the acknowledgeMode ==
* Session.SESSION_TRANSACTED
* @param asyncDispatch
* @param sessionAsyncDispatch
* @throws JMSException on internal error
*/
protected ActiveMQSession(ActiveMQConnection connection, SessionId sessionId, int acknowledgeMode, boolean asyncDispatch, boolean sessionAsyncDispatch) throws JMSException {
this.debug = LOG.isDebugEnabled();
this.connection = connection;
this.acknowledgementMode = acknowledgeMode;
this.asyncDispatch = asyncDispatch;
this.sessionAsyncDispatch = sessionAsyncDispatch;
this.info = new SessionInfo(connection.getConnectionInfo(), sessionId.getValue());
setTransactionContext(new TransactionContext(connection));
stats = new JMSSessionStatsImpl(producers, consumers);
this.connection.asyncSendPacket(info);
setTransformer(connection.getTransformer());
setBlobTransferPolicy(connection.getBlobTransferPolicy());
this.connectionExecutor=connection.getExecutor();
this.executor = new ActiveMQSessionExecutor(this);
connection.addSession(this);
if (connection.isStarted()) {
start();
}
}
示例6: ensureConnectionInfoSent
import org.apache.activemq.command.SessionId; //导入依赖的package包/类
/**
* Send the ConnectionInfo to the Broker
*
* @throws JMSException
*/
protected void ensureConnectionInfoSent() throws JMSException {
synchronized(this.ensureConnectionInfoSentMutex) {
// Can we skip sending the ConnectionInfo packet??
if (isConnectionInfoSentToBroker || closed.get()) {
return;
}
//TODO shouldn't this check be on userSpecifiedClientID rather than the value of clientID?
if (info.getClientId() == null || info.getClientId().trim().length() == 0) {
info.setClientId(clientIdGenerator.generateId());
}
syncSendPacket(info.copy());
this.isConnectionInfoSentToBroker = true;
// Add a temp destination advisory consumer so that
// We know what the valid temporary destinations are on the
// broker without having to do an RPC to the broker.
ConsumerId consumerId = new ConsumerId(new SessionId(info.getConnectionId(), -1), consumerIdGenerator.getNextSequenceId());
if (watchTopicAdvisories) {
advisoryConsumer = new AdvisoryConsumer(this, consumerId);
}
}
}
示例7: testConcurrentConnection
import org.apache.activemq.command.SessionId; //导入依赖的package包/类
public void testConcurrentConnection() throws Exception {
StubConnection connection1 = createConnection();
StubConnection connection2 = createConnection();
// reuse same connection info
ConnectionInfo connectionInfo = createConnectionInfo();
connection1.request(connectionInfo);
connection2.request(connectionInfo);
// second one should win out, verify using consumer on default session (watchAdvisories)
ConsumerId consumerId = new ConsumerId(new SessionId(connectionInfo.getConnectionId(), -1), 1);
ConsumerInfo consumerInfo = new ConsumerInfo(consumerId);
consumerInfo.setDestination(AdvisorySupport.TEMP_DESTINATION_COMPOSITE_ADVISORY_TOPIC);
connection2.request(consumerInfo);
}
示例8: processRemoveSession
import org.apache.activemq.command.SessionId; //导入依赖的package包/类
@Override
public Response processRemoveSession(SessionId id, long lastDeliveredSequenceId) throws Exception {
SessionState session = state.getSessionState(id);
if (session == null) {
throw new IllegalStateException("Cannot remove session that had not been registered: " + id);
}
// Don't let new consumers or producers get added while we are closing
// this down.
session.shutdown();
// Cascade the connection stop producers.
// we don't stop consumer because in core
// closing the session will do the job
for (ProducerId producerId : session.getProducerIds()) {
try {
processRemoveProducer(producerId);
} catch (Throwable e) {
// LOG.warn("Failed to remove producer: {}", producerId, e);
}
}
state.removeSession(id);
removeSession(context, session.getInfo());
return null;
}
示例9: processRemoveConsumer
import org.apache.activemq.command.SessionId; //导入依赖的package包/类
@Override
public Response processRemoveConsumer(ConsumerId id, long lastDeliveredSequenceId) throws Exception {
if (destroyed) {
return null;
}
SessionId sessionId = id.getParentId();
SessionState ss = state.getSessionState(sessionId);
if (ss == null) {
throw new IllegalStateException("Cannot remove a consumer from a session that had not been registered: " + sessionId);
}
ConsumerState consumerState = ss.removeConsumer(id);
if (consumerState == null) {
throw new IllegalStateException("Cannot remove a consumer that had not been registered: " + id);
}
ConsumerInfo info = consumerState.getInfo();
info.setLastDeliveredSequenceId(lastDeliveredSequenceId);
AMQConsumerBrokerExchange consumerBrokerExchange = consumerExchanges.remove(id);
consumerBrokerExchange.removeConsumer();
return null;
}
示例10: processRemoveSession
import org.apache.activemq.command.SessionId; //导入依赖的package包/类
public Response processRemoveSession(SessionId id, long lastDeliveredSequenceId) {
if (id != null) {
ConnectionId connectionId = id.getParentId();
if (connectionId != null) {
ConnectionState cs = connectionStates.get(connectionId);
if (cs != null) {
cs.removeSession(id);
}
}
}
return TRACKED_RESPONSE_MARKER;
}
示例11: lookupConnectionState
import org.apache.activemq.command.SessionId; //导入依赖的package包/类
public TransportConnectionState lookupConnectionState(SessionId id) {
TransportConnectionState cs = lookupConnectionState(id.getConnectionId());
if (cs == null) {
throw new IllegalStateException(
"Cannot lookup a session from a connection that had not been registered: "
+ id.getParentId());
}
return cs;
}
示例12: lookupConnectionState
import org.apache.activemq.command.SessionId; //导入依赖的package包/类
public synchronized TransportConnectionState lookupConnectionState(SessionId id) {
TransportConnectionState cs = connectionState;
if (cs == null) {
throw new IllegalStateException(
"Cannot lookup a session from a connection that had not been registered: "
+ id.getParentId());
}
return cs;
}
示例13: tightUnmarshal
import org.apache.activemq.command.SessionId; //导入依赖的package包/类
/**
* Un-marshal an object instance from the data input stream
*
* @param o the object to un-marshal
* @param dataIn the data input stream to build the object from
* @throws IOException
*/
public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs)
throws IOException {
super.tightUnmarshal(wireFormat, o, dataIn, bs);
SessionId info = (SessionId)o;
info.setConnectionId(tightUnmarshalString(dataIn, bs));
info.setValue(tightUnmarshalLong(wireFormat, dataIn, bs));
}
示例14: tightMarshal1
import org.apache.activemq.command.SessionId; //导入依赖的package包/类
/**
* Write the booleans that this object uses to a BooleanStream
*/
public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
SessionId info = (SessionId)o;
int rc = super.tightMarshal1(wireFormat, o, bs);
rc += tightMarshalString1(info.getConnectionId(), bs);
rc += tightMarshalLong1(wireFormat, info.getValue(), bs);
return rc + 0;
}
示例15: tightMarshal2
import org.apache.activemq.command.SessionId; //导入依赖的package包/类
/**
* Write a object instance to data output stream
*
* @param o the instance to be marshaled
* @param dataOut the output stream
* @throws IOException thrown if an error occurs
*/
public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs)
throws IOException {
super.tightMarshal2(wireFormat, o, dataOut, bs);
SessionId info = (SessionId)o;
tightMarshalString2(info.getConnectionId(), dataOut, bs);
tightMarshalLong2(wireFormat, info.getValue(), dataOut, bs);
}