Package org.deuce.transaction.tl2.pool

Examples of org.deuce.transaction.tl2.pool.Pool


    return ((ByteWriteFieldAccess) writeAccess).getValue();
  }

  public char onReadAccess(Object obj, char value, long field) {
    WriteFieldAccess writeAccess = onReadAccess0(obj, field);
    if (writeAccess == null)
      return value;

    return ((CharWriteFieldAccess) writeAccess).getValue();
  }
View Full Code Here


    return ((CharWriteFieldAccess) writeAccess).getValue();
  }

  public short onReadAccess(Object obj, short value, long field) {
    WriteFieldAccess writeAccess = onReadAccess0(obj, field);
    if (writeAccess == null)
      return value;

    return ((ShortWriteFieldAccess) writeAccess).getValue();
View Full Code Here

    return ((ShortWriteFieldAccess) writeAccess).getValue();

  }

  public int onReadAccess(Object obj, int value, long field) {
    WriteFieldAccess writeAccess = onReadAccess0(obj, field);
    if (writeAccess == null)
      return value;

    return ((IntWriteFieldAccess) writeAccess).getValue();
  }
View Full Code Here

    return ((IntWriteFieldAccess) writeAccess).getValue();
  }

  public long onReadAccess(Object obj, long value, long field) {
    WriteFieldAccess writeAccess = onReadAccess0(obj, field);
    if (writeAccess == null)
      return value;

    return ((LongWriteFieldAccess) writeAccess).getValue();
  }
View Full Code Here

    return ((LongWriteFieldAccess) writeAccess).getValue();
  }

  public float onReadAccess(Object obj, float value, long field) {
    WriteFieldAccess writeAccess = onReadAccess0(obj, field);
    if (writeAccess == null)
      return value;

    return ((FloatWriteFieldAccess) writeAccess).getValue();
  }
View Full Code Here

    return ((FloatWriteFieldAccess) writeAccess).getValue();
  }

  public double onReadAccess(Object obj, double value, long field) {
    WriteFieldAccess writeAccess = onReadAccess0(obj, field);
    if (writeAccess == null)
      return value;

    return ((DoubleWriteFieldAccess) writeAccess).getValue();
  }
View Full Code Here

   public Object invoke(Invocation invocation) throws Throwable
   {
      EJBContainerInvocation ejb = (EJBContainerInvocation) invocation;
      EJBContainer container = (EJBContainer)ejb.getAdvisor();
      Pool pool = container.getPool();
      BeanContext<?> ctx = pool.get();
      ejb.setTargetObject(ctx.getInstance());
      ejb.setBeanContext(ctx);
      container.pushContext(ctx);

      boolean discard = false;

      try
      {
         return ejb.invokeNext();
      }
      catch (Exception ex)
      {
         discard = (ex instanceof EJBException) ||
                 ((ex instanceof RuntimeException || ex instanceof RemoteException) && !StatefulInstanceInterceptor.isApplicationException(ex.getClass(), container));
         throw ex;
      }
      finally
      {
         container.popContext();
         ejb.setTargetObject(null);
         ejb.setBeanContext(null);
         if (discard) pool.discard(ctx);
         else pool.release(ctx);
      }
   }
View Full Code Here

   public Object invoke(Invocation invocation) throws Throwable
   {
      EJBContainerInvocation<StatelessContainer, StatelessBeanContext> ejb = (EJBContainerInvocation<StatelessContainer, StatelessBeanContext>) invocation;
      EJBContainer container = getEJBContainer(invocation);
      Pool pool = container.getPool();
      BeanContext<?> ctx = pool.get();
      assert ctx != null : "pool returned null instance";
      //ejb.setTargetObject(ctx.getInstance());
      ejb.setBeanContext(ctx);
      container.pushContext(ctx);

      boolean discard = false;

      try
      {
         return ejb.invokeNext();
      }
      catch (Exception ex)
      {
         discard = (ex instanceof EJBException) ||
                 ((ex instanceof RuntimeException || ex instanceof RemoteException) && !StatefulRemoveInterceptor.isApplicationException(ex, (MethodInvocation)invocation));
         throw ex;
      }
      catch (final Throwable t)
      {
         discard = true;
         throw t;
      }
      finally
      {
         container.popContext();
         //ejb.setTargetObject(null);
         ejb.setBeanContext(null);
         if (discard) pool.discard(ctx);
         else pool.release(ctx);
      }
   }
View Full Code Here

         }
      });
     
      entree.await(5, SECONDS);
     
      Pool pool = container.getPool();
      assertEquals(1, pool.getCreateCount());
      assertEquals("the pool should have grown", 1, pool.getMaxSize());
      int inUse = pool.getMaxSize() - pool.getAvailableCount();
      assertEquals("the instance should be in use", 1, inUse);
     
      exit.await(5, SECONDS);
     
      future.get(5, SECONDS);
View Full Code Here

   }
  
   @Test
   public void testMaxSize()
   {
      Pool pool = container.getPool();
      int actual = pool.getMaxSize();
      assertEquals("a ThreadLocalPool starts empty and grows", 0, actual);
   }
View Full Code Here

TOP

Related Classes of org.deuce.transaction.tl2.pool.Pool

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.