コード例 #1
0
  private void dispose(Throwable throwable) {
    synchronized (this) {
      if (disposed) {
        return;
      }
      disposed = true;
    }

    notifyListeners();
    for (Iterator<DisposeListener> i = disposeListeners.iterator(); i.hasNext(); ) {
      i.next().notifyDispose(this);
    }

    _iProtocol.terminate();

    try {
      _messageDispatcher.terminate();

      try {
        _xConnection.close();
      } catch (com.sun.star.io.IOException e) {
        System.err.println(getClass().getName() + ".dispose - IOException:" + e);
      }

      if (Thread.currentThread() != _messageDispatcher && _messageDispatcher.isAlive()) {
        _messageDispatcher.join(1000);
        if (_messageDispatcher.isAlive()) {
          _messageDispatcher.interrupt();
          _messageDispatcher.join();
        }
      }

      // interrupt all jobs queued by this bridge
      _iThreadPool.dispose(throwable);

      // release all out-mapped objects and all in-mapped proxies:
      freeHolders();
      // assert _java_environment instanceof java_environment;
      ((java_environment) _java_environment).revokeAllProxies();

      proxyFactory.dispose();

      if (DEBUG) {
        if (_life_count.get() != 0) {
          System.err.println(
              getClass().getName() + ".dispose - life count (proxies left):" + _life_count);
        }
        _java_environment.list();
      }

      // clear members
      _xConnection = null;
      _java_environment = null;
      _messageDispatcher = null;
    } catch (InterruptedException e) {
      System.err.println(getClass().getName() + ".dispose - InterruptedException:" + e);
    }
  }
コード例 #2
0
 /**
  * Gives a description of the connection type and protocol used.
  *
  * @return connection type and protocol.
  * @see com.sun.star.bridge.XBridge#getDescription
  */
 public String getDescription() {
   return protocol + "," + _xConnection.getDescription();
 }