1 45 package org.exolab.jms.server.net; 46 47 import java.rmi.RemoteException ; 48 import java.util.List ; 49 import javax.jms.JMSException ; 50 import javax.transaction.xa.XAException ; 51 import javax.transaction.xa.Xid ; 52 53 import org.exolab.jms.client.JmsDestination; 54 import org.exolab.jms.client.JmsMessageListener; 55 import org.exolab.jms.client.JmsQueue; 56 import org.exolab.jms.client.JmsTopic; 57 import org.exolab.jms.message.MessageImpl; 58 import org.exolab.jms.net.orb.ORB; 59 import org.exolab.jms.net.orb.UnicastObject; 60 import org.exolab.jms.server.ServerSession; 61 62 63 70 public class RemoteServerSession 71 extends UnicastObject 72 implements ServerSession { 73 74 77 private RemoteServerConnection _connection; 78 79 82 private ServerSession _session; 83 84 85 93 public RemoteServerSession(ORB orb, RemoteServerConnection connection, 94 ServerSession session) 95 throws RemoteException { 96 super(orb, null, true); 97 if (connection == null) { 98 throw new IllegalArgumentException ("Argument 'connection' is null"); 99 } 100 if (session == null) { 101 throw new IllegalArgumentException ("Argument 'session' is null"); 102 } 103 _connection = connection; 104 _session = session; 105 } 106 107 112 public synchronized void close() throws JMSException { 113 if (_session != null) { 114 try { 115 _session.close(); 116 } finally { 117 try { 118 unexportObject(); 119 } catch (RemoteException exception) { 120 JMSException error = new JMSException ( 121 exception.getMessage()); 122 error.setLinkedException(exception); 123 throw error; 124 } finally { 125 _connection.closed(this); 126 _connection = null; 127 _session = null; 128 } 129 } 130 } 131 } 132 133 140 public void acknowledgeMessage(long consumerId, String messageId) 141 throws JMSException { 142 _session.acknowledgeMessage(consumerId, messageId); 143 } 144 145 151 public void send(MessageImpl message) throws JMSException { 152 _session.send(message); 153 } 154 155 161 public void send(List messages) throws JMSException { 162 _session.send(messages); 163 } 164 165 178 public MessageImpl receive(long consumerId, long wait) 179 throws JMSException { 180 return _session.receive(consumerId, wait); 181 } 182 183 191 public List browse(long consumerId, int count) throws JMSException { 192 return _session.browse(consumerId, count); 193 } 194 195 207 public long createConsumer(JmsDestination destination, String selector, 208 boolean noLocal) throws JMSException { 209 return _session.createConsumer(destination, selector, noLocal); 210 } 211 212 227 public long createDurableConsumer(JmsTopic topic, String name, 228 String selector, boolean noLocal) 229 throws JMSException { 230 return _session.createDurableConsumer(topic, name, selector, noLocal); 231 } 232 233 242 public long createBrowser(JmsQueue queue, String selector) 243 throws JMSException { 244 return _session.createBrowser(queue, selector); 245 } 246 247 253 public void removeConsumer(long consumerId) throws JMSException { 254 _session.removeConsumer(consumerId); 255 } 256 257 263 public void unsubscribe(String name) throws JMSException { 264 _session.unsubscribe(name); 265 } 266 267 272 public void start() throws JMSException { 273 _session.start(); 274 } 275 276 281 public void stop() throws JMSException { 282 _session.stop(); 283 } 284 285 292 public void setMessageListener(JmsMessageListener listener) { 293 _session.setMessageListener(listener); 294 } 295 296 304 public void enableAsynchronousDelivery(long consumerId, boolean enable) 305 throws JMSException { 306 _session.enableAsynchronousDelivery(consumerId, enable); 307 } 308 309 315 public void recover() throws JMSException { 316 _session.recover(); 317 } 318 319 325 public void commit() throws JMSException { 326 _session.commit(); 327 } 328 329 335 public void rollback() throws JMSException { 336 _session.rollback(); 337 } 338 339 348 public void start(Xid xid, int flags) throws XAException { 349 _session.start(xid, flags); 350 } 351 352 360 public int prepare(Xid xid) throws XAException { 361 return _session.prepare(xid); 362 } 363 364 371 public void commit(Xid xid, boolean onePhase) throws XAException { 372 _session.commit(xid, onePhase); 373 } 374 375 385 public void end(Xid xid, int flags) throws XAException { 386 _session.end(xid, flags); 387 } 388 389 396 public void forget(Xid xid) throws XAException { 397 _session.forget(xid); 398 } 399 400 410 public Xid [] recover(int flag) throws XAException { 411 return _session.recover(flag); 412 } 413 414 421 public void rollback(Xid xid) throws XAException { 422 _session.rollback(xid); 423 } 424 425 432 public int getTransactionTimeout() throws XAException { 433 return _session.getTransactionTimeout(); 434 } 435 436 443 public boolean setTransactionTimeout(int seconds) throws XAException { 444 return _session.setTransactionTimeout(seconds); 445 } 446 447 453 public String getResourceManagerId() throws XAException { 454 return _session.getResourceManagerId(); 455 } 456 457 } 458 | Popular Tags |