protected Handle executeDirectly(Object entity, Executable e, SynchronizerListener l) {
    Handle res = null;

    {
      Synchronizer synchronizer = executingSynchronizer;

      Handle handle = synchronizer.execute(entity, e, l);

      res = new ExecuteHandle(handle, entity, e);
    }

    return res;
  }
  public void cancel(Handle h) {
    if (h != null) {
      if (!(h instanceof ExecuteHandle)) {
        throw new IllegalArgumentException();
      }

      ExecuteHandle handle = (ExecuteHandle) h;

      Object entity = handle.entity;
      Executable e = handle.e;
      Handle subHandle = handle.handle;

      Synchronizer synchronizer = getSynchronizer(entity, e);

      synchronizer.cancel(subHandle);
    }
  }
Exemple #3
0
  public LockListener getLockListener() {
    LockListener res = null;

    {
      if (resource != null) {
        res = resource.getLockListener();
      }
    }

    return res;
  }
Exemple #4
0
  public Properties getProperties() {
    Properties res = null;

    {
      if (resource != null) {
        res = resource.getProperties();
      }
    }

    return res;
  }
Exemple #5
0
  public List<Object> getEntities() {
    List<Object> res = null;

    {
      if (resource != null) {
        res = resource.getEntities();
      }
    }

    return res;
  }
Exemple #6
0
  public boolean awaitShutdown(long timeout) throws InterruptedException {
    boolean res = false;

    {
      if (resource != null) {
        res = resource.awaitShutdown(timeout);
      }
    }

    return res;
  }
Exemple #7
0
  public TimeModel getTimeModel() {
    TimeModel res = null;

    {
      if (resource != null) {
        res = resource.getTimeModel();
      }
    }

    return res;
  }
Exemple #8
0
  public Handle execute(Object entity, Executable e, SynchronizerListener l) {
    Handle res = null;

    {
      if (resource != null) {
        resource.execute(entity, e, l);
      }
    }

    return res;
  }
  public synchronized boolean awaitShutdown(long timeout) throws InterruptedException {
    boolean res = false;

    {
      long t0 = System.currentTimeMillis();
      long t1 = t0 + timeout;

      long timeoutLeft = timeout;

      // Await shutdown of the executing synchronizer:
      {
        if (executingSynchronizer != null) {
          executingSynchronizer.awaitShutdown(timeoutLeft);
        }
      }

      // Await shutdown of the locking synchronizers:
      {
        if (lockingSynchronizers != null) {
          synchronized (lockingSynchronizers) {
            Collection<LockingSynchronizer> v = lockingSynchronizers.values();
            if (v != null) {
              for (LockingSynchronizer synchronizer : v) {
                long t = System.currentTimeMillis();
                timeoutLeft = t1 - t;
                if (timeoutLeft <= 0) {
                  break;
                } else {
                  synchronizer.awaitShutdown(timeoutLeft);
                }
              }
            }
          }
        }
      }
    }

    return res;
  }
  public synchronized void shutdown() {
    // Shutdown the executing synchronizer:
    {
      if (executingSynchronizer != null) {
        executingSynchronizer.shutdown();
      }
    }

    // Shutdown the locking synchronizers:
    {
      Map<Object, LockingSynchronizer> lockingSynchronizers = this.lockingSynchronizers;

      if (lockingSynchronizers != null) {
        synchronized (lockingSynchronizers) {
          Collection<LockingSynchronizer> v = lockingSynchronizers.values();
          if (v != null) {
            for (LockingSynchronizer synchronizer : v) {
              synchronizer.shutdown();
            }
          }
        }
      }
    }
  }
Exemple #11
0
 public void setTimeModel(TimeModel timeModel) {
   if (resource != null) {
     resource.setTimeModel(timeModel);
   }
 }
 protected synchronized void disposeExecutingSynchronizer() {
   if (executingSynchronizer != null) {
     executingSynchronizer.dispose();
     executingSynchronizer = null;
   }
 }
Exemple #13
0
 public void shutdown() {
   if (resource != null) {
     resource.shutdown();
   }
 }
Exemple #14
0
 public void awaitShutdown() throws InterruptedException {
   if (resource != null) {
     resource.awaitShutdown();
   }
 }
Exemple #15
0
 public void dispose() {
   if (resource != null) {
     resource.dispose();
     resource = null;
   }
 }
Exemple #16
0
 public void setLockListener(LockListener lockListener) {
   if (resource != null) {
     resource.setLockListener(lockListener);
   }
 }
Exemple #17
0
 public void cancel(Handle h) {
   if (resource != null) {
     resource.cancel(h);
   }
 }