static boolean isAvailableForConnection(){
  boolean available;
  if (_connectionInProgress.get()) {
    available=false;
  }
 else {
    RequestReceiver receiver=_receiverRef.get();
    boolean connected=false;
    if (receiver != null) {
      try {
        receiver.getReceiverID();
        connected=true;
      }
 catch (      RemoteException e) {
      }
    }
    available=!connected;
  }
  return available;
}

static boolean isAvailableForConnection ( ) { boolean available ; if ( _connectionInProgress . get ( ) ) { available = false ; } else { RequestReceiver receiver = _receiverRef . get ( ) ; boolean connected = false ; if ( receiver != null ) { try { receiver . getReceiverID ( ) ; connected = true ; } catch ( RemoteException e ) { } } available = ! connected ; } return available ; }
if this session of matlab is available to be connected to from an external java program . it will be available if it is not currently connected to and there is no connection in progress .
