@Override public void sendReply(Reply reply) { session.reply(reply); }
public void destroy() { session.destroy(); session = null; }
@Override public String connectionSpec() { return session.getConnectionSpec(); }
public void ackMessage(Message msg) { session.acknowledge(msg); }
@Override public String name() { return session.getName(); }
/** * Sets the destroyed flag to true. The very first time this method is called, it cleans up all its dependencies. * Even if you retain a reference to this object, all of its content is allowed to be garbage collected. * * @return True if content existed and was destroyed. */ public boolean destroy() { if (!destroyed.getAndSet(true)) { close(); return true; } return false; }
/** * <p>Creates a destination session on top of this message bus using the * given handlers and parameter object.</p> * * @param params The parameters to control the session. * @return The created session. */ public synchronized DestinationSession createDestinationSession(DestinationSessionParams params) { if (destroyed.get()) { throw new IllegalStateException("Object is destroyed."); } if (sessions.containsKey(params.getName())) { throw new IllegalArgumentException("Name '" + params.getName() + "' is not unique."); } DestinationSession session = new DestinationSession(this, params); sessions.put(params.getName(), session); if (params.getBroadcastName()) { net.registerSession(params.getName()); } return session; }
@Override public void reply(Reply reply) { destinationSession.reply(reply); }
@Override public void destroy() { destinationSession.destroy(); }
@Override public String getConnectionSpec() { return destinationSession.getConnectionSpec(); } }
public void sendReply(Reply reply) { session.reply(reply); }
@Override protected void destroy() { log.log(LogLevel.DEBUG, "Destroying shared destination session."); session.destroy(); mbusReference.close(); } }
public String connectionSpec() { return session.getConnectionSpec(); }
public void ack(AckToken token) { try { log.log(LogLevel.DEBUG, "Sending ack " + token.ackObject); session.reply((Reply) token.ackObject); } catch (Exception e) { e.printStackTrace(); } }
public void close() { session.destroy(); mbus.destroy(); if (slobrok != null) { slobrok.stop(); } }
/** * Conveniece method for acknowledging a message back to the sender. * * This is equivalent to: * <pre> * Reply ack = new EmptyReply(); * ack.swapState(msg); * reply(ack); * </pre> * * Messages should be acknowledged when * <ul> * <li>this destination has safely and permanently applied the message, or * <li>an intermediate determines that the purpose of the message is fullfilled without forwarding the message * </ul> * * @param msg The message to acknowledge back to the sender. * @see #reply */ public void acknowledge(Message msg) { Reply ack = new EmptyReply(); msg.swapState(ack); reply(ack); }