📄 ipcjmssessionconnection.java
字号:
return pack(Boolean.FALSE, exception);
}
if (persistent) {
return pack(Boolean.TRUE, null);
}
// non-persistent messages do not need to send back anything.
return null;
}
/**
* A collection of messages have been sent
*
* @param session - the session the request is for.
* @param messages - the messages to process.
* @return Vector - the result of the request.
*
*/
protected Vector sendMessages(JmsServerSession session, Vector messages) {
try {
session.sendMessages(messages);
} catch (JMSException exception) {
return pack(Boolean.FALSE, exception);
}
return pack(Boolean.TRUE, null);
}
/**
* Receive a message from the provider
*
* @param session The session the request is for.
* @param clientId The client identity
* @param wait How long to wait
* @return Vector The result of the request.
*
*/
protected Vector receiveMessage(JmsServerSession session, Long clientId,
Long wait) {
Message message = null;
try {
message = session.receiveMessage(clientId.longValue(),
wait.longValue());
} catch (JMSException exception) {
return pack(Boolean.FALSE, exception);
}
return pack(Boolean.TRUE, message);
}
/**
* Receive upto count messages from the endpoint
*
* @param session - the session the request is for.
* @param clientId - the client identity
* @param count - max number of messages to receive
* @return Vector - the result of the request.
*
*/
protected Vector receiveMessages(JmsServerSession session, Long clientId,
Integer count) {
Vector messages = null;
try {
messages = session.receiveMessages(clientId.longValue(),
count.intValue());
} catch (JMSException exception) {
return pack(Boolean.FALSE, exception);
}
return pack(Boolean.TRUE, messages);
}
/**
* Create a new Queue.
*
* @param session The session the request is for.
* @param queue The queue to create
* @return Vector The result of the request.
*
*/
protected Vector createQueue(JmsServerSession session, JmsQueue queue) {
try {
session.createQueue(queue);
} catch (JMSException exception) {
return pack(Boolean.FALSE, exception);
}
return pack(Boolean.TRUE, null);
}
/**
* Create a new topic
*
* @param session The session the request is for.
* @param topic The topic to create
* @return Vector The result of the request.
*
*/
protected Vector createTopic(JmsServerSession session, JmsTopic topic) {
try {
session.createTopic(topic);
} catch (JMSException exception) {
return pack(Boolean.FALSE, exception);
}
return pack(Boolean.TRUE, null);
}
/**
* Create a new receiver
*
* @param session The session the request is for.
* @param queue The queue to create the reciver for
* @param consumerName The unique name of this consumer,
* only valid for persitent messages
* @param selector The selector to filter messages. This may be null.
* @param connection The MultiplexConnection to the machine the consumer is on
* @param host The host the client is running on. Only used for http.
* @param port The port the client is listening on. Only used for http
* @param url The url for the clients web server. Only used for http
* @return Vector The result of the request.
*
*/
protected Vector createReceiver(
JmsServerSession session, JmsQueue queue,
Long consumerId, String selector, MultiplexConnectionIfc connection,
String host, String port, String url) {
try {
session.createReceiver(queue, consumerId.longValue(), selector);
_server.addConnection(session, connection);
} catch (Exception exception) {
return pack(Boolean.FALSE, exception);
}
return pack(Boolean.TRUE, null);
}
/**
* Create a new sender for the given queue.
*
* @param session The session the request is for.
* @param queue The queue the sender is sending to
* @return Vector The result of the request.
*
*/
protected Vector createSender(JmsServerSession session, JmsQueue queue) {
try {
session.createSender(queue);
} catch (JMSException exception) {
return pack(Boolean.FALSE, exception);
}
return pack(Boolean.TRUE, null);
}
/**
* Create a new queue browser for the specified session and queue.
*
* @param session session that the request is for
* @param queue queue to browse
* @param clientId the client identity
* @param selector message selector. May be null
* @param connection the connection to the remote machine
* @param host The host the client is running on. Only used for http.
* @param port The port the client is listening on. Only used for http
* @param url The url for the clients web server. Only used for http
* @return Vector result of the request
*
*/
protected Vector createBrowser(JmsServerSession session,
JmsQueue queue, Long clientId,
String selector,
MultiplexConnectionIfc connection,
String host, String port,
String url) {
try {
session.createBrowser(queue, clientId.longValue(), selector);
_server.addConnection(session, connection);
} catch (Exception exception) {
return pack(Boolean.FALSE, exception);
}
return pack(Boolean.TRUE, null);
}
/**
* Delete the receiver for this queue.
*
* @param session - the session the request is for.
* @param clientId - the client id
* @return Vector The result of the request.
*
*/
protected Vector deleteReceiver(JmsServerSession session, Long clientId) {
try {
session.deleteReceiver(clientId.longValue());
} catch (JMSException exception) {
return pack(Boolean.FALSE, exception);
}
return pack(Boolean.TRUE, null);
}
/**
* Delete the sender for this queue.
*
* @param session The session the request is for.
* @param clientId The identity of the client
* @return Vector The result of the request.
*/
protected Vector deleteSender(JmsServerSession session, Long clientId) {
try {
session.deleteSender(clientId.longValue());
} catch (JMSException exception) {
return pack(Boolean.FALSE, exception);
}
return pack(Boolean.TRUE, null);
}
/**
* Delete the queue browser for the specified queue.
*
* @param session session that the request is for
* @param clientId the identity of the browser
* @return Vector The result of the request.
*/
protected Vector deleteBrowser(JmsServerSession session, Long clientId) {
try {
session.deleteBrowser(clientId.longValue());
} catch (JMSException exception) {
return pack(Boolean.FALSE, exception);
}
return pack(Boolean.TRUE, null);
}
/**
* Create a new subscriber, and connect back to the client through the
* MultiplexConnection.
*
* @param session The session the request is for.
* @param topic The topic the subscriber is subscribing on
* @param name The unique name of this subscriber,
* only valid for persitent messages
* @param selector The selector to filter messages. This may be null.
* @param connection The MultiplexConnection to the machine the consumer is on
* @param host The host the client is running on. Only used for http.
* @param port The port the client is listening on. Only used for http
* @param url The url for the clients web server. Only used for http
* @return Vector The result of the request.
*/
protected Vector createSubscriber(
JmsServerSession session, JmsTopic topic, String name, Long clientId,
String selector, Boolean noLocal, MultiplexConnectionIfc connection,
String host, String port, String url) {
try {
session.createSubscriber(topic, name, clientId.longValue(),
selector, noLocal.booleanValue());
_server.addConnection(session, connection);
} catch (Exception exception) {
return pack(Boolean.FALSE, exception);
}
return pack(Boolean.TRUE, null);
}
/**
* Create a new publisher for the given topic.
*
* @param session The session the request is for.
* @param topic The topic the publisher is publishing to
* @return Vector The result of the request.
*/
protected Vector createPublisher(JmsServerSession session,
JmsTopic topic) {
try {
session.createPublisher(topic);
} catch (JMSException exception) {
return pack(Boolean.FALSE, exception);
}
return pack(Boolean.TRUE, null);
}
/**
* Delete a subscriber for the given topic
*
* @param session The session the request is for.
* @param clientId - The client identity of the subscriber to delete
* @return Vector The result of the request.
*/
protected Vector deleteSubscriber(JmsServerSession session,
Long clientId) {
try {
session.deleteSubscriber(clientId.longValue());
} catch (JMSException exception) {
return pack(Boolean.FALSE, exception);
}
return pack(Boolean.TRUE, null);
}
/**
* Delete a publisher for the given topic.
*
* @param session The session the request is for.
* @param topic The topic the publisher is publishing to
* @return Vector The result of the request.
*
*/
protected Vector deletePublisher(JmsServerSession session,
JmsTopic topic) {
try {
session.deletePublisher(topic);
} catch (JMSException exception) {
return pack(Boolean.FALSE, exception);
}
return pack(Boolean.TRUE, null);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -