private GSMessageImpl receiveFromTopic(long timeout){
  if (_logger.isLoggable(Level.FINE)) {
    _logger.log(Level.FINE,"receiveFromTopic(): Receiving from Topic");
  }
  GSMessageImpl message=m_session.getNextRecoveredMessage();
  if (message != null) {
    if (_logger.isLoggable(Level.FINEST)) {
      _logger.log(Level.FINEST,toString2() + "receiveFromTopic(): Recovered message found: " + message.JMSMessageID);
    }
    message.JMSRedelivered=Boolean.TRUE;
    return message;
  }
  long now;
  long startTime=SystemTime.timeMillis();
synchronized (synchTopicNotifyLock) {
    while (currentMessage == null && timeout > 0) {
      try {
        synchTopicNotifyLock.wait(timeout);
      }
 catch (      InterruptedException e) {
        if (_logger.isLoggable(Level.SEVERE)) {
          _logger.log(Level.SEVERE,toString2() + "receiveFromTopic(): InterruptedException while waiting " + "for a message from a topic: "+ e);
        }
      }
      now=SystemTime.timeMillis();
      timeout=timeout - (now - startTime);
      startTime=now;
    }
    if (currentMessage != null) {
      message=currentMessage != topicWakeupObject ? currentMessage : null;
      currentMessage=null;
      synchTopicNotifyLock.notify();
      return message;
    }
    return null;
  }
}

private GSMessageImpl receiveFromTopic ( long timeout ) { if ( _logger . isLoggable ( Level . FINE ) ) { _logger . log ( Level . FINE , "receiveFromTopic(): Receiving from Topic" ) ; } GSMessageImpl message = m_session . getNextRecoveredMessage ( ) ; if ( message != null ) { if ( _logger . isLoggable ( Level . FINEST ) ) { _logger . log ( Level . FINEST , toString2 ( ) + "receiveFromTopic(): Recovered message found: " + message . JMSMessageID ) ; } message . JMSRedelivered = Boolean . TRUE ; return message ; } long now ; long startTime = SystemTime . timeMillis ( ) ; synchronized ( synchTopicNotifyLock ) { while ( currentMessage == null && timeout > 0 ) { try { synchTopicNotifyLock . wait ( timeout ) ; } catch ( InterruptedException e ) { if ( _logger . isLoggable ( Level . SEVERE ) ) { _logger . log ( Level . SEVERE , toString2 ( ) + "receiveFromTopic(): InterruptedException while waiting " + "for a message from a topic: " + e ) ; } } now = SystemTime . timeMillis ( ) ; timeout = timeout - ( now - startTime ) ; startTime = now ; } if ( currentMessage != null ) { message = currentMessage != topicWakeupObject ? currentMessage : null ; currentMessage = null ; synchTopicNotifyLock . notify ( ) ; return message ; } return null ; } }
retrieves a message from the topic . recovered messages are returned first .
