Examples of ILock


Examples of org.apache.aurora.scheduler.storage.entities.ILock

        ImmutableSet.of(new Attribute("attr", ImmutableSet.of("value")))));
    StoredJob job = new StoredJob(
        "jobManager",
        new JobConfiguration().setKey(new JobKey("owner", "env", "name")));
    String frameworkId = "framework_id";
    ILock lock = ILock.build(new Lock()
        .setKey(LockKey.job(JobKeys.from("testRole", "testEnv", "testJob").newBuilder()))
        .setToken("lockId")
        .setUser("testUser")
        .setTimestampMs(12345L));
    SchedulerMetadata metadata = new SchedulerMetadata()
View Full Code Here

Examples of org.apache.aurora.scheduler.storage.entities.ILock

              formatLockKey(lockKey),
              new Date(existingLock.get().getTimestampMs()).toString(),
              existingLock.get().getUser()));
        }

        ILock lock = ILock.build(new Lock()
            .setKey(lockKey.newBuilder())
            .setToken(tokenGenerator.createNew().toString())
            .setTimestampMs(clock.nowMillis())
            .setUser(user));
View Full Code Here

Examples of org.apache.aurora.scheduler.storage.entities.ILock

    try {
      SessionContext context = sessionValidator.checkAuthenticated(
          session,
          ImmutableSet.of(getRoleFromLockKey(lockKey)));

      ILock lock = lockManager.acquireLock(lockKey, context.getIdentity());
      response.setResult(Result.acquireLockResult(
          new AcquireLockResult().setLock(lock.newBuilder())));

      return response.setResponseCode(OK);
    } catch (AuthFailedException e) {
      return addMessage(response, AUTH_FAILED, e);
    } catch (LockException e) {
View Full Code Here

Examples of org.apache.aurora.scheduler.storage.entities.ILock

    requireNonNull(mutableLock);
    requireNonNull(validation);
    requireNonNull(session);

    Response response = Util.emptyResponse();
    ILock lock = ILock.build(mutableLock);

    try {
      sessionValidator.checkAuthenticated(
          session,
          ImmutableSet.of(getRoleFromLockKey(lock.getKey())));

      if (validation == LockValidation.CHECKED) {
        lockManager.validateIfLocked(lock.getKey(), Optional.of(lock));
      }
      lockManager.releaseLock(lock);
      return response.setResponseCode(OK);
    } catch (AuthFailedException e) {
      return addMessage(response, AUTH_FAILED, e);
View Full Code Here

Examples of org.eclipse.core.runtime.jobs.ILock

    final IDiagram modelRef = model;

    // Creating the model
    IProgressMonitor pm = Job.getJobManager().createProgressGroup();
    pm.beginTask("Compute Model", IProgressMonitor.UNKNOWN);
    final ILock lock = Job.getJobManager().newLock();
    Job createModeJob = new Job("Create Model") {
      /**
       * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
       */
      @Override
      protected IStatus run(IProgressMonitor monitor) {
        try {
          lock.acquire();
          //                return ModelFactory.computeBottomUpDependenciesModel(modelRef, monitor);
          return ModelFactory.computeModel(modelRef, dependenciesProvider, monitor);
        } finally {
          lock.release();
        }
      }
    };
    createModeJob.setUser(true);
    createModeJob.setProgressGroup(pm, IProgressMonitor.UNKNOWN);
    createModeJob.setThread(new Thread());
    createModeJob.schedule();

    // Creates job : Computing model connection's costs
    final IDiagram workingModel = model;
    Job simplifyModelJob = new Job("Simplify Model") {
      /**
       * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
       */
      @Override
      protected IStatus run(IProgressMonitor monitor) {
        try {
          lock.acquire();
          // IStatus computePathCostSatus = Status.OK_STATUS;
          IStatus computePathCostSatus = ModelFactory.computePathCost(workingModel, monitor);
          if (!Status.OK_STATUS.equals(computePathCostSatus)) {
            return computePathCostSatus;
          }

          IStatus editorStatus = null;
          // Open Editor within UI thread.
          if (Display.getCurrent() == null) {
            // Not in UI Thread
            class OpenEditor implements Runnable {
              IStatus status;

              public void run() {
                status = openEditor(workingModel);
              }
            }

            Display display = PlatformUI.getWorkbench().getDisplay();
            OpenEditor openEditor = new OpenEditor();
            display.syncExec(openEditor);
            editorStatus = openEditor.status;
          } else {
            // In UI Thread
            editorStatus = openEditor(workingModel);
          }
          monitor.done();
          return editorStatus;
        } finally {
          lock.release();
        }
      }
    };
    simplifyModelJob.setUser(true);
    simplifyModelJob.setProgressGroup(pm, IProgressMonitor.UNKNOWN);
View Full Code Here

Examples of org.eclipse.core.runtime.jobs.ILock

  @Test
  public void testQWickieBuilder() {
    long start = System.nanoTime(); // 1975738

    ILock workspaceLock = new ILock() {

      public void release() {
      }

      public int getDepth() {
View Full Code Here

Examples of org.eclipse.core.runtime.jobs.ILock

      // we "force" document update to always take place on display
      // thread.
      IDocument doc = getDocument();
      if (doc instanceof ILockable) {

        ILock lock = null;
        try {
          lock = ((ILockable) doc).getLockObject();
          lock.acquire();
          getDisplay().syncExec(r);
        }
        finally {
          if (lock != null) {
            lock.release();
          }
        }
      }
      else {
        // else, ignore!, since risk of deadlock
View Full Code Here

Examples of xbird.util.concurrent.lock.ILock

            }
            return readBlock;
        }

        private int[] getBlock(final int page) {
            final ILock lock = _lock;
            lock.lock();
            try {
                return _pageReadCache.get(page);
            } finally {
                lock.unlock();
            }
        }
View Full Code Here

Examples of xbird.util.concurrent.lock.ILock

                lock.unlock();
            }
        }

        private void putBlock(final int page, final int[] b) {
            final ILock lock = _lock;
            lock.lock();
            try {
                _pageReadCache.putIfAbsent(page, b);
            } finally {
                lock.unlock();
            }
        }
View Full Code Here

Examples of xbird.util.concurrent.lock.ILock

    public Sequence<? extends Item> eval(Sequence<? extends Item> contextSeq, DynamicContext dynEnv)
            throws XQueryException {
        if(_result != null) {
            return _result;
        }
        final ILock lock = _lock;
        if(_exported && !lock.isLocked()) {
            throw new IllegalStateException("ThreadVariable#" + getName()
                    + " should not called by this thread: " + Thread.currentThread().getName());
        }
        lock.lock();
        try {
            if(_catchedException != null) {
                throw _catchedException;
            }
            final Sequence result = _result;
            if(result == null) {
                throw new XQueryException("Result of ThreadedVariable#" + getName()
                        + " was illegally null");
            }
            return result;
        } finally {
            lock.unlock();
            this._dynEnv = null;
            //this._result = null;
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.