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);
    }
  }
Exemplo n.º 3
0
  public LockListener getLockListener() {
    LockListener res = null;

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

    return res;
  }
Exemplo n.º 4
0
  public Properties getProperties() {
    Properties res = null;

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

    return res;
  }
Exemplo n.º 5
0
  public List<Object> getEntities() {
    List<Object> res = null;

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

    return res;
  }
Exemplo n.º 6
0
  public boolean awaitShutdown(long timeout) throws InterruptedException {
    boolean res = false;

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

    return res;
  }
Exemplo n.º 7
0
  public TimeModel getTimeModel() {
    TimeModel res = null;

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

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