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);
    }
  }
示例#3
0
  public LockListener getLockListener() {
    LockListener res = null;

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

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

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

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

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

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

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

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

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

    return res;
  }
示例#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();
            }
          }
        }
      }
    }
  }
示例#11
0
 public void setTimeModel(TimeModel timeModel) {
   if (resource != null) {
     resource.setTimeModel(timeModel);
   }
 }
 protected synchronized void disposeExecutingSynchronizer() {
   if (executingSynchronizer != null) {
     executingSynchronizer.dispose();
     executingSynchronizer = null;
   }
 }
示例#13
0
 public void shutdown() {
   if (resource != null) {
     resource.shutdown();
   }
 }
示例#14
0
 public void awaitShutdown() throws InterruptedException {
   if (resource != null) {
     resource.awaitShutdown();
   }
 }
示例#15
0
 public void dispose() {
   if (resource != null) {
     resource.dispose();
     resource = null;
   }
 }
示例#16
0
 public void setLockListener(LockListener lockListener) {
   if (resource != null) {
     resource.setLockListener(lockListener);
   }
 }
示例#17
0
 public void cancel(Handle h) {
   if (resource != null) {
     resource.cancel(h);
   }
 }