Package railo.runtime.exp

Examples of railo.runtime.exp.LockException


    //if(timeoutInMillis==0)timeoutInMillis=30000;
    //print.out("doStartTag");
      manager=pageContext.getConfig().getLockManager();
        // check attributes
      if(name!=null && scope!=SCOPE_NONE) {
          throw new LockException(
                  LockException.OPERATION_CREATE,
                  this.name,
                  "invalid attribute combination",
                    "attribute [name] and [scope] can't be used together");
        }
      if(name==null && scope==SCOPE_NONE)    {
        name="id-"+id;
        }
       
      String lockType = null;
      if(name==null) {
        String cid=pageContext.getConfig().getId();
          // Session
          if(scope==SCOPE_REQUEST){
              lockType="request";
              name="__request_"+cid+"__"+ ((RequestImpl)pageContext.requestScope())._getId();
          }
          // Session
          else if(scope==SCOPE_SESSION){
              lockType="session";
              name="__session_"+cid+"__"+ pageContext.sessionScope()._getId();
          }
          // Application
          else if(scope==SCOPE_APPLICATION){
              lockType="application";
              name="__application_"+cid+"__"+((ApplicationImpl)pageContext.applicationScope())._getId();
          }
          // Server
          else if(scope==SCOPE_SERVER){
              lockType="server";
              name="__server_"+((ServerImpl)pageContext.serverScope())._getId();
          }
      }
      Struct cflock=new StructImpl();
      cflock.set("succeeded",Boolean.TRUE);
      cflock.set("errortext","");
      pageContext.variablesScope().set("cflock",cflock);
        start=System.nanoTime();
        try {
        ((PageContextImpl)pageContext).setActiveLock(new ActiveLock(type,name,timeoutInMillis)); // this has to be first, otherwise LockTimeoutException has nothing to release
        data = manager.lock(type,name,timeoutInMillis,pageContext.getId());
    }
    catch (LockTimeoutException e) {
      LockManagerImpl mi = (LockManagerImpl)manager;
        Boolean hasReadLock = mi.isReadLocked(name);
        Boolean hasWriteLock = mi.isWriteLocked(name);
        String msg = LockTimeoutExceptionImpl.createMessage(type, name, lockType, timeoutInMillis, hasReadLock, hasWriteLock);
       
        _release(pageContext,System.nanoTime()-start);
        name=null;
       
        cflock.set("succeeded",Boolean.FALSE);
        cflock.set("errortext",msg);

      if(throwontimeout) throw new LockException(
                  LockException.OPERATION_TIMEOUT,
                  this.name,
                  msg);
     
      return SKIP_BODY;
View Full Code Here


        return new FunctionException(pc,functionName, badArgumentPosition, badArgumentName,message,detail);
    }
   
    @Override
    public PageException createLockException(String operation, String name, String message) {
        return new LockException(operation,name,message);
    }
View Full Code Here

TOP

Related Classes of railo.runtime.exp.LockException

Copyright © 2018 www.massapicom. 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.