예제 #1
0
 protected synchronized Notifier.Client getNotifier()
     throws AuthenticationException, SystemException, TException {
   if (_notifier == null) {
     // _transport = new TSocket(_url.getHost(), _url.getPort());
     _transport =
         TSocketFactory.getInstance(((ThriftAppMgr) getManager())._serverPort + 1)
             .getTransport(getApplicationKey());
     TBinaryProtocol binaryProtocol = new TBinaryProtocol(_transport);
     Notifier.Client notifier = new Notifier.Client(binaryProtocol);
     // _transport.open();
     try {
       _token = notifier.bind(_url.getAuthority());
       _notifier = notifier;
       LOG.info(notifier + " is connectioned to token=" + _token);
     } catch (BindException e) {
       // TODO: rebind
     }
   }
   return _notifier;
 }
예제 #2
0
 public synchronized void dispose() {
   if (_calls != null) {
     for (Call call : _calls.values()) {
       call.hangup();
       if (_notifier != null) {
         try {
           _notifier.hangup(_token, ((CallImpl) call).getId(), new HangupStruct());
         } catch (Exception e) {
           // ignore
         }
       }
     }
     _calls = null;
   }
   if (_transport != null && _notifier != null) {
     try {
       _notifier.unbind(_token);
     } catch (Throwable t) {
       // ignore
     }
     _notifier = null;
     _transport.close();
   }
 }