private void start(ThreadFactory f) {
      // only start once....
      if (active.compareAndSet(false, true)) {
        connectionPeerReceiver = new ConnectionPeerReceiver(f);
        connectionPeerReceiver.start();

        if (isSenderUsed()) {
          sender = new Sender(f, getSenderQueueSize());
          sender.start();
        }
      }
    }
 /**
  * Send a command to the cryobay.
  *
  * @param commandMessage The string to send to the cryobay.
  * @return True if there is a connection to the cryobay
  */
 public synchronized boolean sendToCryoBay(String command) {
   if (m_sender == null) {
     m_sender = new Sender(null, m_retries, this);
     m_sender.start();
   }
   if (isConnected()) {
     m_sender.addCommand(command);
     // TODO: (Java 5) Release semaphore here
     // m_sender.interrupt(); // Wake up the run() method
     return true;
   } else {
     return false;
   }
 }
Beispiel #3
0
 /** Start Substrate running. */
 public void start() {
   sndr.start();
   rcvr.start();
 }