Java 类javax.ejb.AccessTimeout 实例源码

项目:hopsworks    文件:CertificatesMgmService.java   
/**
 * Validates the provided password against the configured one
 * @param providedPassword Password to validate
 * @param userRequestedEmail User requested the password check
 * @throws IOException
 * @throws EncryptionMasterPasswordException
 */
@Lock(LockType.READ)
@AccessTimeout(value = 3, unit = TimeUnit.SECONDS)
public void checkPassword(String providedPassword, String userRequestedEmail)
    throws IOException, EncryptionMasterPasswordException {
  String sha = DigestUtils.sha256Hex(providedPassword);
  if (!getMasterEncryptionPassword().equals(sha)) {
    Users user = userFacade.findByEmail(userRequestedEmail);
    String logMsg = "*** Attempt to change master encryption password with wrong credentials";
    if (user != null) {
      LOG.log(Level.INFO, logMsg + " by user <" + user.getUsername() + ">");
    } else {
      LOG.log(Level.INFO, logMsg);
    }
    throw new EncryptionMasterPasswordException("Provided password is incorrect");
  }
}
项目:hopsworks    文件:CertificateMaterializer.java   
@Lock(LockType.WRITE)
@AccessTimeout(value=100)
public void forceRemoveCertificates(String username, String projectName,
    boolean bothUserAndProject) {
  // Remove project specific certificates, if any
  MaterialKey key = new MaterialKey(username, projectName);
  FileRemover scheduledRemover = scheduledFileRemovers.remove(key);
  if (null != scheduledRemover) {
    scheduledRemover.scheduledFuture.cancel(true);
  }
  deleteMaterialFromLocalFs(key.getExtendedUsername());
  materialMap.remove(key);

  if (bothUserAndProject) {
    // Remove project generic certificates, if any
    key = new MaterialKey(null, projectName);
    scheduledRemover = scheduledFileRemovers.remove(key);
    if (null != scheduledRemover) {
      scheduledRemover.scheduledFuture.cancel(true);
    }
    deleteMaterialFromLocalFs(key.getExtendedUsername());
    materialMap.remove(key);
  }
}
项目:cats    文件:RedRatManagerImpl.java   
@Override
@AccessTimeout(value=TelnetConnection.DEFAULT_READ_TIMEOUT,unit=TimeUnit.MILLISECONDS)
public RedRatDevice getIrDevice( String ip )
{
    synchronized(new Object()){
        RedRatDevice retVal = null;
        logger.info( "RedRatManager getIrDevice irDevices " + irDevices );
        if (ip != null && irDevices != null )
        {
            for ( RedRatDevice irDevice : irDevices )
            {
                if ( irDevice instanceof IrNetBoxPro )
                {
                    if ( ( ( IrNetBoxPro ) irDevice ).getIpAddress().equals( ip ) )
                    {
                        retVal = irDevice;
                    }
                }
            }
        }
        return retVal;
    }
}
项目:hopsworks    文件:CertificateMaterializer.java   
@Lock(LockType.WRITE)
@AccessTimeout(value=100)
public void removeCertificate(String username, String projectName) {
  MaterialKey key = new MaterialKey(username, projectName);
  InternalCryptoMaterial material = materialMap.get(key);
  if (null != material) {
    LOG.log(Level.FINEST, "Requested removal of material for " + key
        .getExtendedUsername() + " Ref: " + material.references);
  }
  if (null != material && material.decrementReference()) {
    materialMap.remove(key);
    scheduleFileRemover(key, new FileRemover(key, material));
  }
}
项目:javaee-samples    文件:QueueTestStats.java   
@AccessTimeout(value = 5, unit = SECONDS)
public String awaitText() {
    for (;;) {
        try {
            if (text != null) {
                return text;
            }
            MILLISECONDS.sleep(TEST_DELAY);
        } catch (InterruptedException e) {
            return null;
        }
    }
}
项目:tomee    文件:JobProcessor.java   
@Asynchronous
@Lock(READ)
@AccessTimeout(-1)
public Future<String> addJob(String jobName) {

    // Pretend this job takes a while
    doSomeHeavyLifting();

    // Return our result
    return new AsyncResult<String>(jobName);
}
项目:asistente-eventos    文件:EventBC.java   
@AccessTimeout(value = 1, unit = TimeUnit.MINUTES)
public void observe(@Observes TestEvent event) {

    if ("five".equals(event.getMessage())) {
        logger.info("¡Evento recibido!");
    }
}
项目:asistente-eventos    文件:EventObserver.java   
@AccessTimeout(value = 1, unit = TimeUnit.MINUTES)
public void observe(@Observes TestEvent event) {

    initContext();
    if ("five".equals(event.getMessage())) {
        logger.info("¡Evento recibido!");
    }
    closeContext();
}
项目:Mastering-Java-EE-Development-with-WildFly    文件:BusyOperator.java   
@AccessTimeout(0)
public void doItNow() {
    // do something
}
项目:Mastering-Java-EE-Development-with-WildFly    文件:BusyOperator.java   
@AccessTimeout(value = 5, unit = SECONDS)
public void doItSoon() {
    // do something
}
项目:testing_security_development_enterprise_systems    文件:SingletonExample03.java   
@AccessTimeout(value = 2 , unit = TimeUnit.MILLISECONDS)
@Override
public void incrementCounter() {
    x = x + 1;
}
项目:pg6100    文件:SingletonExample03.java   
@AccessTimeout(value = 2 , unit = TimeUnit.MILLISECONDS)
@Override
public void incrementCounter() {
    x = x + 1;
}
项目:hopsworks    文件:CertificatesMgmService.java   
@Lock(LockType.READ)
@AccessTimeout(value = 3, unit = TimeUnit.SECONDS)
public String getMasterEncryptionPassword() throws IOException {
  return FileUtils.readFileToString(masterPasswordFile).trim();
}
项目:hopsworks    文件:CertificateMaterializer.java   
@Lock(LockType.WRITE)
@AccessTimeout(value=500)
public void materializeCertificates(String username, String projectName)
  throws IOException {
  MaterialKey key = new MaterialKey(username, projectName);
  InternalCryptoMaterial material = materialMap.get(key);
  FileRemover scheduledRemover = null;
  LOG.log(Level.FINEST, "Requested materialization for: " + key
      .getExtendedUsername());
  if (material != null) {
    // Crypto material already exists
    material.incrementReference();
    LOG.log(Level.FINEST, "User: " + key.getExtendedUsername() + " " +
        "Material exist, ref " + material.references);
  } else {
    // Crypto material does not exist in cache
    LOG.log(Level.FINEST, "Material for " + key.getExtendedUsername()
        + " does not exist in cache");
    // But there might be scheduled a delayed removal from the local fs
    if ((scheduledRemover = scheduledFileRemovers.get(key)) != null) {
      LOG.log(Level.FINEST, "Exists scheduled removal for " + key
          .getExtendedUsername());
      // Cancel the delayed removal
      boolean canceled = scheduledRemover.scheduledFuture.cancel(false);
      scheduledFileRemovers.remove(key);
      // If managed to cancel properly, just put back the reference
      if (canceled) {
        LOG.log(Level.FINEST, "Successfully canceled delayed removal for " +
            key.getExtendedUsername());

        scheduledRemover.material.references++;
        materialMap.put(key, scheduledRemover.material);
      } else {
        // Otherwise materialize
        // Force deletion of material to avoid corrupted data
        LOG.log(Level.FINEST, "Could not cancel delayed removal, " +
            "materializing again for " + key.getExtendedUsername());
        forceRemoveCertificates(key.username, key.projectName, false);
        materialize(key);
      }
    } else {
      // Otherwise the material has been wiped-out, so materialize it anyway
      LOG.log(Level.FINEST, "Material for " + key.getExtendedUsername()
          + " has been wiped out, materializing!");
      materialize(key);
    }
  }
}
项目:hopsworks    文件:CertificateMaterializer.java   
@Lock(LockType.READ)
@AccessTimeout(value=200)
public boolean existsInStore(String username, String projectName) {
  MaterialKey key = new MaterialKey(username, projectName);
  return materialMap.containsKey(key);
}
项目:study-ocbcd    文件:EjbSingletonCMC.java   
@AccessTimeout(20000)
public void doBar() {
    System.out.println("doBar");
}
项目:tomee    文件:BusyBee.java   
@AccessTimeout(0)
public void doItNow() {
    // do something
}
项目:tomee    文件:BusyBee.java   
@AccessTimeout(value = 5, unit = TimeUnit.SECONDS)
public void doItSoon() {
    // do something
}
项目:tomee    文件:BusyBee.java   
@AccessTimeout(-1)
public void justDoIt() {
    // do something
}
项目:tomee    文件:SchedulerTest.java   
@AccessTimeout(value = 1, unit = TimeUnit.MINUTES)
public void observe(@Observes TestEvent event) {
    if ("five".equals(event.getMessage())) {
        events.countDown();
    }
}
项目:tomee    文件:AnnotationDeployer.java   
public void addClassLevelDeclaration(final AccessTimeout attribute, final Class type) {
    final ContainerConcurrency concurrency = getContainerConcurrency(type);
    concurrency.setAccessTimeout(toTimeout(attribute));
}
项目:tomee    文件:AnnotationDeployer.java   
public void addMethodLevelDeclaration(final AccessTimeout attribute, final Method method) {
    final ContainerConcurrency concurrency = getContainerConcurrency(method);
    concurrency.setAccessTimeout(toTimeout(attribute));
}
项目:tomee    文件:AnnotationDeployer.java   
private Timeout toTimeout(final AccessTimeout annotation) {
    final Timeout timeout = new Timeout();
    timeout.setTimeout(annotation.value());
    timeout.setUnit(annotation.unit());
    return timeout;
}
项目:tomee    文件:AnnotationDeployer.java   
public Class<AccessTimeout> getAnnotationClass() {
    return AccessTimeout.class;
}
项目:tomee    文件:AccessTimeoutMetaTest.java   
@AccessTimeout(value = -1)
public void method() {
}
项目:tomee    文件:AccessTimeoutTest.java   
@AccessTimeout(value = 2, unit = TimeUnit.SECONDS)
public void color() {
}
项目:tomee    文件:AccessTimeoutTest.java   
@AccessTimeout(value = 3, unit = TimeUnit.SECONDS)
public void color(final Object o) {
}
项目:tomee    文件:AccessTimeoutTest.java   
@AccessTimeout(value = 1, unit = TimeUnit.MINUTES)
public void red() {
}
项目:tomee    文件:AccessTimeoutTest.java   
@AccessTimeout(value = 2, unit = TimeUnit.HOURS)
public void crimson() {
}
项目:tomee    文件:AccessTimeoutTest.java   
@AccessTimeout(value = 2, unit = TimeUnit.DAYS)
public void scarlet() {
}
项目:tomee    文件:ConcurrentMethodTest.java   
@AccessTimeout(value = 2, unit = TimeUnit.HOURS)
public void color(final Boolean s) {
}
项目:actionbazaar    文件:FeaturedItem.java   
/**
 * Returns the featured item
 * @return featured item
 */
@Lock(LockType.READ)
@AccessTimeout(value=2,unit=TimeUnit.MINUTES)
public Item getFeaturedItem();
项目:actionbazaar    文件:FeaturedItem.java   
/**
 * Returns the featured item
 * @return featured item
 */
@Lock(LockType.READ)
@AccessTimeout(value=2,unit=TimeUnit.MINUTES)
public Item getFeaturedItem();