Пример #1
0
  @Override
  public void interfaceRemoved(Query operation, DOFObjectID objectID, DOFInterfaceID interfaceID) {
    if (!objectID.equals(providerId) || !interfaceID.equals(HubRequestInterface.IID)) return;
    log.trace("Hub Request Provider Removed {}:{}", objectID, interfaceID);

    //        requestProvided.set(false);
    GracePeriodExpiredTask gracePeriodExpiredTask = new GracePeriodExpiredTask(this);
    synchronized (this) {
      if (gracePeriodFuture != null) {
        gracePeriodFuture.cancel(true);
        gracePeriodFuture = null;
      }
      gracePeriodExpiredFuture =
          hubProvideFactory.timerExecutor.schedule(
              gracePeriodExpiredTask, requestorGracePeriodMinutes.get(), TimeUnit.MINUTES);
      if (provider != null) provider.requestProvideStopped(-1);
    }
  }
Пример #2
0
 /**
  * ************************************************************************
  * DOFSystem.QueryOperationListener implementation
  * ************************************************************************
  */
 @Override
 public void interfaceAdded(Query operation, DOFObjectID objectId, DOFInterfaceID interfaceId) {
   if (!objectId.equals(providerId) || !interfaceId.equals(HubRequestInterface.IID)) return;
   //        if (gracePeriodExpired.get())
   //            return;
   //        requestProvided.set(true);
   log.trace("Hub Request Provider Added {}:{}", objectId, interfaceId);
   synchronized (this) {
     if (gracePeriodExpiredFuture != null) {
       gracePeriodExpiredFuture.cancel(true);
       gracePeriodExpiredFuture = null;
       provider.requestProvideStarted();
     }
     if (provider != null) return; // existing state is fine, we are done here.
     // first time, or first time after a hubProvideFactory.remove(monitor)
     gracePeriodFuture =
         hubProvideFactory.executor.submit(new GetGracePeriodTask(this, objectId, interfaceId));
   }
 }