/** * Returns the next available message in the chat. The method call will block * (not return) until a packet is available or the <tt>timeout</tt> has elapased. * If the timeout elapses without a result, <tt>null</tt> will be returned. * * @param timeout the maximum amount of time to wait for the next message. * @return the next message, or <tt>null</tt> if the timeout elapses without a * message becoming available. */ public Message nextMessage(long timeout) { return (Message) messageCollector.nextResult(timeout); }
/** * Polls for and returns the next message, or <tt>null</tt> if there isn't * a message immediately available. This method provides significantly different * functionalty than the {@link #nextMessage()} method since it's non-blocking. * In other words, the method call will always return immediately, whereas the * nextMessage method will return only when a message is available (or after * a specific timeout). * * @return the next message if one is immediately available and * <tt>null</tt> otherwise. */ public Message pollMessage() { return (Message) messageCollector.pollResult(); }
public void processPacket(Packet p) { if (PRESENCE_FILTER.accept(p)) { presenceListener.processPacket(p); } else if (MESSAGE_FILTER.accept(p)) { messageCollector.processPacket(p); if (SUBJECT_FILTER.accept(p)) { subjectListener.processPacket(p); } } else if (DECLINES_FILTER.accept(p)) { declinesListener.processPacket(p); } }
messageCollector = new ConnectionDetachedPacketCollector();
public void processPacket(Packet p) { if (PRESENCE_FILTER.accept(p)) { presenceListener.processPacket(p); } else if (MESSAGE_FILTER.accept(p)) { messageCollector.processPacket(p); if (SUBJECT_FILTER.accept(p)) { subjectListener.processPacket(p); } } else if (DECLINES_FILTER.accept(p)) { declinesListener.processPacket(p); } }
messageCollector = new ConnectionDetachedPacketCollector();
/** * Returns the next available message in the chat. The method call will block * (not return) until a packet is available or the <tt>timeout</tt> has elapased. * If the timeout elapses without a result, <tt>null</tt> will be returned. * * @param timeout the maximum amount of time to wait for the next message. * @return the next message, or <tt>null</tt> if the timeout elapses without a * message becoming available. */ public Message nextMessage(long timeout) { return (Message) messageCollector.nextResult(timeout); }
public void processPacket(Packet p) { if (PRESENCE_FILTER.accept(p)) { presenceListener.processPacket(p); } else if (MESSAGE_FILTER.accept(p)) { messageCollector.processPacket(p); if (SUBJECT_FILTER.accept(p)) { subjectListener.processPacket(p); } } else if (DECLINES_FILTER.accept(p)) { declinesListener.processPacket(p); } }
/** * Polls for and returns the next message, or <tt>null</tt> if there isn't * a message immediately available. This method provides significantly different * functionalty than the {@link #nextMessage()} method since it's non-blocking. * In other words, the method call will always return immediately, whereas the * nextMessage method will return only when a message is available (or after * a specific timeout). * * @return the next message if one is immediately available and * <tt>null</tt> otherwise. */ public Message pollMessage() { return (Message) messageCollector.pollResult(); }
messageCollector = new ConnectionDetachedPacketCollector();
/** * Returns the next available message in the chat. The method call will block * (not return) until a message is available. * * @return the next message. */ public Message nextMessage() { return (Message) messageCollector.nextResult(); }
/** * Polls for and returns the next message, or <tt>null</tt> if there isn't * a message immediately available. This method provides significantly different * functionalty than the {@link #nextMessage()} method since it's non-blocking. * In other words, the method call will always return immediately, whereas the * nextMessage method will return only when a message is available (or after * a specific timeout). * * @return the next message if one is immediately available and * <tt>null</tt> otherwise. */ public Message pollMessage() { return (Message) messageCollector.pollResult(); }
/** * Returns the next available message in the chat. The method call will block * (not return) until a message is available. * * @return the next message. */ public Message nextMessage() { return (Message) messageCollector.nextResult(); }
/** * Returns the next available message in the chat. The method call will block * (not return) until a message is available. * * @return the next message. */ public Message nextMessage() { return (Message) messageCollector.nextResult(); }
/** * Returns the next available message in the chat. The method call will block * (not return) until a packet is available or the <tt>timeout</tt> has elapased. * If the timeout elapses without a result, <tt>null</tt> will be returned. * * @param timeout the maximum amount of time to wait for the next message. * @return the next message, or <tt>null</tt> if the timeout elapses without a * message becoming available. */ public Message nextMessage(long timeout) { return (Message) messageCollector.nextResult(timeout); }